mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
fix: Fix planning_llm issue
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
from concurrent.futures import Future
|
from concurrent.futures import Future
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
import os
|
|
||||||
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
|
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from langchain_core.callbacks import BaseCallbackHandler
|
from langchain_core.callbacks import BaseCallbackHandler
|
||||||
@@ -48,7 +48,6 @@ from crewai.utilities.planning_handler import CrewPlanner
|
|||||||
from crewai.utilities.task_output_storage_handler import TaskOutputStorageHandler
|
from crewai.utilities.task_output_storage_handler import TaskOutputStorageHandler
|
||||||
from crewai.utilities.training_handler import CrewTrainingHandler
|
from crewai.utilities.training_handler import CrewTrainingHandler
|
||||||
|
|
||||||
|
|
||||||
agentops = None
|
agentops = None
|
||||||
if os.environ.get("AGENTOPS_API_KEY"):
|
if os.environ.get("AGENTOPS_API_KEY"):
|
||||||
try:
|
try:
|
||||||
@@ -541,7 +540,7 @@ class Crew(BaseModel):
|
|||||||
)._handle_crew_planning()
|
)._handle_crew_planning()
|
||||||
|
|
||||||
for task, step_plan in zip(self.tasks, result.list_of_plans_per_task):
|
for task, step_plan in zip(self.tasks, result.list_of_plans_per_task):
|
||||||
task.description += step_plan
|
task.description += step_plan.plan
|
||||||
|
|
||||||
def _store_execution_log(
|
def _store_execution_log(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -1,14 +1,25 @@
|
|||||||
from typing import Any, List, Optional
|
from typing import Any, List, Optional
|
||||||
|
|
||||||
from langchain_openai import ChatOpenAI
|
from langchain_openai import ChatOpenAI
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from crewai.agent import Agent
|
from crewai.agent import Agent
|
||||||
from crewai.task import Task
|
from crewai.task import Task
|
||||||
|
|
||||||
|
|
||||||
|
class PlanPerTask(BaseModel):
|
||||||
|
task: str = Field(..., description="The task for which the plan is created")
|
||||||
|
plan: str = Field(
|
||||||
|
...,
|
||||||
|
description="The step by step plan on how the agents can execute their tasks using the available tools with mastery",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class PlannerTaskPydanticOutput(BaseModel):
|
class PlannerTaskPydanticOutput(BaseModel):
|
||||||
list_of_plans_per_task: List[str]
|
list_of_plans_per_task: List[PlanPerTask] = Field(
|
||||||
|
...,
|
||||||
|
description="Step by step plan on how the agents can execute their tasks using the available tools with mastery",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class CrewPlanner:
|
class CrewPlanner:
|
||||||
|
|||||||
Reference in New Issue
Block a user