Compare commits

..

24 Commits

Author SHA1 Message Date
Eduardo Chiarotti
8a13741b15 fix: add timeout for tests.yml 2024-08-23 09:52:33 -03:00
Eduardo Chiarotti
97b5d6b809 feat: fix get crewai versoin 2024-08-23 09:49:59 -03:00
Eduardo Chiarotti
4f266980ef feat: fix pr issues 2024-08-23 09:44:15 -03:00
Eduardo Chiarotti
b87bcd25bb Merge branch 'main' into feat/cli-deploy 2024-08-23 08:26:55 -03:00
Eduardo Chiarotti
2ff7dad61e feat: rename tests to pass ci 2024-08-22 21:54:44 -03:00
Eduardo Chiarotti
33ace9bfe2 feat: fix type checking issue 2024-08-22 20:30:23 -03:00
Eduardo Chiarotti
bcdea6849f feat: add deploy man tests 2024-08-22 20:17:02 -03:00
Eduardo Chiarotti
92ca4ce841 feat: add tests 2024-08-22 20:06:11 -03:00
Eduardo Chiarotti
27f2682301 feat: add unit tests for cl 2024-08-22 19:50:40 -03:00
Eduardo Chiarotti
0c3c4fbe17 feat: add tests for utils 2024-08-22 19:45:15 -03:00
Eduardo Chiarotti
5f3fa857cc feat: add tests for authentication module 2024-08-22 18:54:20 -03:00
Eduardo Chiarotti
8eeca55354 feat: add docstrings 2024-08-22 18:06:49 -03:00
Eduardo Chiarotti
b5db79da12 feat: add get crew version to send on header of request 2024-08-22 17:58:03 -03:00
Eduardo Chiarotti
156f59760c feat: add subsystem saving credentials and remove comment of type hinting 2024-08-22 17:45:27 -03:00
Eduardo Chiarotti
50746d5e8b feat: add audience to costants 2024-08-21 19:42:43 -03:00
Eduardo Chiarotti
bcc050b793 feat: Add token manager to encrypt access token and get and save tokens 2024-08-21 19:32:10 -03:00
Eduardo Chiarotti
d4d7712164 fix: parts of the code 2024-08-21 17:33:59 -03:00
Eduardo Chiarotti
414a9ba07e feat: update code and decouple auth 2024-08-21 16:11:16 -03:00
Eduardo Chiarotti
3b0286f592 feat: add auth0 lib, update cli and improve code 2024-08-21 15:16:49 -03:00
Eduardo Chiarotti
5d1f655229 feat: Remove test token 2024-08-20 22:44:27 -03:00
Eduardo Chiarotti
f44d3902a4 feat: Add api, Deploy command and update cli 2024-08-20 22:42:55 -03:00
Eduardo Chiarotti
bec9a4941c feat: some minor refactor 2024-08-20 07:25:28 -03:00
Eduardo Chiarotti
f0e28cd88a feat: add first iteration of CLI Deploy 2024-08-19 21:25:23 -03:00
Eduardo Chiarotti
ff5c55fd54 feat: set basic structure deploy commands 2024-08-19 17:22:05 -03:00
12 changed files with 25 additions and 47 deletions

View File

@@ -112,30 +112,30 @@ Switch between APIs and models seamlessly using environment variables, supportin
### Configuration Examples
#### FastChat
```sh
os.environ["OPENAI_API_BASE"]='http://localhost:8001/v1'
os.environ["OPENAI_MODEL_NAME"]='oh-2.5m7b-q51'
os.environ[OPENAI_API_KEY]='NA'
os.environ[OPENAI_API_BASE]="http://localhost:8001/v1"
os.environ[OPENAI_MODEL_NAME]='oh-2.5m7b-q51'
os.environ[OPENAI_API_KEY]=NA
```
#### LM Studio
Launch [LM Studio](https://lmstudio.ai) and go to the Server tab. Then select a model from the dropdown menu and wait for it to load. Once it's loaded, click the green Start Server button and use the URL, port, and API key that's shown (you can modify them). Below is an example of the default settings as of LM Studio 0.2.19:
```sh
os.environ["OPENAI_API_BASE"]='http://localhost:1234/v1'
os.environ["OPENAI_API_KEY"]='lm-studio'
os.environ[OPENAI_API_BASE]="http://localhost:1234/v1"
os.environ[OPENAI_API_KEY]="lm-studio"
```
#### Groq API
```sh
os.environ["OPENAI_API_KEY"]='your-groq-api-key'
os.environ["OPENAI_MODEL_NAME"]='llama3-8b-8192'
os.environ["OPENAI_API_BASE"]='https://api.groq.com/openai/v1'
os.environ[OPENAI_API_KEY]=your-groq-api-key
os.environ[OPENAI_MODEL_NAME]='llama3-8b-8192'
os.environ[OPENAI_API_BASE]=https://api.groq.com/openai/v1
```
#### Mistral API
```sh
os.environ["OPENAI_API_KEY"]='your-mistral-api-key'
os.environ["OPENAI_API_BASE"]='https://api.mistral.ai/v1'
os.environ["OPENAI_MODEL_NAME"]='mistral-small'
os.environ[OPENAI_API_KEY]=your-mistral-api-key
os.environ[OPENAI_API_BASE]=https://api.mistral.ai/v1
os.environ[OPENAI_MODEL_NAME]="mistral-small"
```
### Solar
@@ -143,8 +143,8 @@ os.environ["OPENAI_MODEL_NAME"]='mistral-small'
from langchain_community.chat_models.solar import SolarChat
```
```sh
os.environ["SOLAR_API_BASE"]='https://api.upstage.ai/v1/solar'
os.environ["SOLAR_API_KEY"]='your-solar-api-key'
os.environ[SOLAR_API_BASE]="https://api.upstage.ai/v1/solar"
os.environ[SOLAR_API_KEY]="your-solar-api-key"
```
# Free developer API key available here: https://console.upstage.ai/services/solar
@@ -155,7 +155,7 @@ os.environ["SOLAR_API_KEY"]='your-solar-api-key'
```python
from langchain_cohere import ChatCohere
# Initialize language model
os.environ["COHERE_API_KEY"]='your-cohere-api-key'
os.environ["COHERE_API_KEY"] = "your-cohere-api-key"
llm = ChatCohere()
# Free developer API key available here: https://cohere.com/
@@ -166,10 +166,10 @@ llm = ChatCohere()
For Azure OpenAI API integration, set the following environment variables:
```sh
os.environ["AZURE_OPENAI_DEPLOYMENT"]='Your deployment'
os.environ["OPENAI_API_VERSION"]='2023-12-01-preview'
os.environ["AZURE_OPENAI_ENDPOINT"]='Your Endpoint'
os.environ["AZURE_OPENAI_API_KEY"]='Your API Key'
os.environ[AZURE_OPENAI_DEPLOYMENT] = "Your deployment"
os.environ["OPENAI_API_VERSION"] = "2023-12-01-preview"
os.environ["AZURE_OPENAI_ENDPOINT"] = "Your Endpoint"
os.environ["AZURE_OPENAI_API_KEY"] = "<Your API Key>"
```
### Example Agent with Azure LLM

View File

@@ -2,5 +2,3 @@ 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,3 +1 @@
from .cache_handler import CacheHandler
__all__ = ["CacheHandler"]

View File

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

View File

@@ -1,5 +1,3 @@
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,14 +5,13 @@ 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(
@@ -78,12 +77,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,5 +1,3 @@
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,3 +1 @@
from crewai.routers.router import Router
__all__ = ["Router"]

View File

@@ -273,9 +273,7 @@ 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,3 +1 @@
from .telemetry import Telemetry
__all__ = ["Telemetry"]

View File

@@ -1,6 +1,5 @@
import re
class YamlParser:
@staticmethod
def parse(file):
@@ -17,9 +16,7 @@ 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,9 +113,7 @@ 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"
),
)
)