Skip to content

Commit

Permalink
Merge pull request #223 from MervinPraison/develop
Browse files Browse the repository at this point in the history
Documentation update
  • Loading branch information
MervinPraison authored Dec 27, 2024
2 parents 7ae3f3c + 07ff41d commit 48ebfeb
Show file tree
Hide file tree
Showing 58 changed files with 532 additions and 56 deletions.
5 changes: 4 additions & 1 deletion docs/api.md → docs/api.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# API Reference
---
title: "API Reference"
description: "Complete API reference for PraisonAI, including core modules, installation options, and framework-specific features"
---

## Core Modules

Expand Down
17 changes: 14 additions & 3 deletions docs/auto.md → docs/auto.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# Auto Generation Mode
---
title: "Auto Generation Mode"
description: "Guide to PraisonAI's automatic agent generation feature, supporting both CrewAI and AutoGen frameworks for automated task execution"
---

PraisonAI supports automatic agent generation with both CrewAI and AutoGen frameworks.
PraisonAI supports automatic agent generation with PraisonAI Agents, CrewAI and AutoGen frameworks.

## Installation

Choose your preferred framework:

```bash
# For PraisonAI Agents
pip install praisonai

# For CrewAI
pip install "praisonai[crewai]"

Expand All @@ -19,11 +25,16 @@ pip install "praisonai[crewai,autogen]"

## Usage

### With CrewAI (Default)
### With PraisonAI Agents
```bash
praisonai --auto "create a movie script about Dog in Moon"
```

### With CrewAI
```bash
praisonai --framework crewai --auto "create a movie script about Dog in Moon"
```

### With AutoGen
```bash
praisonai --framework autogen --auto "create a movie script about Dog in Moon"
Expand Down
5 changes: 4 additions & 1 deletion docs/call.md → docs/call.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# PraisonAI Call
---
title: "PraisonAI Call"
description: "Guide to PraisonAI's voice-based interaction feature enabling AI customer service through phone calls, including setup and tool integration"
---

<iframe width="560" height="315" src="https://www.youtube.com/embed/m1cwrUG2iAk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Expand Down
5 changes: 4 additions & 1 deletion docs/contributing.md → docs/contributing.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Contributing
---
title: "Contributing"
description: "Guide for contributing to PraisonAI through GitHub, including forking, cloning, and submitting pull requests"
---

- Fork on GitHub: Use the "Fork" button on the repository page.
- Clone your fork: `git clone https://github.com/yourusername/praisonAI.git`
Expand Down
5 changes: 4 additions & 1 deletion docs/deploy.md → docs/deploy.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Deploy
---
title: "Deploy"
description: "Guide for deploying PraisonAI to cloud platforms, with detailed instructions for Google Cloud deployment"
---

## Google Cloud

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Agents Playbook"
description: "Examples and templates for creating PraisonAI agent playbooks, from simple to detailed configurations with multiple roles and tasks"
---

# Agents Playbook

## Simple Playbook Example
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
title: "Google Colab Tools"
description: "Guide for implementing and using custom tools in PraisonAI with Google Colab, including examples of internet search and data processing tools"
---

```
jupyter:
accelerator: GPU
colab:
Expand All @@ -10,7 +15,7 @@ jupyter:
name: python
nbformat: 4
nbformat_minor: 0
---
```

``` python
!pip install -Uq praisonai duckduckgo_search
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
title: "Google Colab Integration"
description: "Guide for using PraisonAI in Google Colab environments, with example code and configurations for agent-based tasks"
---

```
jupyter:
accelerator: GPU
colab:
Expand All @@ -10,7 +15,7 @@ jupyter:
name: python
nbformat: 4
nbformat_minor: 0
---
```


``` python
Expand Down
5 changes: 0 additions & 5 deletions docs/developers/test.md

This file was deleted.

10 changes: 10 additions & 0 deletions docs/developers/test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Test"
description: "Instructions for running and writing tests for PraisonAI components, including unit tests and test automation"
---

# Test

```bash
python -m unittest tests.test
```
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Integrate with Tools"
description: "Guide for integrating external tools and APIs with PraisonAI, including examples of custom tool creation and implementation"
---

# Integrate with Tools

```python
Expand Down
5 changes: 5 additions & 0 deletions docs/developers/wrapper.md → docs/developers/wrapper.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "PraisonAI Package Integration"
description: "Guide for integrating the PraisonAI package into your Python projects, including YAML configuration and different execution modes"
---

# Include praisonai package in your project

## Option 1: Using RAW YAML
Expand Down
5 changes: 5 additions & 0 deletions docs/firecrawl.md → docs/firecrawl.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "Firecrawl PraisonAI Integration"
description: "Guide for integrating Firecrawl web scraping capabilities with PraisonAI, including custom tool implementation for web page content extraction"
---

# Firecrawl PraisonAI Integration

<iframe width="560" height="315" src="https://www.youtube.com/embed/UoqUDcLcOYo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Expand Down
5 changes: 5 additions & 0 deletions docs/framework/autogen.md → docs/framework/autogen.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "AutoGen with PraisonAI"
description: "Guide for using AutoGen framework with PraisonAI, including installation, setup, and multi-agent conversation capabilities"
---

# AutoGen with PraisonAI

Low-code solution to run AutoGen with integrated tools and features.
Expand Down
5 changes: 5 additions & 0 deletions docs/framework/crewai.md → docs/framework/crewai.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: "CrewAI with PraisonAI"
description: "Guide for using CrewAI framework with PraisonAI, including installation, setup, and execution of agent-based tasks"
---

# CrewAI with PraisonAI

Low-code solution to run CrewAI with integrated tools and features.
Expand Down
206 changes: 206 additions & 0 deletions docs/framework/praisonaiagents.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
---
title: "PraisonAI Agents"
description: "Guide for using PraisonAI Agents framework, a lightweight package for creating and managing AI agents with advanced capabilities"
---

A lightweight package dedicated to creating and managing AI agents with advanced capabilities.

## Installation

```bash
pip install praisonaiagents
export OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxx
```

## Quick Start

Create `app.py` and add the following code:

```python
from praisonaiagents import Agent, Task, PraisonAIAgents

# Create agents
researcher = Agent(
name="Researcher",
role="Senior Research Analyst",
goal="Uncover cutting-edge developments in AI and data science",
backstory="""You are an expert at a technology research group,
skilled in identifying trends and analyzing complex data.""",
verbose=True,
llm="gpt-4o",
markdown=True
)

writer = Agent(
name="Writer",
role="Tech Content Strategist",
goal="Craft compelling content on tech advancements",
backstory="""You are a content strategist known for
making complex tech topics interesting and easy to understand.""",
llm="gpt-4o",
markdown=True
)

# Create tasks
research_task = Task(
description="Research the latest developments in AI and data science",
expected_output="A comprehensive report on recent AI trends and breakthroughs",
agent=researcher
)

writing_task = Task(
description="Create an engaging blog post about the research findings",
expected_output="A well-structured blog post explaining AI developments",
agent=writer,
context=[research_task] # This task depends on research_task output
)

# Create and run the agents
agents = PraisonAIAgents(
agents=[researcher, writer],
tasks=[research_task, writing_task],
verbose=True
)

result = agents.start()
print(result)
```

## Agent Configuration

### Core Attributes
- `name`: Agent's identifier
- `role`: Agent's function/expertise
- `goal`: Individual objective
- `backstory`: Context and personality
- `llm`: Language model (default: OpenAI's GPT-4)
- `verbose`: Enable detailed logs (default: False)
- `markdown`: Enable markdown formatting (default: True)

### Optional Attributes
- `tools`: List of available tools
- `memory`: Enable conversation history (default: True)
- `max_iter`: Maximum iterations (default: 20)
- `max_rpm`: Rate limit for API calls
- `allow_delegation`: Enable task delegation (default: False)

## Task Configuration

### Core Attributes
- `description`: Task details
- `expected_output`: Desired outcome
- `agent`: Assigned agent

### Optional Attributes
- `context`: Dependencies on other tasks
- `tools`: Task-specific tools
- `async_execution`: Run asynchronously (default: False)
- `output_file`: Save output to file
- `callback`: Post-task function

## Advanced Features

### Tool Integration
```python
from duckduckgo_search import DDGS

def search_tool(query: str) -> list:
"""
Perform a web search using DuckDuckGo and return relevant results.
Args:
query (str): The search query string to look up information about.
Returns:
list: A list of dictionaries containing search results with the following keys:
- title (str): The title of the search result
- url (str): The URL of the search result
- snippet (str): A brief excerpt or description of the search result
"""
results = []
ddgs = DDGS()
for result in ddgs.text(keywords=query, max_results=10):
results.append({
"title": result.get("title", ""),
"url": result.get("href", ""),
"snippet": result.get("body", ""),
})
return results

agent = Agent(
name="Researcher",
tools=[search_tool]
)
```

### Custom Callbacks
```python
def task_completed(output):
print(f"Task completed: {output.description}")
print(f"Output: {output.raw}")

task = Task(
description="Analysis task",
callback=task_completed
)
```

## Error Handling

The framework includes built-in error handling for:
- API rate limits
- Token limits
- Task timeouts
- Tool execution failures

## Best Practices

1. **Agent Design**
- Give clear, specific roles and goals
- Provide detailed backstories
- Use appropriate tools for tasks

2. **Task Management**
- Break complex tasks into subtasks
- Set clear dependencies
- Use async execution for independent tasks

3. **Resource Optimization**
- Enable caching when appropriate
- Set reasonable max_iter limits
- Use rate limiting for API calls

4. **Error Handling**
- Implement task callbacks
- Set appropriate timeouts
- Monitor execution logs

### Parallel Execution (Upcoming)
```python
task1 = Task(
description="Research task 1",
async_execution=True
)

task2 = Task(
description="Research task 2",
async_execution=True
)

final_task = Task(
description="Compile results",
context=[task1, task2] # Waits for both tasks
)
```

### Memory Management (Upcoming)
```python
agent = Agent(
name="Analyst",
memory=True, # Enable memory
memory_config={
"type": "short_term",
"max_tokens": 4000
}
)
```
Loading

0 comments on commit 48ebfeb

Please sign in to comment.