I was integrating with async and so got the below error from vocode:- ERROR:vocode.streaming.utils.worker:InterruptibleWorker
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/vocode/streaming/utils/worker.py", line 218, in _run_loop
await self.current_task
File "/usr/local/lib/python3.10/site-packages/vocode/streaming/agent/base_agent.py", line 303, in process
should_stop = await self.handle_generate_response(
File "/usr/local/lib/python3.10/site-packages/vocode/streaming/agent/base_agent.py", line 216, in handle_generate_response
async for response in responses:
File "/code/agents/chat_gpt_agent.py", line 182, in generate_response
stream = await openai.ChatCompletion.acreate(**chat_parameters)
File "/usr/local/lib/python3.10/site-packages/helicone/openai_async/openai_injector.py", line 230, in wrapper
return self._result_interceptor_async(result,
File "/usr/local/lib/python3.10/site-packages/helicone/openai_async/openai_injector.py", line 117, in _result_interceptor_async
result["helicone_meta"] = helicone_meta
TypeError: 'async_generator' object does not support item assignment
This can be handled I feel with the modification made to the package as shown below:- # Incorrect way that leads to the error result["helicone_meta"] = helicone_meta
Correct way to handle async generator
async for item in result: # Process each item here # You can add 'helicone_meta' to each item if they are dictionary-like objects item["helicone_meta"] = helicone_meta