Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix http session closed error #430

Merged
merged 1 commit into from
Nov 24, 2024

Conversation

yaodongen
Copy link
Contributor

[agora_yde] 2024-11-21 16:21:21,493 - openai_v2v_python - INFO - 27637 - [extension.py:380] - append item {'id': 'item_AW4DgJBUU90q5QBQaQMeQ', 'object': 'realtime.item', 'type': 'function_call', 'status': 'completed', 'name': 'bing_search', 'call_id': 'call_bvB5RUNoyydCup88', 'arguments': '{"query":"2024 美国总统选举结果"}'}
[agora_yde] 2024-11-21 16:21:21,493 - openai_v2v_python - INFO - 27637 - [extension.py:384] - remove history item_AW4COffmXDIvNH6XmI7Hz
[agora_yde] 11-21 16:21:21.510 27637(27792) W on_cmd@llm_tool.py:58 [bingsearch_tool_python] on_cmd failed: Traceback (most recent call last):
[agora_yde]   File "/app/agents/ten_packages/system/ten_ai_base/interface/ten_ai_base/llm_tool.py", line 46, in on_cmd
[agora_yde]     result = await asyncio.create_task(self.run_tool(ten_env, tool_name, tool_args))
[agora_yde]   File "/app/agents/ten_packages/extension/bingsearch_tool_python/extension.py", line 129, in run_tool
[agora_yde]     result = await self._do_search(args)
[agora_yde]   File "/app/agents/ten_packages/extension/bingsearch_tool_python/extension.py", line 141, in _do_search
[agora_yde]     results = await self._bing_search_results(query, count=self.k)
[agora_yde]   File "/app/agents/ten_packages/extension/bingsearch_tool_python/extension.py", line 160, in _bing_search_results
[agora_yde]     async with session.get(DEFAULT_BING_SEARCH_ENDPOINT, headers=headers, params=params) as response:
[agora_yde]   File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 1355, in __aenter__
[agora_yde]     self._resp: _RetType = await self._coro
[agora_yde]   File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 492, in _request
[agora_yde]     raise RuntimeError("Session is closed")
[agora_yde] RuntimeError: Session is closed

In local debugging, a problem was found that the session of bingsearch_tool_python expires during long conversations, so a check needs to be added to recreate it.

@cyfyifanchen
Copy link
Collaborator

@yaodongen thanks for the PR.

@plutoless plutoless merged commit 790cd08 into TEN-framework:main Nov 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants