mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 08:38:30 +00:00
Move to src dir usage (#99)
This commit is contained in:
6
poetry.lock
generated
6
poetry.lock
generated
@@ -870,13 +870,13 @@ extended-testing = ["aiosqlite (>=0.19.0,<0.20.0)", "aleph-alpha-client (>=2.15.
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "langchain-core"
|
name = "langchain-core"
|
||||||
version = "0.1.8"
|
version = "0.1.9"
|
||||||
description = "Building applications with LLMs through composability"
|
description = "Building applications with LLMs through composability"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8.1,<4.0"
|
python-versions = ">=3.8.1,<4.0"
|
||||||
files = [
|
files = [
|
||||||
{file = "langchain_core-0.1.8-py3-none-any.whl", hash = "sha256:f4d1837d6d814ed36528b642211933d1f0bd84e1eff361f4630a8c750acc27d0"},
|
{file = "langchain_core-0.1.9-py3-none-any.whl", hash = "sha256:1dd45aec185ce3afb1c19fb2e88cdbc19fafa7ae929d8107799a7c82ef69ea9f"},
|
||||||
{file = "langchain_core-0.1.8.tar.gz", hash = "sha256:93ab72f5ab202526310fad389a45626501fd76ecf56d451111c0d4abe8183407"},
|
{file = "langchain_core-0.1.9.tar.gz", hash = "sha256:4b51fdbdbc06027c26ea89a6da809cae2e404c9daa95dc6c10e3eae383d8ea6a"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ version = "0.1.24"
|
|||||||
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."
|
||||||
authors = ["Joao Moura <joaomdmoura@gmail.com>"]
|
authors = ["Joao Moura <joaomdmoura@gmail.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
packages = [
|
||||||
|
{ include = "crewai", from = "src" },
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
[tool.poetry.urls]
|
[tool.poetry.urls]
|
||||||
Homepage = "https://github.com/joaomdmoura/crewai"
|
Homepage = "https://github.com/joaomdmoura/crewai"
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import os
|
|||||||
from typing import ClassVar, Dict, Optional
|
from typing import ClassVar, Dict, Optional
|
||||||
|
|
||||||
from langchain.prompts import PromptTemplate
|
from langchain.prompts import PromptTemplate
|
||||||
from pydantic import BaseModel, Field, PrivateAttr, model_validator, ValidationError
|
from pydantic import BaseModel, Field, PrivateAttr, ValidationError, model_validator
|
||||||
|
|
||||||
|
|
||||||
class Prompts(BaseModel):
|
class Prompts(BaseModel):
|
||||||
"""Manages and generates prompts for a generic agent with support for different languages."""
|
"""Manages and generates prompts for a generic agent with support for different languages."""
|
||||||
@@ -24,7 +25,9 @@ class Prompts(BaseModel):
|
|||||||
with open(prompts_path, "r") as f:
|
with open(prompts_path, "r") as f:
|
||||||
self._prompts = json.load(f)["slices"]
|
self._prompts = json.load(f)["slices"]
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise ValidationError(f"Prompt file for language '{self.language}' not found.")
|
raise ValidationError(
|
||||||
|
f"Prompt file for language '{self.language}' not found."
|
||||||
|
)
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
raise ValidationError(f"Error decoding JSON from the prompts file.")
|
raise ValidationError(f"Error decoding JSON from the prompts file.")
|
||||||
return self
|
return self
|
||||||
@@ -45,6 +48,10 @@ class Prompts(BaseModel):
|
|||||||
|
|
||||||
def _build_prompt(self, components: [str]) -> str:
|
def _build_prompt(self, components: [str]) -> str:
|
||||||
"""Constructs a prompt string from specified components."""
|
"""Constructs a prompt string from specified components."""
|
||||||
prompt_parts = [self._prompts[component] for component in components if component in self._prompts]
|
prompt_parts = [
|
||||||
|
self._prompts[component]
|
||||||
|
for component in components
|
||||||
|
if component in self._prompts
|
||||||
|
]
|
||||||
prompt_parts.append(self.SCRATCHPAD_SLICE)
|
prompt_parts.append(self.SCRATCHPAD_SLICE)
|
||||||
return PromptTemplate.from_template("".join(prompt_parts))
|
return PromptTemplate.from_template("".join(prompt_parts))
|
||||||
0
src/crewai/tools/__init__.py
Normal file
0
src/crewai/tools/__init__.py
Normal file
Reference in New Issue
Block a user