mirror of
https://github.com/crewAIInc/crewAI.git
synced 2025-12-18 05:18:31 +00:00
Compare commits
7 Commits
fix/consol
...
lg-python-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a3b94c84b | ||
|
|
5307055ae6 | ||
|
|
41925a7728 | ||
|
|
6ebfb57f9e | ||
|
|
db316e55b2 | ||
|
|
4a7b5ef93f | ||
|
|
7d15b29df8 |
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ['3.10', '3.11', '3.12']
|
python-version: ['3.10', '3.11', '3.12', '3.13']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Watch this video tutorial for a step-by-step demonstration of the installation p
|
|||||||
<Note>
|
<Note>
|
||||||
**Python Version Requirements**
|
**Python Version Requirements**
|
||||||
|
|
||||||
CrewAI requires `Python >=3.10 and <3.13`. Here's how to check your version:
|
CrewAI requires `Python >=3.10 and <=3.13`. Here's how to check your version:
|
||||||
```bash
|
```bash
|
||||||
python3 --version
|
python3 --version
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name = "crewai"
|
|||||||
version = "0.121.1"
|
version = "0.121.1"
|
||||||
description = "Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks."
|
description = "Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10,<3.13"
|
requires-python = ">=3.10,<3.14"
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "Joao Moura", email = "joao@crewai.com" }
|
{ name = "Joao Moura", email = "joao@crewai.com" }
|
||||||
]
|
]
|
||||||
@@ -22,6 +22,8 @@ dependencies = [
|
|||||||
"opentelemetry-exporter-otlp-proto-http>=1.30.0",
|
"opentelemetry-exporter-otlp-proto-http>=1.30.0",
|
||||||
# Data Handling
|
# Data Handling
|
||||||
"chromadb>=0.5.23",
|
"chromadb>=0.5.23",
|
||||||
|
"tokenizers>=0.20.3",
|
||||||
|
"onnxruntime==1.22.0",
|
||||||
"openpyxl>=3.1.5",
|
"openpyxl>=3.1.5",
|
||||||
"pyvis>=0.3.2",
|
"pyvis>=0.3.2",
|
||||||
# Authentication and Security
|
# Authentication and Security
|
||||||
@@ -50,7 +52,6 @@ embeddings = [
|
|||||||
"tiktoken~=0.7.0"
|
"tiktoken~=0.7.0"
|
||||||
]
|
]
|
||||||
agentops = ["agentops>=0.3.0"]
|
agentops = ["agentops>=0.3.0"]
|
||||||
fastembed = ["fastembed>=0.4.1"]
|
|
||||||
pdfplumber = [
|
pdfplumber = [
|
||||||
"pdfplumber>=0.11.4",
|
"pdfplumber>=0.11.4",
|
||||||
]
|
]
|
||||||
@@ -100,6 +101,27 @@ exclude = ["cli/templates"]
|
|||||||
[tool.bandit]
|
[tool.bandit]
|
||||||
exclude_dirs = ["src/crewai/cli/templates"]
|
exclude_dirs = ["src/crewai/cli/templates"]
|
||||||
|
|
||||||
|
# PyTorch index configuration, since torch 2.5.0 is not compatible with python 3.13
|
||||||
|
[[tool.uv.index]]
|
||||||
|
name = "pytorch-nightly"
|
||||||
|
url = "https://download.pytorch.org/whl/nightly/cpu"
|
||||||
|
explicit = true
|
||||||
|
|
||||||
|
[[tool.uv.index]]
|
||||||
|
name = "pytorch"
|
||||||
|
url = "https://download.pytorch.org/whl/cpu"
|
||||||
|
explicit = true
|
||||||
|
|
||||||
|
[tool.uv.sources]
|
||||||
|
torch = [
|
||||||
|
{ index = "pytorch-nightly", marker = "python_version >= '3.13'" },
|
||||||
|
{ index = "pytorch", marker = "python_version < '3.13'" },
|
||||||
|
]
|
||||||
|
torchvision = [
|
||||||
|
{ index = "pytorch-nightly", marker = "python_version >= '3.13'" },
|
||||||
|
{ index = "pytorch", marker = "python_version < '3.13'" },
|
||||||
|
]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling"]
|
requires = ["hatchling"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "hatchling.build"
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
from pathlib import Path
|
|
||||||
from typing import List, Optional, Union
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
from .base_embedder import BaseEmbedder
|
|
||||||
|
|
||||||
try:
|
|
||||||
from fastembed_gpu import TextEmbedding # type: ignore
|
|
||||||
|
|
||||||
FASTEMBED_AVAILABLE = True
|
|
||||||
except ImportError:
|
|
||||||
try:
|
|
||||||
from fastembed import TextEmbedding
|
|
||||||
|
|
||||||
FASTEMBED_AVAILABLE = True
|
|
||||||
except ImportError:
|
|
||||||
FASTEMBED_AVAILABLE = False
|
|
||||||
|
|
||||||
|
|
||||||
class FastEmbed(BaseEmbedder):
|
|
||||||
"""
|
|
||||||
A wrapper class for text embedding models using FastEmbed
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
model_name: str = "BAAI/bge-small-en-v1.5",
|
|
||||||
cache_dir: Optional[Union[str, Path]] = None,
|
|
||||||
):
|
|
||||||
"""
|
|
||||||
Initialize the embedding model
|
|
||||||
|
|
||||||
Args:
|
|
||||||
model_name: Name of the model to use
|
|
||||||
cache_dir: Directory to cache the model
|
|
||||||
gpu: Whether to use GPU acceleration
|
|
||||||
"""
|
|
||||||
if not FASTEMBED_AVAILABLE:
|
|
||||||
raise ImportError(
|
|
||||||
"FastEmbed is not installed. Please install it with: "
|
|
||||||
"uv pip install fastembed or uv pip install fastembed-gpu for GPU support"
|
|
||||||
)
|
|
||||||
|
|
||||||
self.model = TextEmbedding(
|
|
||||||
model_name=model_name,
|
|
||||||
cache_dir=str(cache_dir) if cache_dir else None,
|
|
||||||
)
|
|
||||||
|
|
||||||
def embed_chunks(self, chunks: List[str]) -> List[np.ndarray]:
|
|
||||||
"""
|
|
||||||
Generate embeddings for a list of text chunks
|
|
||||||
|
|
||||||
Args:
|
|
||||||
chunks: List of text chunks to embed
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List of embeddings
|
|
||||||
"""
|
|
||||||
embeddings = list(self.model.embed(chunks))
|
|
||||||
return embeddings
|
|
||||||
|
|
||||||
def embed_texts(self, texts: List[str]) -> List[np.ndarray]:
|
|
||||||
"""
|
|
||||||
Generate embeddings for a list of texts
|
|
||||||
|
|
||||||
Args:
|
|
||||||
texts: List of texts to embed
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List of embeddings
|
|
||||||
"""
|
|
||||||
embeddings = list(self.model.embed(texts))
|
|
||||||
return embeddings
|
|
||||||
|
|
||||||
def embed_text(self, text: str) -> np.ndarray:
|
|
||||||
"""
|
|
||||||
Generate embedding for a single text
|
|
||||||
|
|
||||||
Args:
|
|
||||||
text: Text to embed
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Embedding array
|
|
||||||
"""
|
|
||||||
return self.embed_texts([text])[0]
|
|
||||||
|
|
||||||
@property
|
|
||||||
def dimension(self) -> int:
|
|
||||||
"""Get the dimension of the embeddings"""
|
|
||||||
# Generate a test embedding to get dimensions
|
|
||||||
test_embed = self.embed_text("test")
|
|
||||||
return len(test_embed)
|
|
||||||
Reference in New Issue
Block a user