You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The application fails to initialize the embedding function when using Ollama with the nomic-embed-text model or defaults incorrectly to OpenAI, leading to a ValueError for a missing OpenAI API key. This behavior is unexpected, as the specified provider is Ollama, not OpenAI.
Steps to Reproduce
Follow the tutorial here
try it with Ollama embedding models
from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource
The application should initialize the embedding function using the specified ollama provider with the nomic-embed-text model, or provide a meaningful error related to Ollama if something is misconfigured. It should not attempt to fall back to OpenAI.
Screenshots/Code snippets
from tax_crew.main import run
File "/path/to/project/src/tax_crew/main.py", line 5, in <module>
from tax_crew.crew import TaxCrew
File "/path/to/project/src/tax_crew/crew.py", line 6, in <module>
string_source = StringKnowledgeSource(
^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/venv/lib/python3.11/site-packages/pydantic/main.py", line 214, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/venv/lib/python3.11/site-packages/crewai/knowledge/storage/knowledge_storage.py", line 51, in __init__
self._set_embedder_config(embedder_config)
File "/path/to/venv/lib/python3.11/site-packages/crewai/knowledge/storage/knowledge_storage.py", line 174, in _set_embedder_config
else self._create_default_embedding_function()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/venv/lib/python3.11/site-packages/crewai/knowledge/storage/knowledge_storage.py", line 158, in _create_default_embedding_function
return OpenAIEmbeddingFunction(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/venv/lib/python3.11/site-packages/chromadb/utils/embedding_functions/openai_embedding_function.py", line 56, in __init__
raise ValueError(
ValueError: Please provide an OpenAI API key. You can get one at https://platform.openai.com/account/api-keys
Operating System
macOS Sonoma
Python Version
3.11
crewAI Version
0.86.0
crewAI Tools Version
0.25.8
Virtual Environment
Venv
Evidence
from tax_crew.main import run
File "/path/to/project/src/tax_crew/main.py", line 5, in <module>
from tax_crew.crew import TaxCrew
File "/path/to/project/src/tax_crew/crew.py", line 6, in <module>
string_source = StringKnowledgeSource(
^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/venv/lib/python3.11/site-packages/pydantic/main.py", line 214, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/venv/lib/python3.11/site-packages/crewai/knowledge/storage/knowledge_storage.py", line 51, in __init__
self._set_embedder_config(embedder_config)
File "/path/to/venv/lib/python3.11/site-packages/crewai/knowledge/storage/knowledge_storage.py", line 174, in _set_embedder_config
else self._create_default_embedding_function()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/venv/lib/python3.11/site-packages/crewai/knowledge/storage/knowledge_storage.py", line 158, in _create_default_embedding_function
return OpenAIEmbeddingFunction(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/path/to/venv/lib/python3.11/site-packages/chromadb/utils/embedding_functions/openai_embedding_function.py", line 56, in __init__
raise ValueError(
ValueError: Please provide an OpenAI API key. You can get one at https://platform.openai.com/account/api-keys
Possible Solution
• Ensure that the application respects the specified provider (ollama) and does not fall back to OpenAI unless explicitly configured.
• Validate the configuration early and provide meaningful error messages for unsupported providers or missing configurations.
Additional context
It can be happening with other providers that are not ollama
The text was updated successfully, but these errors were encountered:
Description
The application fails to initialize the embedding function when using Ollama with the nomic-embed-text model or defaults incorrectly to OpenAI, leading to a ValueError for a missing OpenAI API key. This behavior is unexpected, as the specified provider is Ollama, not OpenAI.
Steps to Reproduce
from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource
Expected behavior
The application should initialize the embedding function using the specified ollama provider with the nomic-embed-text model, or provide a meaningful error related to Ollama if something is misconfigured. It should not attempt to fall back to OpenAI.
Screenshots/Code snippets
Operating System
macOS Sonoma
Python Version
3.11
crewAI Version
0.86.0
crewAI Tools Version
0.25.8
Virtual Environment
Venv
Evidence
Possible Solution
• Ensure that the application respects the specified provider (ollama) and does not fall back to OpenAI unless explicitly configured.
• Validate the configuration early and provide meaningful error messages for unsupported providers or missing configurations.
Additional context
It can be happening with other providers that are not
ollama
The text was updated successfully, but these errors were encountered: