Skip to content

Commit 4489baa

Browse files
devin-ai-integration[bot]João
andcommitted
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>
1 parent 1442f3e commit 4489baa

File tree

2 files changed

+3327
-3485
lines changed

2 files changed

+3327
-3485
lines changed

src/crewai/rag/embeddings/factory.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Minimal embedding function factory for CrewAI."""
22

33
import os
4+
from typing import Any, Callable
45

56
from chromadb import EmbeddingFunction
67
from chromadb.utils.embedding_functions.amazon_bedrock_embedding_function import (
@@ -76,15 +77,14 @@ def __call__(self, input):
7677
model_id=self.config.get("model_name") or self.config.get("model"),
7778
params=embed_params,
7879
credentials=Credentials(
79-
api_key=self.config.get("api_key"),
80+
api_key=self.config.get("api_key"),
8081
url=self.config.get("api_url") or self.config.get("url")
8182
),
8283
project_id=self.config.get("project_id"),
8384
)
8485

8586
try:
86-
embeddings = embedding.embed_documents(input)
87-
return embeddings
87+
return embedding.embed_documents(input)
8888
except Exception as e:
8989
raise RuntimeError(f"Error during Watson embedding: {e}") from e
9090

@@ -177,7 +177,7 @@ def get_embedding_function(
177177

178178
provider = config_dict.pop("provider", "openai")
179179

180-
embedding_functions = {
180+
embedding_functions: dict[str, Callable[..., EmbeddingFunction]] = {
181181
"openai": OpenAIEmbeddingFunction,
182182
"cohere": CohereEmbeddingFunction,
183183
"ollama": OllamaEmbeddingFunction,

0 commit comments

Comments
 (0)