Compare commits

...

2 Commits

Author SHA1 Message Date
Eduardo Chiarotti
dc4291996e Merge branch 'main' into fix/pre-commit-all-files 2024-08-23 10:50:51 -03:00
Eduardo Chiarotti
d1aee5450f fix: All files pre commit 2024-08-23 10:49:58 -03:00
11 changed files with 29 additions and 7 deletions

View File

@@ -2,3 +2,5 @@ from .cache.cache_handler import CacheHandler
from .executor import CrewAgentExecutor
from .parser import CrewAgentParser
from .tools_handler import ToolsHandler
__all__ = ["CacheHandler", "CrewAgentExecutor", "CrewAgentParser", "ToolsHandler"]

View File

@@ -1 +1,3 @@
from .cache_handler import CacheHandler
__all__ = ["CacheHandler"]

View File

@@ -1 +1,3 @@
from .crew_output import CrewOutput
__all__ = ["CrewOutput"]

View File

@@ -1,3 +1,5 @@
from .entity.entity_memory import EntityMemory
from .long_term.long_term_memory import LongTermMemory
from .short_term.short_term_memory import ShortTermMemory
__all__ = ["EntityMemory", "LongTermMemory", "ShortTermMemory"]

View File

@@ -5,13 +5,14 @@ import os
import shutil
from typing import Any, Dict, List, Optional
from crewai.memory.storage.interface import Storage
from crewai.utilities.paths import db_storage_path
from embedchain import App
from embedchain.llm.base import BaseLlm
from embedchain.models.data_type import DataType
from embedchain.vectordb.chroma import InvalidDimensionException
from crewai.memory.storage.interface import Storage
from crewai.utilities.paths import db_storage_path
@contextlib.contextmanager
def suppress_logging(
@@ -77,12 +78,12 @@ class RAGStorage(Storage):
self.app.llm = FakeLLM()
if allow_reset:
self.app.reset()
def _sanitize_role(self, role: str) -> str:
"""
Sanitizes agent roles to ensure valid directory names.
"""
return role.replace('\n', '').replace(' ', '_').replace('/', '_')
return role.replace("\n", "").replace(" ", "_").replace("/", "_")
def save(self, value: Any, metadata: Dict[str, Any]) -> None:
self._generate_embedding(value, metadata)

View File

@@ -1,3 +1,5 @@
from crewai.pipeline.pipeline import Pipeline
from crewai.pipeline.pipeline_kickoff_result import PipelineKickoffResult
from crewai.pipeline.pipeline_output import PipelineOutput
__all__ = ["Pipeline", "PipelineKickoffResult", "PipelineOutput"]

View File

@@ -1 +1,3 @@
from crewai.routers.router import Router
__all__ = ["Router"]

View File

@@ -273,7 +273,9 @@ class Task(BaseModel):
content = (
json_output
if json_output
else pydantic_output.model_dump_json() if pydantic_output else result
else pydantic_output.model_dump_json()
if pydantic_output
else result
)
self._save_file(content)

View File

@@ -1 +1,3 @@
from .telemetry import Telemetry
__all__ = ["Telemetry"]

View File

@@ -1,5 +1,6 @@
import re
class YamlParser:
@staticmethod
def parse(file):
@@ -16,7 +17,9 @@ class YamlParser:
# Replace single { and } with doubled ones, while leaving already doubled ones intact and the other special characters {# and {%
modified_content = re.sub(r"(?<!\{){(?!\{)(?!\#)(?!\%)", "{{", content)
modified_content = re.sub(r"(?<!\})(?<!\%)(?<!\#)\}(?!})", "}}", modified_content)
modified_content = re.sub(
r"(?<!\})(?<!\%)(?<!\#)\}(?!})", "}}", modified_content
)
# Check for 'context:' not followed by '[' and raise an error
if re.search(r"context:(?!\s*\[)", modified_content):

View File

@@ -113,7 +113,9 @@ def mock_router_factory(mock_crew_factory):
(
"route1"
if x.get("score", 0) > 80
else "route2" if x.get("score", 0) > 50 else "default"
else "route2"
if x.get("score", 0) > 50
else "default"
),
)
)