forked from React-Group/interstellar_ai
Thanks Google for not using standards.
This commit is contained in:
parent
65ddc69be7
commit
778bfd632e
1 changed files with 8 additions and 5 deletions
13
py/ai.py
13
py/ai.py
|
@ -93,11 +93,14 @@ class AI:
|
|||
msg['role'] = 'model'
|
||||
|
||||
genai.configure(api_key=api_key)
|
||||
model = genai.GenerativeModel("gemini-1.5-flash")
|
||||
|
||||
model = genai.GenerativeModel(model)
|
||||
|
||||
chat = model.start_chat(
|
||||
system_instruction=system,
|
||||
history=[
|
||||
{"role": "user", "parts": "Hello"},
|
||||
{"role": "model", "parts": "Great to meet you. What would you like to know?"},
|
||||
]
|
||||
history=messages
|
||||
)
|
||||
|
||||
response = chat.send_message(message, stream=True)
|
||||
for chunk in response:
|
||||
return_class.ai_response[access_token] += chunk.text
|
||||
|
|
Loading…
Reference in a new issue