gptscript-ai / gptscript

Build AI assistants that interact with your systems
https://gptscript.ai
Apache License 2.0
2.89k stars 256 forks source link

"500 Internal Server Error" seen when executing Digital Ocean agent using Anthropic providers. #577

Closed sangee2004 closed 1 month ago

sangee2004 commented 2 months ago

gptscript version - v0.0.0-dev-51fd2b32-dirty

Steps to reproduce the problem:

  1. Execute digital-ocean-agent with anthropic provider - gptscript --default-model 'claude-3-5-sonnet-20240620 from github.com/gptscript-ai/claude3-anthropic-provider' --debug github.com/gptscript-ai/digital-ocean-agent ( Make sure to test without --disable-cache to avoid encountering - https://github.com/gptscript-ai/gptscript/issues/576

  2. Script errors out with - "500 Internal Server Error"

Debug logs:

INFO:     127.0.0.1:64681 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
  + Exception Group Traceback (most recent call last):
  |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_utils.py", line 87, in collapse_excgroups
  |     yield
  |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 190, in __call__
  |     async with anyio.create_task_group() as task_group:
  |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 680, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi
    |     result = await app(  # type: ignore[func-returns-value]
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    |     return await self.app(scope, receive, send)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    |     await super().__call__(scope, receive, send)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
    |     raise exc
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
    |     await self.app(scope, receive, _send)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 189, in __call__
    |     with collapse_excgroups():
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/python/dcd8add47e0ca7045ea6b2bb0fd4a9770c4c19f3e5c8a31a2f3b9ccc6031d1d4/python/lib/python3.12/contextlib.py", line 158, in __exit__
    |     self.gen.throw(value)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/c7fd58436aba0b1ae67e2aefd34b57dea7394eca/tool.gpt/python3.12/main.py", line 23, in log_body
    |     return await call_next(request)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    |     raise exc
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 756, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 776, in app
    |     await route.handle(scope, receive, send)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 297, in handle
    |     await self.app(scope, receive, send)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 77, in app
    |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    |     raise exc
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 72, in app
    |     response = await func(request)
    |                ^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
    |     raw_response = await run_endpoint_function(
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    |     return await dependant.call(**values)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/c7fd58436aba0b1ae67e2aefd34b57dea7394eca/tool.gpt/python3.12/main.py", line 45, in completions
    |     return await claude3_provider_common.completions(client, input)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 205, in completions
    |     req = map_req(input)
    |           ^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 41, in map_req
    |     system += construct_tool_use_system_prompt(req["tools"])
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 261, in construct_tool_use_system_prompt
    |     [construct_format_tool_for_claude_prompt(tool["function"]["name"], tool["function"].get("description", ""),
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 311, in construct_format_tool_for_claude_prompt
    |     f"{construct_format_parameters_prompt(parameters)}\n"
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 296, in construct_format_parameters_prompt
    |     constructed_prompt = "\n".join(
    |                          ^^^^^^^^^^
    |   File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 297, in <genexpr>
    |     f"<parameter>\n<name>{key}</name>\n<type>{value['type']}</type>\n<description>{value.get('description', '')}</description>\n</parameter>"
    |                                               ~~~~~^^^^^^^^
    | KeyError: 'type'
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/python/dcd8add47e0ca7045ea6b2bb0fd4a9770c4c19f3e5c8a31a2f3b9ccc6031d1d4/python/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/c7fd58436aba0b1ae67e2aefd34b57dea7394eca/tool.gpt/python3.12/main.py", line 23, in log_body
    return await call_next(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 165, in call_next
    raise app_exc
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/c7fd58436aba0b1ae67e2aefd34b57dea7394eca/tool.gpt/python3.12/main.py", line 45, in completions
    return await claude3_provider_common.completions(client, input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 205, in completions
    req = map_req(input)
          ^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 41, in map_req
    system += construct_tool_use_system_prompt(req["tools"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 261, in construct_tool_use_system_prompt
    [construct_format_tool_for_claude_prompt(tool["function"]["name"], tool["function"].get("description", ""),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 311, in construct_format_tool_for_claude_prompt
    f"{construct_format_parameters_prompt(parameters)}\n"
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 296, in construct_format_parameters_prompt
    constructed_prompt = "\n".join(
                         ^^^^^^^^^^
  File "/Users/sangeethahariharan/Library/Caches/gptscript/repos/runtimes/venv/2a295d68ebe9f26b64ce1cf24d8294b527f612f39a5a9a546037c032e4587bd4/lib/python3.12/site-packages/claude3_provider_common/main.py", line 297, in <genexpr>
    f"<parameter>\n<name>{key}</name>\n<type>{value['type']}</type>\n<description>{value.get('description', '')}</description>\n</parameter>"
                                              ~~~~~^^^^^^^^
KeyError: 'type'
{
  "err": "error, status code: 500, message: Internal Server Error",
  "level": "debug",
  "logger": "/pkg/monitor",
  "msg": "Run stopped",
  "output": "",
  "runID": "1719520480",
  "time": "2024-06-27T13:34:45-07:00",
  "type": "runFinish"
}
{
  "level": "debug",
  "logger": "/pkg/cli",
  "msg": "failed running daemon: signal: killed",
  "time": "2024-06-27T13:34:45-07:00"
}
{
  "level": "debug",
  "logger": "/pkg/engine",
  "msg": "daemon exited tool [Anthropic Claude3 Model Provider] [/usr/local/bin/gptscript sys.daemon /usr/bin/env python3 /Users/sangeethahariharan/Library/Caches/gptscript/repos/c7fd58436aba0b1ae67e2aefd34b57dea7394eca/tool.gpt/python3.12/main.py]: context canceled",
  "time": "2024-06-27T13:34:45-07:00"
}
2024/06/27 13:34:45 error, status code: 500, message: Internal Server Error
drpebcak commented 2 months ago

Looks like there is a tool in the list that does not define a 'type' field for one of its properties. GPTScript typically sets 'string' as the type for all of its tools, so this wouldn't have been an issue before. Anthropic requires this field. We can force it to 'string' in the provider, but obviously the effectiveness of that may vary.

drpebcak commented 2 months ago

This is ready to test again.

sangee2004 commented 1 month ago

This issue is not seen anymore.

Able to work with Digital Ocean agent using Anthropic providers - gptscript --default-model 'claude-3-5-sonnet-20240620 from github.com/gptscript-ai/claude3-anthropic-provider' --debug github.com/gptscript-ai/digital-ocean-agent