agent-zero icon indicating copy to clipboard operation
agent-zero copied to clipboard

AgentZero keeps crashing with ollama cloud and it isnt a ollama issue.

Open whatcher1013 opened this issue 9 months ago • 4 comments

litellm.exceptions.APIConnectionError: litellm.APIConnectionError: OllamaException - Client error '400 Bad Request' for url

Traceback (most recent call last): Traceback (most recent call last): File "/opt/venv-a0/lib/python3.12/site-packages/litellm/main.py", line 4476, in embedding response = ollama_embeddings_fn( # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 stack lines skipped <<<

File "/a0/python/helpers/memory.py", line 335, in search_similarity_threshold return await self.db.asearch( ^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain_core/vectorstores/base.py", line 380, in asearch docs_and_similarities = await self.asimilarity_search_with_relevance_scores( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain_core/vectorstores/base.py", line 603, in asimilarity_search_with_relevance_scores docs_and_similarities = await self._asimilarity_search_with_relevance_scores( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain_community/vectorstores/faiss.py", line 1327, in _asimilarity_search_with_relevance_scores docs_and_scores = await self.asimilarity_search_with_score( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain_community/vectorstores/faiss.py", line 549, in asimilarity_search_with_score embedding = await self._aembed_query(query) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain_community/vectorstores/faiss.py", line 272, in _aembed_query return await self.embedding_function.aembed_query(text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain/embeddings/cache.py", line 217, in aembed_query return await self.underlying_embeddings.aembed_query(text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain_core/embeddings/embeddings.py", line 78, in aembed_query return await run_in_executor(None, self.embed_query, text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 622, in run_in_executor return await asyncio.get_running_loop().run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/futures.py", line 287, in await yield self # This tells Task to wait for completion. ^^^^^^^^^^ File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/tasks.py", line 385, in __wakeup future.result() File "/opt/pyenv/versions/3.12.4/lib/python3.12/asyncio/futures.py", line 203, in result raise self._exception.with_traceback(self._exception_tb) File "/opt/pyenv/versions/3.12.4/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/langchain_core/runnables/config.py", line 613, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/a0/models.py", line 700, in embed_query resp = embedding(model=self.model_name, input=[text], **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/utils.py", line 1377, in wrapper raise e File "/opt/venv-a0/lib/python3.12/site-packages/litellm/utils.py", line 1246, in wrapper result = original_function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/main.py", line 4847, in embedding raise exception_type( ^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2323, in exception_type raise e File "/opt/venv-a0/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2292, in exception_type raise APIConnectionError( For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400

Progress | Initializing VectorDB Indexing memories Found 2 knowledge files in /a0/knowledge/main, processing... -- | -- Progress

Initializing VectorDB Indexing memories Found 2 knowledge files in /a0/knowledge/main, processing...

whatcher1013 avatar Feb 23 '26 19:02 whatcher1013

same here

programmer-no19 avatar Feb 25 '26 11:02 programmer-no19

looking at my ollama container output it is sending a generate request vs a chat request.

[GIN] 2026/03/01 - 07:17:18 | 404 | 5.01µs | 172.23.0.8 | POST "/v1/api/generate"

tellybrown avatar Mar 01 '26 07:03 tellybrown

ok finally im past the 404. but i have a new error lol.

  1. set the name of the model with its real name. i took the name from other agents that wanted ollama/name
  2. dont set /v1 in the base url. its not needed

tellybrown avatar Mar 01 '26 08:03 tellybrown

Image this is how I use Ollama and works great for me. hope this help But you still need to 'pull' the cloud model to your local machine since ollama.com uses it as the endpoint for rec'ing and sending the inference data. they are 0 byte files, by the way

NAME ID SIZE MODIFIED qwen3-next:80b-cloud f5ccd68d2872 - 21 hours ago qwen3-coder-next:cloud aa626c11ae8d - 23 hours ago gpt-oss:120b-cloud 569662207105 - 46 hours ago gemma3:4b-cloud 89c58fea5420 - 4 days ago gemini-3-flash-preview:latest ebade0d31690 - 4 days ago ministral-3:3b-cloud 6938c17dead4 - 10 days ago ministral-3:14b-cloud 615c59440878 - 11 days ago qwen3.5:cloud a7bf6f7891c3 - 12 days ago gpt-oss:20b-cloud 875e8e3a629a - 2 weeks ago kimi-k2.5:cloud 6d1c3246c608 - 2 weeks ago

rastarr avatar Mar 01 '26 09:03 rastarr