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

Duplicate call_ids Submitted When Calling Tool Multiple Times Causes openai.BadRequestError #151

Closed
bonk1t opened this issue Jun 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bonk1t
Copy link
Contributor

bonk1t commented Jun 23, 2024

This issue occurs when the agent is asked to call a tool multiple times in parallel. No similar issues were found on the Internet.

Traceback:

Exception in thread Thread-11 (get_completion_stream):
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/nick/PycharmProjects/.../venv/lib/python3.11/site-packages/agency_swarm/agency/agency.py", line 196, in get_completion_stream
    next(res)
  File "/Users/nick/PycharmProjects/.../venv/lib/python3.11/site-packages/agency_swarm/threads/thread.py", line 190, in get_completion
    self._submit_tool_outputs(tool_outputs, event_handler)
  File "/Users/nick/PycharmProjects/.../venv/lib/python3.11/site-packages/agency_swarm/threads/thread.py", line 304, in _submit_tool_outputs
    with self.client.beta.threads.runs.submit_tool_outputs_stream(
  File "/Users/nick/PycharmProjects/.../venv/lib/python3.11/site-packages/openai/lib/streaming/_assistants.py", line 444, in __enter__
    self.__stream = self.__api_request()
                    ^^^^^^^^^^^^^^^^^^^^
  File "/Users/nick/PycharmProjects/.../venv/lib/python3.11/site-packages/openai/_base_client.py", line 1240, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nick/PycharmProjects/.../venv/lib/python3.11/site-packages/openai/_base_client.py", line 921, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "/Users/nick/PycharmProjects/.../venv/lib/python3.11/site-packages/openai/_base_client.py", line 1020, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "Duplicate call_ids submitted: ['call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN', 'call_jByezqWjNlzHp9wEs4WGKChN']", 'type': 'invalid_request_error', 'param': None, 'code': None}}
@bonk1t bonk1t changed the title Duplicate call_ids submitted: openai.BadRequestError Duplicate call_ids Submitted When Calling Tool Multiple Times Causes openai.BadRequestError Jun 23, 2024
@VRSEN VRSEN added the bug Something isn't working label Jun 27, 2024
@VRSEN
Copy link
Owner

VRSEN commented Jun 28, 2024

Rare bug when agent calls the same tool multiple times and the request times out, should be fixed now. Thanks

@bonk1t bonk1t closed this as completed Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants