-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21a42f2
commit 3cdc6cb
Showing
3 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
"""Example of using PandasAI with a Snowflake""" | ||
|
||
from pandasai import SmartDatalake | ||
from pandasai import SmartDataframe | ||
from pandasai.llm import OpenAI | ||
from pandasai.connectors import SnowFlakeConnector | ||
|
||
|
||
snowflake_connector = SnowFlakeConnector(config={ | ||
"account": "ehxzojy-ue47135", | ||
snowflake_connector = SnowFlakeConnector( | ||
config={ | ||
"account": "ehxzojy-ue47135", | ||
"database": "SNOWFLAKE_SAMPLE_DATA", | ||
"username": "test", | ||
"password": "*****", | ||
"table": "lineitem", | ||
"warehouse" : "COMPUTE_WH", | ||
"warehouse": "COMPUTE_WH", | ||
"dbSchema": "tpch_sf1", | ||
"where": [ | ||
# this is optional and filters the data to | ||
# reduce the size of the dataframe | ||
["l_quantity", ">","49"] | ||
["l_quantity", ">", "49"] | ||
], | ||
}) | ||
} | ||
) | ||
|
||
OPEN_AI_API = "Your-API-Key" | ||
llm = OpenAI(api_token=OPEN_AI_API) | ||
df = SmartDatalake([snowflake_connector], config={"llm": llm}) | ||
df = SmartDataframe(snowflake_connector, config={"llm": llm}) | ||
|
||
response = df.chat("Count line status is F") | ||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from pandasai.connectors.yahoo_finance import YahooFinanceConnector | ||
from pandasai import SmartDataframe | ||
from pandasai.llm import OpenAI | ||
|
||
|
||
yahoo_connector = YahooFinanceConnector("MSFT") | ||
|
||
|
||
OPEN_AI_API = "OPEN_API_KEY" | ||
llm = OpenAI(api_token=OPEN_AI_API) | ||
df = SmartDataframe(yahoo_connector, config={"llm": llm}) | ||
|
||
response = df.chat("closing price yesterday") | ||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters