Commit
·
5d748e2
1
Parent(s):
263bcfe
Added support for streaming
Browse files- mainV2.py +1 -1
- src/manager.py +6 -2
mainV2.py
CHANGED
@@ -55,4 +55,4 @@ if __name__ == "__main__":
|
|
55 |
outputs=chatbot
|
56 |
)
|
57 |
|
58 |
-
demo.launch()
|
|
|
55 |
outputs=chatbot
|
56 |
)
|
57 |
|
58 |
+
demo.launch(share=True)
|
src/manager.py
CHANGED
@@ -129,6 +129,7 @@ class GeminiManager:
|
|
129 |
"role": "assistant",
|
130 |
"content": response.text
|
131 |
})
|
|
|
132 |
|
133 |
# Attach the function call response to the messages
|
134 |
if response.candidates[0].content and response.candidates[0].content.parts:
|
@@ -137,11 +138,14 @@ class GeminiManager:
|
|
137 |
"role":"function_call",
|
138 |
"content": repr(response.candidates[0].content),
|
139 |
})
|
140 |
-
|
141 |
|
142 |
# Invoke the function calls if any and attach the response to the messages
|
143 |
if response.function_calls:
|
144 |
calls = self.handle_tool_calls(response)
|
145 |
messages.append(calls)
|
146 |
-
|
|
|
|
|
|
|
147 |
return messages
|
|
|
129 |
"role": "assistant",
|
130 |
"content": response.text
|
131 |
})
|
132 |
+
yield messages
|
133 |
|
134 |
# Attach the function call response to the messages
|
135 |
if response.candidates[0].content and response.candidates[0].content.parts:
|
|
|
138 |
"role":"function_call",
|
139 |
"content": repr(response.candidates[0].content),
|
140 |
})
|
141 |
+
yield messages
|
142 |
|
143 |
# Invoke the function calls if any and attach the response to the messages
|
144 |
if response.function_calls:
|
145 |
calls = self.handle_tool_calls(response)
|
146 |
messages.append(calls)
|
147 |
+
yield messages
|
148 |
+
for value in self.run(message, messages):
|
149 |
+
yield value
|
150 |
+
return
|
151 |
return messages
|