InvalidRequestError at end of L2

While working through L2, I ran into and fixed the tools and max_token parameter errors already described in some other posts.

After those are fixed I’m running into another error at the end of L2 (although it also occurs in L3 and L4). After I type “look around” I get an error in the gradio ui along with the following error log. I thought it might be because of some changes to the Together API but after searching through their documentation I cannot find the issue.

Can anyone help me resolve this error? Thanks!

Screenshot:

Error log:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/gradio/queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio/route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio/blocks.py", line 1935, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio/blocks.py", line 1518, in call_function
    prediction = await fn(*processed_input)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio/utils.py", line 793, in async_wrapper
    response = await f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gradio/chat_interface.py", line 623, in _submit_fn
    response = await anyio.to_thread.run_sync(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ipykernel_19/1131656361.py", line 10, in main_loop
    return run_action(message, history, game_state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/ipykernel_19/3668749400.py", line 28, in run_action
    model_output = client.chat.completions.create(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/together/resources/chat/completions.py", line 136, in create
    response, _, _ = requestor.request(
                     ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/together/abstract/api_requestor.py", line 249, in request
    resp, got_stream = self._interpret_response(result, stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/together/abstract/api_requestor.py", line 620, in _interpret_response
    self._interpret_response_line(
  File "/usr/local/lib/python3.11/site-packages/together/abstract/api_requestor.py", line 689, in _interpret_response_line
    raise self.handle_error_response(resp, rcode, stream_error=stream)
together.error.InvalidRequestError: Error code: 400 - {"message": "\"prompt: Required\" OR \"messages, 2, tool_calls: Expected array, received null\" OR , \"messages, 2, tool_call_id: Required\" OR , \"messages, 2, name: Required\", \"tools: Expected array, received null\", \"tool_choice: Expected object, received null\"", "type_": "invalid_request_error", "param": null, "code": null}

Note the discussion here:

1 Like

Thank you for reporting! I’m checking again and it might be something about the keys and wrappers. I’m sharing this now with the engineering team!

commented and solve in this thread Another bug - APIError: Error code: 422 "Tokens must be <= 8193" :slight_smile: