Skip to content

Commit

Permalink
preparing new version
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomdmoura committed Jan 3, 2025
1 parent bfe2c44 commit d1e2430
Show file tree
Hide file tree
Showing 6 changed files with 386 additions and 183 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ crew_tasks_output.json
.mypy_cache
.ruff_cache
.venv
agentops.log
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ dependencies = [
"openai>=1.13.3",
"litellm>=1.44.22",
"instructor>=1.3.3",

# Text Processing
"pdfplumber>=0.11.4",
"regex>=2024.9.11",

# Telemetry and Monitoring
"opentelemetry-api>=1.22.0",
"opentelemetry-sdk>=1.22.0",
"opentelemetry-exporter-otlp-proto-http>=1.22.0",

# Data Handling
"chromadb>=0.5.23",
"openpyxl>=3.1.5",
"pyvis>=0.3.2",

# Authentication and Security
"auth0-python>=4.7.1",
"python-dotenv>=1.0.0",

# Configuration and Utils
"click>=8.1.7",
"appdirs>=1.4.4",
Expand All @@ -40,7 +40,7 @@ dependencies = [
"uv>=0.4.25",
"tomli-w>=1.1.0",
"tomli>=2.0.2",
"blinker>=1.9.0",
"blinker>=1.9.0"
]

[project.urls]
Expand All @@ -49,7 +49,7 @@ Documentation = "https://docs.crewai.com"
Repository = "https://github.com/crewAIInc/crewAI"

[project.optional-dependencies]
tools = ["crewai-tools>=0.17.0"]
tools = ["crewai-tools>=0.25.5"]
embeddings = [
"tiktoken~=0.7.0"
]
Expand Down
23 changes: 18 additions & 5 deletions src/crewai/knowledge/source/crew_docling_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
from typing import Iterator, List, Optional, Union
from urllib.parse import urlparse

from docling.datamodel.base_models import InputFormat
from docling.document_converter import DocumentConverter
from docling.exceptions import ConversionError
from docling_core.transforms.chunker.hierarchical_chunker import HierarchicalChunker
from docling_core.types.doc.document import DoclingDocument
try:
from docling.datamodel.base_models import InputFormat
from docling.document_converter import DocumentConverter
from docling.exceptions import ConversionError
from docling_core.transforms.chunker.hierarchical_chunker import HierarchicalChunker
from docling_core.types.doc.document import DoclingDocument
DOCLING_AVAILABLE = True
except ImportError:
DOCLING_AVAILABLE = False

from pydantic import Field

from crewai.knowledge.source.base_knowledge_source import BaseKnowledgeSource
Expand All @@ -19,6 +24,14 @@ class CrewDoclingSource(BaseKnowledgeSource):
This will auto support PDF, DOCX, and TXT, XLSX, Images, and HTML files without any additional dependencies and follows the docling package as the source of truth.
"""

def __init__(self, *args, **kwargs):
if not DOCLING_AVAILABLE:
raise ImportError(
"The docling package is required to use CrewDoclingSource. "
"Please install it using: uv add docling"
)
super().__init__(*args, **kwargs)

_logger: Logger = Logger(verbose=True)

file_path: Optional[List[Union[Path, str]]] = Field(default=None)
Expand Down
2 changes: 1 addition & 1 deletion src/crewai/project/crew_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,5 @@ def _map_task_variables(
# Include base class (qual)name in the wrapper class (qual)name.
WrappedClass.__name__ = CrewBase.__name__ + "(" + cls.__name__ + ")"
WrappedClass.__qualname__ = CrewBase.__qualname__ + "(" + cls.__name__ + ")"

return cast(T, WrappedClass)
2 changes: 1 addition & 1 deletion src/crewai/tools/tool_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _use(

if calling.arguments:
try:
acceptable_args = tool.args_schema.schema()["properties"].keys() # type: ignore # Item "None" of "type[BaseModel] | None" has no attribute "schema"
acceptable_args = tool.args_schema.model_json_schema()["properties"].keys() # type: ignore
arguments = {
k: v
for k, v in calling.arguments.items()
Expand Down
Loading

0 comments on commit d1e2430

Please sign in to comment.