Spaces:
Sleeping
Sleeping
Update langchain_helper.py
Browse files- langchain_helper.py +8 -6
langchain_helper.py
CHANGED
|
@@ -28,17 +28,18 @@ from plotly.express import bar, line, scatter, area, pie
|
|
| 28 |
from dotenv import load_dotenv, find_dotenv
|
| 29 |
_ = load_dotenv(find_dotenv()) # read local .env file
|
| 30 |
|
| 31 |
-
current_model_id =
|
| 32 |
|
| 33 |
def get_few_shot_db_chain(user_message):
|
| 34 |
chromadb.api.client.SharedSystemClient.clear_system_cache()
|
| 35 |
-
|
| 36 |
-
llm = ChatOpenAI(model = current_model_id)
|
| 37 |
print(llm)
|
| 38 |
engine = create_engine("sqlite:///ecomm.db")
|
| 39 |
db = SQLDatabase(engine=engine, sample_rows_in_table_info=3)
|
| 40 |
-
|
| 41 |
-
embeddings =
|
|
|
|
| 42 |
print(embeddings)
|
| 43 |
to_vectorize = [" ".join(example.values()) for example in few_shots]
|
| 44 |
|
|
@@ -88,7 +89,8 @@ def get_few_shot_db_chain(user_message):
|
|
| 88 |
|
| 89 |
|
| 90 |
def get_graph_details(usermessage:str, df=None):
|
| 91 |
-
llm =
|
|
|
|
| 92 |
template = ChatPromptTemplate.from_messages(
|
| 93 |
[("system", "You are a visualisation expert and plotly developer, your task is to come up with best suitable \
|
| 94 |
chart representing user ask for the given data. please use plotly express library in python for \
|
|
|
|
| 28 |
from dotenv import load_dotenv, find_dotenv
|
| 29 |
_ = load_dotenv(find_dotenv()) # read local .env file
|
| 30 |
|
| 31 |
+
current_model_id = "gpt-35-turbo-instruct"
|
| 32 |
|
| 33 |
def get_few_shot_db_chain(user_message):
|
| 34 |
chromadb.api.client.SharedSystemClient.clear_system_cache()
|
| 35 |
+
llm = AzureOpenAI(deployment_name="gpt-35-turbo-instruct", temperature=0.2)
|
| 36 |
+
#llm = ChatOpenAI(model = current_model_id)
|
| 37 |
print(llm)
|
| 38 |
engine = create_engine("sqlite:///ecomm.db")
|
| 39 |
db = SQLDatabase(engine=engine, sample_rows_in_table_info=3)
|
| 40 |
+
|
| 41 |
+
embeddings = AzureOpenAIEmbeddings(model="text-embedding-3-small")
|
| 42 |
+
#embeddings = OpenAIEmbeddings(model="text-embedding-3-small")
|
| 43 |
print(embeddings)
|
| 44 |
to_vectorize = [" ".join(example.values()) for example in few_shots]
|
| 45 |
|
|
|
|
| 89 |
|
| 90 |
|
| 91 |
def get_graph_details(usermessage:str, df=None):
|
| 92 |
+
llm = AzureOpenAI(deployment_name=current_model_id, temperature=0.15)
|
| 93 |
+
#llm = ChatOpenAI(deployment_name=current_model_id, temperature=0.15)
|
| 94 |
template = ChatPromptTemplate.from_messages(
|
| 95 |
[("system", "You are a visualisation expert and plotly developer, your task is to come up with best suitable \
|
| 96 |
chart representing user ask for the given data. please use plotly express library in python for \
|