mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-09 03:39:37 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76e390fc75 | ||
|
|
4447dacb03 |
No files matched your search
@@ -49,13 +49,13 @@ jobs:
|
||||
// --- Label triage ---
|
||||
const labels = [];
|
||||
|
||||
// Kind labels (bug before "how to" — bug reports often include "## How to fix")
|
||||
// Kind labels
|
||||
if (content.includes('feature request') || content.includes('[feature')) {
|
||||
labels.push('enhancement');
|
||||
} else if (!title.includes('[question]') && (content.includes('bug') || content.includes('error') || content.includes('crash') || content.includes('traceback'))) {
|
||||
labels.push('bug');
|
||||
} else if (title.includes('[question]') || content.includes('how do i') || (content.includes('how to') && !content.includes('how to fix'))) {
|
||||
} else if (title.includes('[question]') || content.includes('how do i') || content.includes('how to')) {
|
||||
labels.push('question');
|
||||
} else if (content.includes('bug') || content.includes('error') || content.includes('crash') || content.includes('traceback')) {
|
||||
labels.push('bug');
|
||||
} else if (content.includes('question')) {
|
||||
labels.push('question');
|
||||
}
|
||||
@@ -108,10 +108,7 @@ jobs:
|
||||
// --- Auto-trigger Claude for owner issues and actionable external bug/enhancement reports ---
|
||||
const titleLower = (issue.title || '').toLowerCase();
|
||||
const hasActionableTitle = /^(\[[^\]]+\]|bug:|fix[:(]|feat:|ux:|enhancement:)/i.test(titleLower);
|
||||
const autoClaude = isOwner || (hasActionableTitle && (
|
||||
labels.includes('bug') ||
|
||||
(labels.includes('enhancement') && !labels.includes('question'))
|
||||
));
|
||||
const autoClaude = isOwner || (hasActionableTitle && (labels.includes('bug') || labels.includes('enhancement')) && !labels.includes('question'));
|
||||
if (autoClaude) {
|
||||
await github.rest.issues.addLabels({
|
||||
issue_number: issue.number,
|
||||
|
||||
@@ -29,15 +29,6 @@ output
|
||||
threads.db
|
||||
threads.db-journal
|
||||
|
||||
# Example run artifacts (generated at runtime, must not be committed)
|
||||
examples/**/knowledge.db
|
||||
examples/**/knowledge.db-journal
|
||||
examples/python/managed-agents/managed_ids.json
|
||||
examples/python/save_output/blog_post.md
|
||||
examples/python/save_output/generated/
|
||||
examples/python/token-metrics/token_metrics_export.json
|
||||
examples/python/usecases/market_research_results.json
|
||||
|
||||
.chainlit
|
||||
!praisonai/ui/config/.chainlit
|
||||
|
||||
|
||||
@@ -232,6 +232,13 @@ Methods:
|
||||
* <code title="function">praisonaiagents.<a href="./src/praisonai-agents/praisonaiagents/workflows/workflows.py">repeat</a>(step: Any, until: Optional[Callable[[WorkflowContext], bool]] = None, max_iterations: int = 10) -> Repeat</code>
|
||||
* <code title="function">praisonaiagents.<a href="./src/praisonai-agents/praisonaiagents/workflows/workflows.py">route</a>(routes: Dict[str, List], default: Optional[List] = None) -> Route</code>
|
||||
|
||||
# DB
|
||||
|
||||
Types:
|
||||
```python
|
||||
from praisonaiagents import db
|
||||
```
|
||||
|
||||
# Memory
|
||||
|
||||
Types:
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
HTTP Approval Example
|
||||
=====================
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Slack Approval Example
|
||||
======================
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Completions Capability Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Embeddings Capability Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Images Capability Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Moderations Capability Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Energy Industry Template
|
||||
========================
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Transportation Industry Template
|
||||
================================
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
CI Integration Example - Using Doctor in CI/CD pipelines
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Agent-centric Embedding Example
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
PraisonAI Endpoints Example
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Fixed example demonstrating proper guardrail usage with PraisonAI Agents.
|
||||
This addresses the issues reported in issue #875.
|
||||
|
||||
@@ -150,10 +150,14 @@ def main():
|
||||
print(f"\nOriginal document length: {len(content)} characters")
|
||||
|
||||
chunks = [{"text": content, "metadata": {"source": doc_path}}]
|
||||
target_tokens = 2000
|
||||
|
||||
# Estimate original tokens (~4 chars/token) so each ratio maps to a
|
||||
# distinct token budget — compress() truncates to target_tokens.
|
||||
original_tokens = max(1, len(content) // 4)
|
||||
|
||||
# Compress with different ratios
|
||||
for ratio in [0.3, 0.5, 0.7]:
|
||||
target_tokens = max(1, int(original_tokens * ratio))
|
||||
compressor = ContextCompressor(verbose=False)
|
||||
result = compressor.compress(
|
||||
chunks,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
ManagedAgent + ClickHouse Persistence — Real conversation with session resume.
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
ManagedAgent + MongoDB Persistence — Real conversation with session resume.
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
ManagedAgent + MySQL Persistence — Real conversation with session resume.
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
ManagedAgent + PostgreSQL Persistence — Real conversation with session resume.
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
ManagedAgent + Redis Persistence — Real conversation with session resume.
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
ManagedAgent + SQLite Persistence — Real conversation with session resume.
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Custom Tools MCP Server Example
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
HTTP Stream MCP Server Example
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
MCP Client Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""Multi-Agent Shared Session Demo"""
|
||||
from praisonaiagents import Agent
|
||||
from praisonai.persistence import create_conversation_store
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Langfuse Integration Example (Updated for TraceSinkProtocol)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""MLflow Local Observability Demo (no API key needed)"""
|
||||
import mlflow
|
||||
import time
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
ClickHouse — Persistence Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Minimal Agent with Database Persistence
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
MongoDB StateStore — Full Persistence Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
MySQL ConversationStore — Full Persistence Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
PostgreSQL ConversationStore — Full Persistence Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
PostgreSQL with Runs and Traces
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Redis StateStore — Full Persistence Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Session Resume Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Redis State Store - Agent-First Example
|
||||
|
||||
@@ -28,7 +27,7 @@ my_db = db(
|
||||
agent = Agent(
|
||||
name="Assistant",
|
||||
instructions="You are a helpful assistant.",
|
||||
memory=my_db,
|
||||
db=my_db,
|
||||
session_id="redis-state-example"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
PraisonAI A2A Server Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Agent-Centric Autonomy Example.
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
AutoAgents Workflow Patterns Example
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Context Agent Example - Basic Usage
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Math Agent Example
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ def example_auto_agents_multi_provider():
|
||||
|
||||
# After agents are created, upgrade them to multi-model agents
|
||||
multi_model_agents = []
|
||||
wrapper_by_original = {}
|
||||
for agent in auto_agents.agents:
|
||||
# Convert regular agents to multi-model agents
|
||||
multi_agent = RouterAgent(
|
||||
@@ -155,9 +156,18 @@ def example_auto_agents_multi_provider():
|
||||
models=["gpt-4o-mini", "gemini/gemini-1.5-flash", "claude-3-haiku-20240307", "gpt-4o-mini"],
|
||||
routing_strategy="auto")
|
||||
multi_model_agents.append(multi_agent)
|
||||
wrapper_by_original[id(agent)] = multi_agent
|
||||
|
||||
# Update the agents in the AutoAgents instance
|
||||
auto_agents.agents = multi_model_agents
|
||||
|
||||
# Rebind each task's agent to its wrapper — AutoAgents stores a direct agent
|
||||
# reference on every Task and execution reads task.agent, so replacing only
|
||||
# auto_agents.agents would leave the workflow bound to the original agents.
|
||||
for task in getattr(auto_agents, "tasks", []) or []:
|
||||
wrapper = wrapper_by_original.get(id(task.agent))
|
||||
if wrapper is not None:
|
||||
task.agent = wrapper
|
||||
|
||||
# Run the auto-generated workflow
|
||||
results = auto_agents.start()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
qa_agent = Agent(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, AgentTeam, Tools
|
||||
|
||||
research_agent = Agent(name="Research", instructions="You are a research agent to search internet about AI 2024", tools=[Tools.internet_search])
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, AgentTeam, Tools
|
||||
|
||||
research_agent = Agent(name="Research", instructions="You are a research agent to search internet about AI 2024", tools=[Tools.internet_search])
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Secondary Market Research FastAPI Application
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, MCP
|
||||
|
||||
search_agent = Agent(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, AgentTeam
|
||||
from duckduckgo_search import DDGS
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@ from praisonaiagents import Agent
|
||||
|
||||
if __name__ == "__main__":
|
||||
agent = Agent(name="TweetAgent", instructions="Create a Tweet based on the topic provided")
|
||||
agent.launch(port=8080, protocol="mcp", path="/mcp")
|
||||
agent.launch(port=8080, protocol="mcp", path="/")
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import AudioAgent
|
||||
|
||||
# Text to Speech
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import AudioAgent
|
||||
|
||||
agent = AudioAgent(llm="openai/tts-1-hd")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
# Text-to-Speech with OpenAI
|
||||
# Requires: export OPENAI_API_KEY=your-key
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import AudioAgent
|
||||
|
||||
agent = AudioAgent(llm="elevenlabs/eleven_multilingual_v2")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import AudioAgent
|
||||
|
||||
agent = AudioAgent(llm="gemini/gemini-2.5-flash-preview-tts")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import AudioAgent
|
||||
|
||||
agent = AudioAgent(llm="openai/tts-1")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Bot Commands Example — Built-in /status, /new, /help commands.
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Bot Gateway Example — Run multiple bots from one gateway server.
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ async def demo_with_run_control():
|
||||
|
||||
from praisonai.bots._run_control import SessionRunControl
|
||||
from praisonai.bots._session import BotSessionManager
|
||||
from praisonai.bots._commands import handle_stop_command_async
|
||||
from praisonai.bots._commands import handle_stop_command
|
||||
|
||||
# Session manager with run control
|
||||
run_control = SessionRunControl(
|
||||
@@ -136,7 +136,7 @@ async def demo_with_run_control():
|
||||
print("\n3. User decides to stop current task:")
|
||||
print(" User: '/stop'")
|
||||
|
||||
stop_response = await handle_stop_command_async(user_id, run_control)
|
||||
stop_response = await handle_stop_command(user_id, run_control)
|
||||
print(f" Bot: {stop_response}")
|
||||
|
||||
# Wait for first task to complete (it should be cancelled)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Standalone gateway example (praisonai-bot first).
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""HTTP Approval — serve a local web dashboard for tool approvals."""
|
||||
|
||||
from praisonaiagents import Agent
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Basic Camera Integration Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Continuous Camera Monitoring Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Multi-Agent Camera Analysis Example
|
||||
|
||||
|
||||
@@ -46,6 +46,6 @@ custom_cmd = SlashCommand(
|
||||
alt_names=["mc"]
|
||||
)
|
||||
|
||||
handler.register_command(custom_cmd)
|
||||
handler.register(custom_cmd)
|
||||
result = handler.execute("/mycommand arg1 arg2")
|
||||
print(f"\n=== Custom Command ===\n{result.get('message', '')}")
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Claude Code CLI Integration Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Codex CLI Integration Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Cursor CLI Integration Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
External Agents Integration Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Gemini CLI Integration Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
CSV Processing with PraisonAI Agents
|
||||
|
||||
|
||||
@@ -10,18 +10,6 @@ import os
|
||||
from praisonaiagents import Agent
|
||||
from praisonaiagents.knowledge import Knowledge
|
||||
|
||||
|
||||
def _result_items(results):
|
||||
items = results.results if hasattr(results, "results") else results
|
||||
return list(items)[:3]
|
||||
|
||||
|
||||
def _result_text(result):
|
||||
if isinstance(result, dict):
|
||||
return result.get("memory", result.get("text", str(result)))
|
||||
return getattr(result, "text", None) or getattr(result, "memory", None) or str(result)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Demonstrates knowledge search with and without reranking.
|
||||
@@ -94,9 +82,9 @@ def main():
|
||||
basic_results = basic_knowledge.search(query, rerank=False)
|
||||
print(f"Query: {query}")
|
||||
print(f"Results (limit=3):")
|
||||
for i, result in enumerate(_result_items(basic_results)):
|
||||
text = _result_text(result)
|
||||
score = result.get('score', 'N/A') if isinstance(result, dict) else getattr(result, 'score', 'N/A')
|
||||
for i, result in enumerate(basic_results[:3]):
|
||||
text = result.get('memory', result.get('text', str(result)))
|
||||
score = result.get('score', 'N/A')
|
||||
print(f" {i+1}. Score: {score}")
|
||||
print(f" Text: {text[:100]}...")
|
||||
print()
|
||||
@@ -106,9 +94,9 @@ def main():
|
||||
rerank_results = basic_knowledge.search(query, rerank=True)
|
||||
print(f"Query: {query}")
|
||||
print(f"Results (limit=3):")
|
||||
for i, result in enumerate(_result_items(rerank_results)):
|
||||
text = _result_text(result)
|
||||
score = result.get('score', 'N/A') if isinstance(result, dict) else getattr(result, 'score', 'N/A')
|
||||
for i, result in enumerate(rerank_results[:3]):
|
||||
text = result.get('memory', result.get('text', str(result)))
|
||||
score = result.get('score', 'N/A')
|
||||
print(f" {i+1}. Score: {score}")
|
||||
print(f" Text: {text[:100]}...")
|
||||
print()
|
||||
@@ -118,9 +106,9 @@ def main():
|
||||
default_results = rerank_knowledge.search(query) # Will use default_rerank=True
|
||||
print(f"Query: {query}")
|
||||
print(f"Results (limit=3):")
|
||||
for i, result in enumerate(_result_items(default_results)):
|
||||
text = _result_text(result)
|
||||
score = result.get('score', 'N/A') if isinstance(result, dict) else getattr(result, 'score', 'N/A')
|
||||
for i, result in enumerate(default_results[:3]):
|
||||
text = result.get('memory', result.get('text', str(result)))
|
||||
score = result.get('score', 'N/A')
|
||||
print(f" {i+1}. Score: {score}")
|
||||
print(f" Text: {text[:100]}...")
|
||||
print()
|
||||
@@ -137,9 +125,9 @@ def main():
|
||||
)
|
||||
print(f"Query: {query}")
|
||||
print(f"Advanced results with keyword_search=True, filter_memories=True:")
|
||||
for i, result in enumerate(_result_items(advanced_results)):
|
||||
text = _result_text(result)
|
||||
score = result.get('score', 'N/A') if isinstance(result, dict) else getattr(result, 'score', 'N/A')
|
||||
for i, result in enumerate(advanced_results[:3]):
|
||||
text = result.get('memory', result.get('text', str(result)))
|
||||
score = result.get('score', 'N/A')
|
||||
print(f" {i+1}. Score: {score}")
|
||||
print(f" Text: {text[:100]}...")
|
||||
print()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Reasoning Extraction Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, Task, AgentTeam
|
||||
|
||||
agent = Agent(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Routing Patterns Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Self-Reflection Details Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Simple CSV URL Processor
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Example: Using Latency Tracking Tool with PraisonAI
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
MCP Server with Latency Tracking Example
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Minimal Example: Latency Tracking for MCP Server
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Model Failover Example - Automatic Provider Switching
|
||||
|
||||
@@ -44,8 +43,9 @@ failover_config = FailoverConfig(
|
||||
retry_delay=1.0,
|
||||
exponential_backoff=True,
|
||||
max_retry_delay=60.0,
|
||||
cooldown_on_rate_limit=60.0,
|
||||
cooldown_on_error=30.0,
|
||||
failover_on_rate_limit=True,
|
||||
failover_on_timeout=True,
|
||||
failover_on_error=True,
|
||||
)
|
||||
|
||||
# Create failover manager
|
||||
@@ -62,11 +62,11 @@ def demonstrate_failover():
|
||||
|
||||
# Get current status
|
||||
status = manager.status()
|
||||
for profile_info in status.get("profiles", []):
|
||||
print(f" {profile_info.get('name', 'unknown')}:")
|
||||
print(f" Status: {profile_info.get('status', 'unknown')}")
|
||||
print(f" Priority: {profile_info.get('priority', 'N/A')}")
|
||||
print(f" Last error: {profile_info.get('last_error') or 'none'}")
|
||||
for name, info in status.items():
|
||||
print(f" {name}:")
|
||||
print(f" Status: {info.get('status', 'unknown')}")
|
||||
print(f" Priority: {info.get('priority', 'N/A')}")
|
||||
print(f" Failures: {info.get('failure_count', 0)}")
|
||||
print()
|
||||
|
||||
# Get next available profile
|
||||
@@ -163,7 +163,7 @@ if __name__ == "__main__":
|
||||
print(f" {profile.name}:")
|
||||
print(f" Provider: {profile.provider}")
|
||||
print(f" Priority: {profile.priority}")
|
||||
print(f" Rate limit: {profile.rate_limit_rpm} req/min")
|
||||
print(f" Rate limit: {profile.rate_limit} req/min")
|
||||
print()
|
||||
|
||||
demonstrate_failover()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Advanced Callback Systems Example
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
import asyncio
|
||||
import time
|
||||
from typing import List, Dict
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
import asyncio
|
||||
import time
|
||||
from typing import List, Dict
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
import asyncio
|
||||
import time
|
||||
from typing import List, Dict
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, Task, AgentTeam
|
||||
import json
|
||||
from e2b_code_interpreter import Sandbox
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import (
|
||||
Agent,
|
||||
Task,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, Task, AgentTeam
|
||||
from typing import List, Dict, Union
|
||||
from duckduckgo_search import DDGS
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, Task, AgentTeam, error_logs
|
||||
from duckduckgo_search import DDGS
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, Task, AgentTeam
|
||||
from langchain_community.tools import YouTubeSearchTool
|
||||
from langchain_community.utilities import WikipediaAPIWrapper
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, Task, AgentTeam
|
||||
from datetime import datetime
|
||||
import asyncio
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent
|
||||
from pydantic import BaseModel
|
||||
from typing import List, Optional
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, Task, AgentTeam
|
||||
from praisonaiagents.tools import get_article, get_news_sources, get_articles_from_source, get_trending_topics
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import Agent, Task, AgentTeam
|
||||
from typing import List, Dict
|
||||
from duckduckgo_search import DDGS
|
||||
|
||||
@@ -12,7 +12,8 @@ Features demonstrated:
|
||||
- Quality assurance workflows
|
||||
"""
|
||||
|
||||
from praisonaiagents import Agent, Task, AgentTeam, TaskOutput
|
||||
from praisonaiagents import Agent, Task, AgentTeam
|
||||
from praisonaiagents.task import TaskOutput
|
||||
from typing import Tuple, Any
|
||||
import re
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Production Guardrails Patterns Example
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ billing_agent = Agent(
|
||||
role="Billing Specialist",
|
||||
goal="Handle all billing-related inquiries and tasks using structured data",
|
||||
backstory="I am an expert in billing systems, payment processing, and invoice management.",
|
||||
input_payload_schema=BillingPayload # hypothetical but consistent with design
|
||||
)
|
||||
|
||||
refund_agent = Agent(
|
||||
@@ -38,6 +39,7 @@ refund_agent = Agent(
|
||||
role="Refund Specialist",
|
||||
goal="Process refund requests and handle refund-related issues with validated data",
|
||||
backstory="I specialize in processing refunds, evaluating refund eligibility, and ensuring customer satisfaction.",
|
||||
input_payload_schema=RefundPayload
|
||||
)
|
||||
|
||||
technical_support_agent = Agent(
|
||||
@@ -45,6 +47,7 @@ technical_support_agent = Agent(
|
||||
role="Technical Support Specialist",
|
||||
goal="Resolve technical issues and provide technical assistance with structured context",
|
||||
backstory="I am skilled in troubleshooting technical problems and providing solutions.",
|
||||
input_payload_schema=TechnicalPayload
|
||||
)
|
||||
|
||||
# Create a triage agent with typed handoffs
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
"""
|
||||
Unified Handoff Configuration Example.
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
from praisonaiagents import ImageAgent
|
||||
|
||||
agent = ImageAgent(llm="openai/dall-e-3", style="vivid")
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# praisonai: skip=true
|
||||
# Image Generation with DALL-E
|
||||
# Requires: export OPENAI_API_KEY=your-key
|
||||
|
||||
|
||||
Loaded 100 of 276 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user