From 5fd64d7f51a30495db47468bdd3dbd90fb919707 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 9 Feb 2025 23:14:50 +0000 Subject: [PATCH] docs: add Ollama embedder URL configuration documentation Co-Authored-By: Joe Moura --- docs/concepts/knowledge.mdx | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/concepts/knowledge.mdx b/docs/concepts/knowledge.mdx index 78443ecab..76504cf40 100644 --- a/docs/concepts/knowledge.mdx +++ b/docs/concepts/knowledge.mdx @@ -285,8 +285,37 @@ The `embedder` parameter supports various embedding model providers that include - `openai`: OpenAI's embedding models - `google`: Google's text embedding models - `azure`: Azure OpenAI embeddings -- `ollama`: Local embeddings with Ollama +- `ollama`: Local embeddings with Ollama (supports flexible URL configuration) - `vertexai`: Google Cloud VertexAI embeddings + +Here's an example of configuring the Ollama embedder with custom URL settings: +```python +# Configure Ollama embedder with custom URL +agent = Agent( + role="Data Analyst", + goal="Analyze data efficiently", + embedder={ + "provider": "ollama", + "config": { + "model": "llama2", + # URL configuration supports multiple keys in priority order: + # 1. url: Legacy key (highest priority) + # 2. api_url: Alternative key following HuggingFace pattern + # 3. base_url: Alternative key + # 4. api_base: Alternative key following Azure pattern + "url": "http://ollama:11434/api/embeddings" # Example for Docker setup + } + } +) +``` + +The Ollama embedder supports multiple URL configuration keys for flexibility: +- `url`: Legacy key (highest priority) +- `api_url`: Alternative key following HuggingFace pattern +- `base_url`: Alternative key +- `api_base`: Alternative key following Azure pattern + +If no URL is specified, it defaults to `http://localhost:11434/api/embeddings`. - `cohere`: Cohere's embedding models - `voyageai`: VoyageAI's embedding models - `bedrock`: AWS Bedrock embeddings