fix: Add type safety to embedding configurator

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-02-05 10:44:59 +00:00
parent 1c7c4cb828
commit 85a13751ba

View File

@@ -38,12 +38,12 @@ class EmbeddingConfigurator:
except Exception as e:
raise ValueError(f"Invalid custom embedding function: {str(e)}")
if provider not in self.embedding_functions:
if not provider or provider not in self.embedding_functions:
raise Exception(
f"Unsupported embedding provider: {provider}, supported providers: {list(self.embedding_functions.keys())}"
)
return self.embedding_functions[provider](config, model_name)
return self.embedding_functions[str(provider)](config, model_name)
@staticmethod
def _create_default_embedding_function():