cookiemonster69 commited on
Commit
f173ca0
1 Parent(s): 826f65f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import streamlit as st
2
- #from langchain.llms import OpenAI #this import has been replaced by the below recently please :)
3
  from langchain_openai import OpenAI
4
 
5
  from langchain.prompts import PromptTemplate
@@ -10,7 +10,7 @@ from dotenv import load_dotenv
10
  load_dotenv()
11
 
12
  def getLLMResponse(query,age_option,tasktype_option):
13
- # 'text-davinci-003' model is depreciated now, so we are using the openai's recommended model
14
  llm = OpenAI(temperature=.9, model="gpt-3.5-turbo-instruct")
15
 
16
  if age_option=="Kid": #Silly and Sweet Kid
@@ -120,7 +120,7 @@ def getLLMResponse(query,age_option,tasktype_option):
120
 
121
 
122
  new_prompt_template = FewShotPromptTemplate(
123
- example_selector=example_selector, # use example_selector instead of examples
124
  example_prompt=example_prompt,
125
  prefix=prefix,
126
  suffix=suffix,
@@ -131,13 +131,12 @@ def getLLMResponse(query,age_option,tasktype_option):
131
 
132
  print(new_prompt_template.format(template_userInput=query,template_ageoption=age_option,template_tasktype_option=tasktype_option))
133
 
134
- #Recently langchain has recommended to use invoke function for the below please :)
135
  response=llm.invoke(new_prompt_template.format(template_userInput=query,template_ageoption=age_option,template_tasktype_option=tasktype_option))
136
  print(response)
137
 
138
  return response
139
 
140
- #UI Starts here
141
 
142
  st.set_page_config(page_title="Marketing Tool",
143
  page_icon='✅',
 
1
  import streamlit as st
2
+
3
  from langchain_openai import OpenAI
4
 
5
  from langchain.prompts import PromptTemplate
 
10
  load_dotenv()
11
 
12
  def getLLMResponse(query,age_option,tasktype_option):
13
+
14
  llm = OpenAI(temperature=.9, model="gpt-3.5-turbo-instruct")
15
 
16
  if age_option=="Kid": #Silly and Sweet Kid
 
120
 
121
 
122
  new_prompt_template = FewShotPromptTemplate(
123
+ example_selector=example_selector,
124
  example_prompt=example_prompt,
125
  prefix=prefix,
126
  suffix=suffix,
 
131
 
132
  print(new_prompt_template.format(template_userInput=query,template_ageoption=age_option,template_tasktype_option=tasktype_option))
133
 
134
+
135
  response=llm.invoke(new_prompt_template.format(template_userInput=query,template_ageoption=age_option,template_tasktype_option=tasktype_option))
136
  print(response)
137
 
138
  return response
139
 
 
140
 
141
  st.set_page_config(page_title="Marketing Tool",
142
  page_icon='✅',