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'
|
msg['role'] = 'model'
|
||||||
|
|
||||||
genai.configure(api_key=api_key)
|
genai.configure(api_key=api_key)
|
||||||
model = genai.GenerativeModel("gemini-1.5-flash")
|
|
||||||
|
model = genai.GenerativeModel(model)
|
||||||
|
|
||||||
chat = model.start_chat(
|
chat = model.start_chat(
|
||||||
system_instruction=system,
|
system_instruction=system,
|
||||||
history=[
|
history=messages
|
||||||
{"role": "user", "parts": "Hello"},
|
|
||||||
{"role": "model", "parts": "Great to meet you. What would you like to know?"},
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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