Replies: 1 comment
-
the output schema is not similar with openai api response json structure. maybe thats causing error |
Beta Was this translation helpful? Give feedback.
-
the output schema is not similar with openai api response json structure. maybe thats causing error |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there.
Due to several infrastructure requirements we are unable to use streaming in our implementation. We need to write a converter from Open AI messages to the Streaming Protocol.
However our implementation is having some issues. When we do tool calling, it generates several messsages that we need to stream back to the UI. Although we can view in the backend several OpenAI messages generated, the message object in the front end only retains and show the last one. When we reload (since we are using other api to fetch the messages) they are all there.
We adapted the steam_core_messages from the examples to support multiple messages. Here is our code:
For the following messages:
[{'content': '', 'role': 'assistant', 'tool_calls': [{'function': {'arguments': '{"input": {"plan": {"audience": ' '"IPA Drinkers", "research_goal": ' '"Food Interests"}, "subplan": ' '{"type": "standard", "maxStudy": ' '1}}}', 'name': 'create_plan'}, 'id': 'call_gdDSs1PfHvojyw6QAmiioXgs', 'type': 'function'}, {'function': {'arguments': '{"input": {"plan": {"audience": ' '"IPA Drinkers", "research_goal": ' '"Food Interests"}, "subplan": ' '{"type": "standard", "maxStudy": ' '1}}}', 'name': 'create_plan'}, 'id': 'call_JEXnAs5QnNIFNMTx04Ei9Hlf', 'type': 'function'}]}, {'content': '"Created the following:\n' '* Plan named `Plan 66` with reference ' 'plan://ec40538e-5bd7-4649-b50d-3aad1dd3c142\n' '* Subplan with reference ' 'subplan://8c6b98a7-9b75-45ee-b239-48f712a78d61', 'name': 'create_plan', 'role': 'tool', 'tool_call_id': 'call_gdDSs1PfHvojyw6QAmiioXgs'}, {'content': '"Created the following:\n' '* Plan named `Plan 67` with reference ' 'plan://9826d0f9-231a-4f4d-81f9-a35f2fdcaf16\n' '* Subplan with reference ' 'subplan://375b46cd-a653-4327-8ac5-320b5c8b00ca', 'name': 'create_plan', 'role': 'tool', 'tool_call_id': 'call_JEXnAs5QnNIFNMTx04Ei9Hlf'}, {'content': 'I have created two standard research studies targeting the food ' 'interests of IPA Drinkers:\n' '\n' '1. **Plan 66** with a subplan reference: ' '[subplan://8c6b98a7-9b75-45ee-b239-48f712a78d61](#).\n' '2. **Plan 67** with a subplan reference: ' '[subplan://375b46cd-a653-4327-8ac5-320b5c8b00ca](#).\n' '\n' 'These studies will help you gather insights into the food ' 'preferences within this specific audience.', 'role': 'assistant'}]Its generating the following event stream:
We can't figure out what could be causing this.
Beta Was this translation helpful? Give feedback.
All reactions