mirror of
https://github.com/crewAIInc/crewAI.git
synced 2025-12-23 15:58:30 +00:00
Compare commits
2 Commits
bugfix/res
...
fix/pre-co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc4291996e | ||
|
|
d1aee5450f |
@@ -2,3 +2,5 @@ from .cache.cache_handler import CacheHandler
|
|||||||
from .executor import CrewAgentExecutor
|
from .executor import CrewAgentExecutor
|
||||||
from .parser import CrewAgentParser
|
from .parser import CrewAgentParser
|
||||||
from .tools_handler import ToolsHandler
|
from .tools_handler import ToolsHandler
|
||||||
|
|
||||||
|
__all__ = ["CacheHandler", "CrewAgentExecutor", "CrewAgentParser", "ToolsHandler"]
|
||||||
|
|||||||
2
src/crewai/agents/cache/__init__.py
vendored
2
src/crewai/agents/cache/__init__.py
vendored
@@ -1 +1,3 @@
|
|||||||
from .cache_handler import CacheHandler
|
from .cache_handler import CacheHandler
|
||||||
|
|
||||||
|
__all__ = ["CacheHandler"]
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
from .crew_output import CrewOutput
|
from .crew_output import CrewOutput
|
||||||
|
|
||||||
|
__all__ = ["CrewOutput"]
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
from .entity.entity_memory import EntityMemory
|
from .entity.entity_memory import EntityMemory
|
||||||
from .long_term.long_term_memory import LongTermMemory
|
from .long_term.long_term_memory import LongTermMemory
|
||||||
from .short_term.short_term_memory import ShortTermMemory
|
from .short_term.short_term_memory import ShortTermMemory
|
||||||
|
|
||||||
|
__all__ = ["EntityMemory", "LongTermMemory", "ShortTermMemory"]
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
from typing import Any, Dict, List, Optional
|
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 import App
|
||||||
from embedchain.llm.base import BaseLlm
|
from embedchain.llm.base import BaseLlm
|
||||||
from embedchain.models.data_type import DataType
|
from embedchain.models.data_type import DataType
|
||||||
from embedchain.vectordb.chroma import InvalidDimensionException
|
from embedchain.vectordb.chroma import InvalidDimensionException
|
||||||
|
|
||||||
|
from crewai.memory.storage.interface import Storage
|
||||||
|
from crewai.utilities.paths import db_storage_path
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def suppress_logging(
|
def suppress_logging(
|
||||||
@@ -82,7 +83,7 @@ class RAGStorage(Storage):
|
|||||||
"""
|
"""
|
||||||
Sanitizes agent roles to ensure valid directory names.
|
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:
|
def save(self, value: Any, metadata: Dict[str, Any]) -> None:
|
||||||
self._generate_embedding(value, metadata)
|
self._generate_embedding(value, metadata)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
from crewai.pipeline.pipeline import Pipeline
|
from crewai.pipeline.pipeline import Pipeline
|
||||||
from crewai.pipeline.pipeline_kickoff_result import PipelineKickoffResult
|
from crewai.pipeline.pipeline_kickoff_result import PipelineKickoffResult
|
||||||
from crewai.pipeline.pipeline_output import PipelineOutput
|
from crewai.pipeline.pipeline_output import PipelineOutput
|
||||||
|
|
||||||
|
__all__ = ["Pipeline", "PipelineKickoffResult", "PipelineOutput"]
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
from crewai.routers.router import Router
|
from crewai.routers.router import Router
|
||||||
|
|
||||||
|
__all__ = ["Router"]
|
||||||
|
|||||||
@@ -273,7 +273,9 @@ class Task(BaseModel):
|
|||||||
content = (
|
content = (
|
||||||
json_output
|
json_output
|
||||||
if 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)
|
self._save_file(content)
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
from .telemetry import Telemetry
|
from .telemetry import Telemetry
|
||||||
|
|
||||||
|
__all__ = ["Telemetry"]
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
class YamlParser:
|
class YamlParser:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse(file):
|
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 {%
|
# 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"(?<!\{){(?!\{)(?!\#)(?!\%)", "{{", 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
|
# Check for 'context:' not followed by '[' and raise an error
|
||||||
if re.search(r"context:(?!\s*\[)", modified_content):
|
if re.search(r"context:(?!\s*\[)", modified_content):
|
||||||
|
|||||||
@@ -113,7 +113,9 @@ def mock_router_factory(mock_crew_factory):
|
|||||||
(
|
(
|
||||||
"route1"
|
"route1"
|
||||||
if x.get("score", 0) > 80
|
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"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user