Spaces:
Running
Running
Update langchain_helper.py
Browse files27 unmodified lines282930313233343536373839404142434443 unmodified lines8889909192939427 unmodified linesfrom dotenv import load_dotenv, find_dotenv_ = load_dotenv(find_dotenv()) # read local .env filecurrent_model_id = os.getenv('model_id')def get_few_shot_db_chain(user_message):chromadb.api.client.SharedSystemClient.clear_system_cache()#llm = AzureOpenAI(deployment_name="gpt-35-turbo-instruct", temperature=0.2)llm = ChatOpenAI(model = current_model_id)print(llm)engine = create_engine("sqlite:///ecomm.db")db = SQLDatabase(engine=engine, sample_rows_in_table_info=3)embeddings = OpenAIEmbeddings(model="text-embedding-3-small")print(embeddings)to_vectorize = [" ".join(example.values()) for example in few_shots]43 unmodified linesdef get_graph_details(usermessage:str, df=None):llm = ChatOpenAI(deployment_name=current_model_id, temperature=0.15)template = ChatPromptTemplate.from_messages([("system", "You are a visualisation expert and plotly developer, your task is to come up with best suitable \chart representing user ask for the given data. please use plotly express library in python for \27 unmodified lines28293031323334353637383940414243444543 unmodified lines899091929394959627 unmodified linesfrom dotenv import load_dotenv, find_dotenv_ = load_dotenv(find_dotenv()) # read local .env filecurrent_model_id = "gpt-35-turbo-instruct"def get_few_shot_db_chain(user_message):chromadb.api.client.SharedSystemClient.clear_system_cache()llm = AzureOpenAI(deployment_name="gpt-35-turbo-instruct", temperature=0.2)#llm = ChatOpenAI(model = current_model_id)print(llm)engine = create_engine("sqlite:///ecomm.db")db = SQLDatabase(engine=engine, sample_rows_in_table_info=3)embeddings = AzureOpenAIEmbeddings(model="text-embedding-3-small")#embeddings = OpenAIEmbeddings(model="text-embedding-3-small")print(embeddings)to_vectorize = [" ".join(example.values()) for example in few_shots]43 unmodified linesdef get_graph_details(usermessage:str, df=None):llm = AzureOpenAI(deployment_name=current_model_id, temperature=0.15)#llm = ChatOpenAI(deployment_name=current_model_id, temperature=0.15)template = ChatPromptTemplate.from_messages([("system", "You are a visualisation expert and plotly developer, your task is to come up with best suitable \chart representing user ask for the given data. please use plotly express library in python for \
langchain_helper.py+8-6