Skyvern-AI / skyvern

Automate browser-based workflows with LLMs and Computer Vision
https://www.skyvern.com
GNU Affero General Public License v3.0
10.05k stars 677 forks source link

Using Anthropic - Max retries exceeded #276

Closed QuentinSc closed 6 months ago

QuentinSc commented 6 months ago

Hello,

Thank you for this awesome app. I have an Anthropic API key with credits. I set up the docker-compose.yml with

On the UI I've got

ConnectionError: HTTPConnectionPool(host='skyvern', port=8000): Max retries exceeded with url: /api/v1/internal/tasks?page=1&page_size=15 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa29bd9a910>: Failed to establish a new connection: [Errno 111] Connection refused'))

File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 584, in _run_script
    exec(code, module.__dict__)
File "/app/streamlit_app/visualizer/streamlit.py", line 258, in <module>
    tasks_response = repository.get_tasks(task_page_number)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/streamlit_app/visualizer/repository.py", line 15, in get_tasks
    return self.client.get_agent_tasks(page=page, page_size=page_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/streamlit_app/visualizer/api.py", line 59, in get_agent_tasks
    response = requests.get(url, params=params, headers=headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)

LOGS When booting the skyvern container :

         host=0.0.0.0 port=8000
2024-05-08 10:23:39 [INFO] Will watch for changes in these directories: ['/app']
2024-05-08 10:23:39 [INFO] Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2024-05-08 10:23:39 [INFO] Started reloader process [21] using WatchFiles
2024-05-08 10:23:43 [INFO] Registering LLM config
         llm_key=ANTHROPIC_CLAUDE3
2024-05-08 10:23:43 Process SpawnProcess-1:
2024-05-08 10:23:43 Traceback (most recent call last):
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
2024-05-08 10:23:43     self.run()
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
2024-05-08 10:23:43     self._target(*self._args, **self._kwargs)
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
2024-05-08 10:23:43     target(sockets=sockets)
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 61, in run
2024-05-08 10:23:43     return asyncio.run(self.serve(sockets=sockets))
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
2024-05-08 10:23:43     return runner.run(main)
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
2024-05-08 10:23:43     return self._loop.run_until_complete(task)
2024-05-08 10:23:43   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 68, in serve
2024-05-08 10:23:43     config.load()
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 467, in load
2024-05-08 10:23:43     self.loaded_app = import_from_string(self.app)
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 21, in import_from_string
2024-05-08 10:23:43     module = importlib.import_module(module_str)
2024-05-08 10:23:43   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
2024-05-08 10:23:43     return _bootstrap._gcd_import(name[level:], package, level)
2024-05-08 10:23:43   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
2024-05-08 10:23:43   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
2024-05-08 10:23:43   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
2024-05-08 10:23:43   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
2024-05-08 10:23:43   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
2024-05-08 10:23:43   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2024-05-08 10:23:43   File "/app/skyvern/forge/app.py", line 37, in <module>
2024-05-08 10:23:43     LLM_API_HANDLER = LLMAPIHandlerFactory.get_llm_api_handler(SettingsManager.get_settings().LLM_KEY)
2024-05-08 10:23:43   File "/app/skyvern/forge/sdk/api/llm/api_handler_factory.py", line 130, in get_llm_api_handler
2024-05-08 10:23:43     llm_config = LLMConfigRegistry.get_config(llm_key)
2024-05-08 10:23:43   File "/app/skyvern/forge/sdk/api/llm/config_registry.py", line 41, in get_config
2024-05-08 10:23:43     raise InvalidLLMConfigError(llm_key)
2024-05-08 10:23:43 skyvern.forge.sdk.api.llm.exceptions.InvalidLLMConfigError: LLM config with key OPENAI_GPT4V is not a valid LLMConfig
suchintan commented 6 months ago

I think you need to update your .env file. It's currently set to ENABLE_ANTHROPIC=true, but LLM_KEY still points to OpenAI

Update LLM_KEY=ANTHROPIC_CLAUDE3_SONNET

QuentinSc commented 6 months ago

Thank you, didn't see this conf. Need to udpate to LLM_KEY=ANTHROPIC_CLAUDE3 (sonnet is not recognized)

suchintan commented 6 months ago

Perfect. The latest version of Skyvern requires the SONNET piece (although your current config is backwards compatible)