-
-
Notifications
You must be signed in to change notification settings - Fork 418
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update PraisonAI to version 2.0.42 and praisonaiagents to version 0.0.32
- Updated the PraisonAI package version from 2.0.41 to 2.0.42 in Dockerfile, pyproject.toml, and related files. - Adjusted installation command in Dockerfile and deploy scripts to reflect the new version. - Updated the praisonaiagents package version from 0.0.31 to 0.0.32 in relevant files. - Enhanced the prompt chaining implementation in agents/prompt_chaining.py for improved task management and workflow execution. - Added new documentation on agentic prompt chaining to guide users in creating complex workflows. - Updated dependencies in uv.lock for compatibility with the new versions.
- Loading branch information
1 parent
315ac71
commit 0a4e476
Showing
12 changed files
with
429 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM python:3.11-slim | ||
WORKDIR /app | ||
COPY . . | ||
RUN pip install flask praisonai==2.0.41 gunicorn markdown | ||
RUN pip install flask praisonai==2.0.42 gunicorn markdown | ||
EXPOSE 8080 | ||
CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
from praisonaiagents.agent import Agent | ||
from praisonaiagents.task import Task | ||
from praisonaiagents.agents import PraisonAIAgents | ||
from typing import List, Dict | ||
import time | ||
|
||
def get_time_check(): | ||
current_time = int(time.time()) | ||
result = "even" if current_time % 2 == 0 else "odd" | ||
print(f"Time check: {current_time} is {result}") | ||
return result | ||
|
||
# Create agents for each step in the chain | ||
agent1 = Agent( | ||
name="Time Checker", | ||
role="Time checker", | ||
goal="Check if the time is even or odd", | ||
instructions="Check if the time is even or odd", | ||
tools=[get_time_check] | ||
) | ||
|
||
agent2 = Agent( | ||
name="Advanced Analyzer", | ||
role="Advanced data analyzer", | ||
goal="Perform in-depth analysis of processed data", | ||
instructions="Analyze the processed data in detail" | ||
) | ||
|
||
agent3 = Agent( | ||
name="Final Processor", | ||
role="Final data processor", | ||
goal="Generate final output based on analysis", | ||
instructions="Create final output based on analyzed data" | ||
) | ||
|
||
# Create tasks for each step | ||
initial_task = Task( | ||
name="time_check", | ||
description="Getting time check and checking if it is even or odd", | ||
expected_output="Getting time check and checking if it is even or odd", | ||
agent=agent1, | ||
is_start=True, # Mark as the starting task | ||
task_type="decision", # This task will make a decision | ||
next_tasks=["advanced_analysis"], # Next task if condition passes | ||
condition={ | ||
"even": ["advanced_analysis"], # If passes, go to advanced analysis | ||
"odd": "" # If fails, exit the chain | ||
} | ||
) | ||
|
||
analysis_task = Task( | ||
name="advanced_analysis", | ||
description="Perform advanced analysis on the processed data", | ||
expected_output="Analyzed data ready for final processing", | ||
agent=agent2, | ||
next_tasks=["final_processing"] | ||
) | ||
|
||
final_task = Task( | ||
name="final_processing", | ||
description="Generate final output", | ||
expected_output="Final processed result", | ||
agent=agent3 | ||
) | ||
|
||
# Create the workflow manager | ||
workflow = PraisonAIAgents( | ||
agents=[agent1, agent2, agent3], | ||
tasks=[initial_task, analysis_task, final_task], | ||
process="workflow", # Use workflow process type | ||
verbose=True | ||
) | ||
|
||
# Run the workflow | ||
results = workflow.start() | ||
|
||
# Print results | ||
print("\nWorkflow Results:") | ||
for task_id, result in results["task_results"].items(): | ||
if result: | ||
print(f"Task {task_id}: {result.raw}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.