mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
fix: resolve lint and type-checker issues
- Fix RET504 lint error by removing unnecessary assignment before return - Add proper type annotations for embedding_functions dictionary - Import Callable and Any from typing to resolve mypy errors Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Minimal embedding function factory for CrewAI."""
|
||||
|
||||
import os
|
||||
from typing import Any, Callable
|
||||
|
||||
from chromadb import EmbeddingFunction
|
||||
from chromadb.utils.embedding_functions.amazon_bedrock_embedding_function import (
|
||||
@@ -83,8 +84,7 @@ def _create_watson_embedding_function(**config_dict) -> EmbeddingFunction:
|
||||
)
|
||||
|
||||
try:
|
||||
embeddings = embedding.embed_documents(input)
|
||||
return embeddings
|
||||
return embedding.embed_documents(input)
|
||||
except Exception as e:
|
||||
raise RuntimeError(f"Error during Watson embedding: {e}") from e
|
||||
|
||||
@@ -177,7 +177,7 @@ def get_embedding_function(
|
||||
|
||||
provider = config_dict.pop("provider", "openai")
|
||||
|
||||
embedding_functions = {
|
||||
embedding_functions: dict[str, Callable[..., EmbeddingFunction]] = {
|
||||
"openai": OpenAIEmbeddingFunction,
|
||||
"cohere": CohereEmbeddingFunction,
|
||||
"ollama": OllamaEmbeddingFunction,
|
||||
|
||||
Reference in New Issue
Block a user