mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-29 18:18:13 +00:00
updating code to usinf pydantic v1
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Generic agent."""
|
||||
|
||||
from typing import List
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic.v1 import BaseModel, Field
|
||||
|
||||
from langchain.tools import Tool
|
||||
from langchain.agents import AgentExecutor
|
||||
@@ -16,7 +16,6 @@ from langchain.memory import (
|
||||
)
|
||||
|
||||
from .prompts import Prompts
|
||||
from .agents.agent_vote import AgentVote
|
||||
|
||||
class Agent(BaseModel):
|
||||
"""Generic agent implementation."""
|
||||
@@ -28,11 +27,7 @@ class Agent(BaseModel):
|
||||
description="Tools at agents disposal",
|
||||
default=[]
|
||||
)
|
||||
prompts: Prompts = Field(
|
||||
description="Prompts class for the agent.",
|
||||
default=Prompts
|
||||
)
|
||||
llm: str = Field(
|
||||
llm: OpenAI = Field(
|
||||
description="LLM that will run the agent",
|
||||
default=OpenAI(
|
||||
temperature=0.7,
|
||||
@@ -53,7 +48,7 @@ class Agent(BaseModel):
|
||||
inner_agent = {
|
||||
"input": lambda x: x["input"],
|
||||
"tools": lambda x: x["tools"],
|
||||
"entities": lambda x: x["entities"],
|
||||
"entities": lambda x: x["entities"],
|
||||
"tool_names": lambda x: x["tool_names"],
|
||||
"chat_history": lambda x: x["chat_history"],
|
||||
"agent_scratchpad": lambda x: format_log_to_str(x['intermediate_steps']),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic.v1 import BaseModel, Field
|
||||
|
||||
class AgentVote(BaseModel):
|
||||
task: str = Field(description="Task to be executed by the agent")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from typing import List
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic.v1 import BaseModel, Field
|
||||
|
||||
from .process import Process
|
||||
from .agent import Agent
|
||||
@@ -21,4 +21,19 @@ class Crew(BaseModel):
|
||||
Returns:
|
||||
output (List[str]): Output of the crew for each task.
|
||||
"""
|
||||
# if self.process == Process.consensual:
|
||||
|
||||
return "Crew is executing task"
|
||||
|
||||
def __consensual_loop(self) -> str:
|
||||
"""
|
||||
Loop that executes the consensual process.
|
||||
Returns:
|
||||
output (str): Output of the crew.
|
||||
"""
|
||||
|
||||
# The group of agents need to decide which agent will execute each task
|
||||
# in the self.task list. This is done by a voting process between all the
|
||||
# agents in self.agents. The agent with the most votes will execute the
|
||||
# task.
|
||||
pass
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from textwrap import dedent
|
||||
from typing import ClassVar
|
||||
from pydantic import BaseModel
|
||||
from pydantic.v1 import BaseModel
|
||||
from langchain.prompts import PromptTemplate
|
||||
|
||||
class Prompts(BaseModel):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from typing import List, Optional
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
from pydantic.v1 import BaseModel, Field
|
||||
from pydantic import model_validator
|
||||
|
||||
from langchain.tools import Tool
|
||||
|
||||
|
||||
Reference in New Issue
Block a user