Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ repos:
hooks:
- id: ruff
name: ruff
entry: bash -c 'source .venv/bin/activate && uv run ruff check --config pyproject.toml "$@"' --
entry: uv run ruff check --config pyproject.toml
language: system
pass_filenames: true
types: [python]
- id: ruff-format
name: ruff-format
entry: bash -c 'source .venv/bin/activate && uv run ruff format --config pyproject.toml "$@"' --
entry: uv run ruff format --config pyproject.toml
language: system
pass_filenames: true
types: [python]
- id: mypy
name: mypy
entry: bash -c 'source .venv/bin/activate && uv run mypy --config-file pyproject.toml "$@"' --
entry: uv run mypy --config-file pyproject.toml
language: system
pass_filenames: true
types: [python]
Expand Down
13 changes: 8 additions & 5 deletions lib/crewai/src/crewai/crew.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,12 @@ def check_config_type(
"""

# TODO: Improve typing
return json.loads(v) if isinstance(v, Json) else v # type: ignore
if isinstance(v, str):
try:
return json.loads(v)
except json.JSONDecodeError:
return v
return v

@model_validator(mode="after")
def set_private_attrs(self) -> Crew:
Expand Down Expand Up @@ -362,7 +367,7 @@ def create_crew_memory(self) -> Crew:
if self.embedder is not None:
from crewai.rag.embeddings.factory import build_embedder

embedder = build_embedder(self.embedder)
embedder = build_embedder(cast(Any, self.embedder))
self._memory = Memory(embedder=embedder)
elif self.memory:
# User passed a Memory / MemoryScope / MemorySlice instance
Expand Down Expand Up @@ -1410,9 +1415,7 @@ def _add_code_execution_tools(
return self._merge_tools(tools, cast(list[BaseTool], code_tools))
return tools

def _add_memory_tools(
self, tools: list[BaseTool], memory: Any
) -> list[BaseTool]:
def _add_memory_tools(self, tools: list[BaseTool], memory: Any) -> list[BaseTool]:
"""Add recall and remember tools when memory is available.

Args:
Expand Down