Skip to content
Snippets Groups Projects
Unverified Commit 3ec5f5d6 authored by Lenoir jérémie's avatar Lenoir jérémie Committed by GitHub
Browse files

fix OpenAIAgent function not called in stream mode after a tools_call type response (#11713)

parent 935c5f65
No related branches found
No related tags found
No related merge requests found
...@@ -115,7 +115,8 @@ class StreamingAgentChatResponse: ...@@ -115,7 +115,8 @@ class StreamingAgentChatResponse:
final_text = "" final_text = ""
for chat in self.chat_stream: for chat in self.chat_stream:
self._is_function = is_function(chat.message) self._is_function = is_function(chat.message)
self.put_in_queue(chat.delta) if chat.delta:
self.put_in_queue(chat.delta)
final_text += chat.delta or "" final_text += chat.delta or ""
if self._is_function is not None: # if loop has gone through iteration if self._is_function is not None: # if loop has gone through iteration
# NOTE: this is to handle the special case where we consume some of the # NOTE: this is to handle the special case where we consume some of the
...@@ -153,7 +154,8 @@ class StreamingAgentChatResponse: ...@@ -153,7 +154,8 @@ class StreamingAgentChatResponse:
final_text = "" final_text = ""
async for chat in self.achat_stream: async for chat in self.achat_stream:
self._is_function = is_function(chat.message) self._is_function = is_function(chat.message)
self.aput_in_queue(chat.delta) if chat.delta:
self.aput_in_queue(chat.delta)
final_text += chat.delta or "" final_text += chat.delta or ""
self._new_item_event.set() self._new_item_event.set()
if self._is_function is False: if self._is_function is False:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment