ryanrwatkins commited on
Commit
91c0706
1 Parent(s): 927ee1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -35,7 +35,7 @@ from langchain_google_genai import ChatGoogleGenerativeAI
35
  openai.api_key = os.environ['openai_key']
36
  os.environ["OPENAI_API_KEY"] = os.environ['openai_key']
37
 
38
- gemini.api_key = os.environ['gemini_key']
39
  os.environ["GEMINI_API_KEY"] = os.environ['gemini_key']
40
 
41
 
@@ -129,14 +129,14 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
129
 
130
  docs = new_docsearch.similarity_search(query)
131
 
132
- gen_ai = GenerativeAI.get_client(model="gemini-1.0-pro")
133
- response = gen_ai.start_chat(
134
  messages=query, # Pass both history and current prompt
135
  max_tokens=max_tokens,
136
  temperature=temperature # Adjust temperature as needed
137
  )
138
 
139
- completion = response.messages[-1] # Extract the completion message
140
 
141
 
142
  get_empty_state()
 
35
  openai.api_key = os.environ['openai_key']
36
  os.environ["OPENAI_API_KEY"] = os.environ['openai_key']
37
 
38
+
39
  os.environ["GEMINI_API_KEY"] = os.environ['gemini_key']
40
 
41
 
 
129
 
130
  docs = new_docsearch.similarity_search(query)
131
 
132
+ gen_ai = ChatGoogleGenerativeAI(model="gemini-pro")
133
+ response = gen_ai.invoke(
134
  messages=query, # Pass both history and current prompt
135
  max_tokens=max_tokens,
136
  temperature=temperature # Adjust temperature as needed
137
  )
138
 
139
+ completion = response.content # Extract the completion message
140
 
141
 
142
  get_empty_state()