Skip to content

Commit b9cecc0

Browse files
committed
Release v2.5.1
1 parent c49ad94 commit b9cecc0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+9115
-80
lines changed

README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ npm install praisonai
204204
| ↳ Add Custom Knowledge | [Example](examples/python/concepts/knowledge-agents.py) | [📖](https://docs.praison.ai/features/knowledge) |
205205
| ↳ RAG Agents | [Example](examples/python/concepts/rag-agents.py) | [📖](https://docs.praison.ai/features/rag) |
206206
| ↳ Chat with PDF Agents | [Example](examples/python/concepts/chat-with-pdf.py) | [📖](https://docs.praison.ai/features/chat-with-pdf) |
207+
| ↳ Data Readers (PDF, DOCX, etc.) | [CLI](#knowledge-cli) | [📖](https://docs.praison.ai/api/praisonai/knowledge-readers-api) |
208+
| ↳ Vector Store Selection | [CLI](#knowledge-cli) | [📖](https://docs.praison.ai/api/praisonai/knowledge-vector-store-api) |
209+
| ↳ Retrieval Strategies | [CLI](#knowledge-cli) | [📖](https://docs.praison.ai/api/praisonai/knowledge-retrieval-api) |
210+
| ↳ Rerankers | [CLI](#knowledge-cli) | [📖](https://docs.praison.ai/api/praisonai/knowledge-reranker-api) |
211+
| ↳ Index Types (Vector/Keyword/Hybrid) | [CLI](#knowledge-cli) | [📖](https://docs.praison.ai/api/praisonai/knowledge-index-api) |
212+
| ↳ Query Engines (Sub-Question, etc.) | [CLI](#knowledge-cli) | [📖](https://docs.praison.ai/api/praisonai/knowledge-query-engine-api) |
207213
| **🔬 Research & Intelligence** | | |
208214
| ↳ Deep Research Agents | [Example](examples/python/agents/research-agent.py) | [📖](https://docs.praison.ai/agents/deep-research) |
209215
| ↳ Query Rewriter Agent | [Example](#5-query-rewriter-agent) | [📖](https://docs.praison.ai/agents/query-rewriter) |
@@ -2641,6 +2647,84 @@ PraisonAI provides zero-dependency persistent memory for agents. For detailed ex
26412647

26422648
---
26432649

2650+
## 📚 Knowledge & Retrieval (RAG)
2651+
2652+
PraisonAI provides a complete knowledge stack for building RAG applications with multiple vector stores, retrieval strategies, rerankers, and query modes.
2653+
2654+
### Knowledge CLI Commands
2655+
2656+
| Command | Description |
2657+
|---------|-------------|
2658+
| `praisonai knowledge add <file\|dir\|url>` | Add documents to knowledge base |
2659+
| `praisonai knowledge query <question>` | Query knowledge base with RAG |
2660+
| `praisonai knowledge list` | List indexed documents |
2661+
| `praisonai knowledge clear` | Clear knowledge base |
2662+
| `praisonai knowledge stats` | Show knowledge base statistics |
2663+
2664+
### Knowledge CLI Options
2665+
2666+
| Option | Values | Description |
2667+
|--------|--------|-------------|
2668+
| `--vector-store` | `memory`, `chroma`, `pinecone`, `qdrant`, `weaviate` | Vector store backend |
2669+
| `--retrieval` | `basic`, `fusion`, `recursive`, `auto_merge` | Retrieval strategy |
2670+
| `--reranker` | `simple`, `llm`, `cross_encoder`, `cohere` | Reranking method |
2671+
| `--index-type` | `vector`, `keyword`, `hybrid` | Index type |
2672+
| `--query-mode` | `default`, `sub_question`, `summarize` | Query mode |
2673+
2674+
### Knowledge CLI Examples
2675+
2676+
```bash
2677+
# Add documents
2678+
praisonai knowledge add ./docs/
2679+
praisonai knowledge add https://example.com/page.html
2680+
praisonai knowledge add "*.pdf"
2681+
2682+
# Query with advanced options
2683+
praisonai knowledge query "How to authenticate?" --retrieval fusion --reranker llm
2684+
2685+
# Full advanced query
2686+
praisonai knowledge query "authentication flow" \
2687+
--vector-store chroma \
2688+
--retrieval fusion \
2689+
--reranker llm \
2690+
--index-type hybrid \
2691+
--query-mode sub_question
2692+
```
2693+
2694+
### Knowledge SDK Usage
2695+
2696+
```python
2697+
from praisonaiagents import Agent, Knowledge
2698+
2699+
# Simple usage with Agent
2700+
agent = Agent(
2701+
name="Research Assistant",
2702+
knowledge=["docs/manual.pdf", "data/faq.txt"],
2703+
knowledge_config={
2704+
"vector_store": {"provider": "chroma"}
2705+
}
2706+
)
2707+
response = agent.chat("How do I authenticate?")
2708+
2709+
# Direct Knowledge usage
2710+
knowledge = Knowledge()
2711+
knowledge.add("document.pdf")
2712+
results = knowledge.search("authentication", limit=5)
2713+
```
2714+
2715+
### Knowledge Stack Features Table
2716+
2717+
| Feature | Description | SDK Docs | CLI Docs |
2718+
|---------|-------------|----------|----------|
2719+
| **Data Readers** | Load PDF, Markdown, Text, HTML, URLs | [SDK](/docs/sdk/praisonaiagents/knowledge/protocols) | [CLI](/docs/cli/knowledge) |
2720+
| **Vector Stores** | ChromaDB, Pinecone, Qdrant, Weaviate, In-Memory | [SDK](/docs/sdk/praisonaiagents/knowledge/protocols) | [CLI](/docs/cli/knowledge) |
2721+
| **Retrieval Strategies** | Basic, Fusion (RRF), Recursive, Auto-Merge | [SDK](/docs/sdk/praisonaiagents/knowledge/protocols) | [CLI](/docs/cli/knowledge) |
2722+
| **Rerankers** | Simple, LLM, Cross-Encoder, Cohere | [SDK](/docs/sdk/praisonaiagents/knowledge/protocols) | [CLI](/docs/cli/knowledge) |
2723+
| **Index Types** | Vector, Keyword (BM25), Hybrid | [SDK](/docs/sdk/praisonaiagents/knowledge/protocols) | [CLI](/docs/cli/knowledge) |
2724+
| **Query Engines** | Default, Sub-Question, Summarize | [SDK](/docs/sdk/praisonaiagents/knowledge/protocols) | [CLI](/docs/cli/knowledge) |
2725+
2726+
---
2727+
26442728
## 🔬 Advanced Features
26452729

26462730
### Research & Intelligence
@@ -2755,6 +2839,44 @@ agent.chat("Hello!") # Auto-persists messages, runs, traces
27552839
| `praisonai persistence migrate` | Apply schema migrations |
27562840
| `praisonai persistence status` | Show schema status |
27572841

2842+
### Knowledge CLI Commands {#knowledge-cli}
2843+
2844+
| Command | Description |
2845+
|---------|-------------|
2846+
| `praisonai knowledge add <source>` | Add file, directory, URL, or glob pattern |
2847+
| `praisonai knowledge query "<question>"` | Query knowledge base with RAG |
2848+
| `praisonai knowledge list` | List indexed documents |
2849+
| `praisonai knowledge clear` | Clear knowledge base |
2850+
| `praisonai knowledge stats` | Show knowledge base statistics |
2851+
2852+
**Knowledge Query Flags:**
2853+
2854+
| Flag | Values | Default |
2855+
|------|--------|---------|
2856+
| `--vector-store` | `memory`, `chroma`, `pinecone`, `qdrant`, `weaviate` | `chroma` |
2857+
| `--retrieval-strategy` | `basic`, `fusion`, `recursive`, `auto_merge` | `basic` |
2858+
| `--reranker` | `none`, `simple`, `llm`, `cross_encoder`, `cohere` | `none` |
2859+
| `--index-type` | `vector`, `keyword`, `hybrid` | `vector` |
2860+
| `--query-mode` | `default`, `sub_question`, `summarize` | `default` |
2861+
| `--workspace` | Path to workspace directory | Current dir |
2862+
| `--session` | Session ID for persistence | - |
2863+
2864+
**Examples:**
2865+
2866+
```bash
2867+
# Add documents
2868+
praisonai knowledge add document.pdf
2869+
praisonai knowledge add ./docs/
2870+
praisonai knowledge add "*.md"
2871+
2872+
# Query with options
2873+
praisonai knowledge query "How to authenticate?" \
2874+
--vector-store chroma \
2875+
--retrieval-strategy fusion \
2876+
--reranker simple \
2877+
--query-mode sub_question
2878+
```
2879+
27582880
### Databases Table
27592881

27602882
| Database | Store Type | Install | Example | Docs |

docker/Dockerfile.chat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
1616
# Install Python packages (using latest versions)
1717
RUN pip install --no-cache-dir \
1818
praisonai_tools \
19-
"praisonai>=2.5.0" \
19+
"praisonai>=2.5.1" \
2020
"praisonai[chat]" \
2121
"embedchain[github,youtube]"
2222

docker/Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN mkdir -p /root/.praison
2020
# Install Python packages (using latest versions)
2121
RUN pip install --no-cache-dir \
2222
praisonai_tools \
23-
"praisonai>=2.5.0" \
23+
"praisonai>=2.5.1" \
2424
"praisonai[ui]" \
2525
"praisonai[chat]" \
2626
"praisonai[realtime]" \

docker/Dockerfile.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
1616
# Install Python packages (using latest versions)
1717
RUN pip install --no-cache-dir \
1818
praisonai_tools \
19-
"praisonai>=2.5.0" \
19+
"praisonai>=2.5.1" \
2020
"praisonai[ui]" \
2121
"praisonai[crewai]"
2222

examples/async_runs/README.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""
2+
Async Runs Examples
3+
===================
4+
5+
This directory contains examples for the PraisonAI Async Jobs API.
6+
7+
Examples:
8+
---------
9+
1. sdk_submit_poll_result.py - Python SDK example for submit/poll/result
10+
2. cli_submit_poll_result.sh - Bash/curl example for submit/poll/result
11+
3. idempotency.sh - Demonstrates idempotency key usage
12+
4. cancel.sh - Demonstrates job cancellation
13+
5. sse_stream.sh - Demonstrates SSE streaming
14+
15+
Prerequisites:
16+
--------------
17+
1. Set OPENAI_API_KEY environment variable
18+
2. Start the jobs server:
19+
20+
cd /path/to/praisonai-package/src/praisonai
21+
python -m uvicorn praisonai.jobs.server:create_app --port 8005 --factory
22+
23+
3. Run examples:
24+
25+
python sdk_submit_poll_result.py
26+
bash cli_submit_poll_result.sh
27+
bash idempotency.sh
28+
bash cancel.sh
29+
bash sse_stream.sh
30+
31+
Environment Variables:
32+
----------------------
33+
- OPENAI_API_KEY: Required for agent execution
34+
- PRAISONAI_BASE_URL: API server URL (default: http://127.0.0.1:8005)
35+
"""

examples/async_runs/cancel.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
# CLI Example: Cancel a Running Job
3+
#
4+
# This example demonstrates how to cancel a running job.
5+
#
6+
# Requirements:
7+
# - Jobs server running on http://127.0.0.1:8005
8+
#
9+
# Usage:
10+
# bash cancel.sh
11+
12+
set -e
13+
14+
API_URL="${PRAISONAI_BASE_URL:-http://127.0.0.1:8005}"
15+
16+
echo "============================================================"
17+
echo "PraisonAI Job Cancellation Example"
18+
echo "============================================================"
19+
20+
# Submit a long-running job
21+
echo ""
22+
echo "1. Submitting a job..."
23+
RESPONSE=$(curl -s -X POST "$API_URL/api/v1/runs" \
24+
-H "Content-Type: application/json" \
25+
-d '{"prompt": "Write a detailed essay about the history of computing."}')
26+
27+
JOB_ID=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
28+
echo " Job ID: $JOB_ID"
29+
30+
# Wait briefly
31+
echo ""
32+
echo "2. Waiting 1 second..."
33+
sleep 1
34+
35+
# Cancel the job
36+
echo ""
37+
echo "3. Cancelling job..."
38+
CANCEL_RESPONSE=$(curl -s -X POST "$API_URL/api/v1/runs/$JOB_ID/cancel")
39+
STATUS=$(echo "$CANCEL_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['status'])")
40+
echo " Status after cancel: $STATUS"
41+
42+
# Verify cancellation
43+
echo ""
44+
echo "4. Verification:"
45+
if [ "$STATUS" = "cancelled" ]; then
46+
echo " ✓ SUCCESS: Job was cancelled"
47+
else
48+
echo " ℹ Job status: $STATUS (may have completed before cancel)"
49+
fi
50+
51+
echo ""
52+
echo "============================================================"
53+
echo "Cancellation example completed!"
54+
echo "============================================================"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
# CLI Example: Submit, Poll, and Get Result for Async Jobs
3+
#
4+
# This example demonstrates how to use the PraisonAI CLI to:
5+
# 1. Submit an async job
6+
# 2. Check job status
7+
# 3. Get the result
8+
#
9+
# Requirements:
10+
# - OPENAI_API_KEY environment variable set
11+
# - Jobs server running on http://127.0.0.1:8005
12+
#
13+
# Usage:
14+
# bash cli_submit_poll_result.sh
15+
16+
set -e
17+
18+
API_URL="${PRAISONAI_BASE_URL:-http://127.0.0.1:8005}"
19+
20+
echo "============================================================"
21+
echo "PraisonAI Async Jobs CLI Example"
22+
echo "============================================================"
23+
24+
# Check if server is running
25+
echo ""
26+
echo "Checking server health..."
27+
if ! curl -s "$API_URL/health" > /dev/null 2>&1; then
28+
echo "✗ Server not available at $API_URL"
29+
echo " Start the server with: python -m uvicorn praisonai.jobs.server:create_app --port 8005 --factory"
30+
exit 1
31+
fi
32+
echo "✓ Server is healthy"
33+
34+
# 1. Submit a job
35+
echo ""
36+
echo "1. Submitting job..."
37+
RESPONSE=$(curl -s -X POST "$API_URL/api/v1/runs" \
38+
-H "Content-Type: application/json" \
39+
-d '{"prompt": "What is 2+2? Answer with just the number."}')
40+
41+
JOB_ID=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
42+
echo " Job ID: $JOB_ID"
43+
44+
# 2. Poll for status
45+
echo ""
46+
echo "2. Polling for status..."
47+
while true; do
48+
STATUS_RESPONSE=$(curl -s "$API_URL/api/v1/runs/$JOB_ID")
49+
STATUS=$(echo "$STATUS_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['status'])")
50+
PROGRESS=$(echo "$STATUS_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['progress']['percentage'])")
51+
52+
echo " Status: $STATUS | Progress: ${PROGRESS}%"
53+
54+
if [ "$STATUS" = "succeeded" ] || [ "$STATUS" = "failed" ] || [ "$STATUS" = "cancelled" ]; then
55+
break
56+
fi
57+
58+
sleep 2
59+
done
60+
61+
# 3. Get result
62+
echo ""
63+
echo "3. Getting result..."
64+
if [ "$STATUS" = "succeeded" ]; then
65+
RESULT=$(curl -s "$API_URL/api/v1/runs/$JOB_ID/result")
66+
echo " Result: $(echo "$RESULT" | python3 -c "import sys,json; print(json.load(sys.stdin)['result'])")"
67+
echo " Duration: $(echo "$RESULT" | python3 -c "import sys,json; print(f\"{json.load(sys.stdin)['duration_seconds']:.2f}s\")")"
68+
else
69+
echo " Job did not succeed: $STATUS"
70+
fi
71+
72+
echo ""
73+
echo "============================================================"
74+
echo "Example completed!"
75+
echo "============================================================"

examples/async_runs/idempotency.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
# CLI Example: Idempotency Key Usage
3+
#
4+
# This example demonstrates how idempotency keys prevent duplicate job submissions.
5+
# Submitting the same request with the same idempotency key returns the existing job.
6+
#
7+
# Requirements:
8+
# - Jobs server running on http://127.0.0.1:8005
9+
#
10+
# Usage:
11+
# bash idempotency.sh
12+
13+
set -e
14+
15+
API_URL="${PRAISONAI_BASE_URL:-http://127.0.0.1:8005}"
16+
IDEM_KEY="example-idem-key-$(date +%s)"
17+
18+
echo "============================================================"
19+
echo "PraisonAI Idempotency Key Example"
20+
echo "============================================================"
21+
22+
# First submission
23+
echo ""
24+
echo "1. First submission with Idempotency-Key: $IDEM_KEY"
25+
RESPONSE1=$(curl -s -X POST "$API_URL/api/v1/runs" \
26+
-H "Content-Type: application/json" \
27+
-H "Idempotency-Key: $IDEM_KEY" \
28+
-d '{"prompt": "What is 1+1?"}')
29+
30+
JOB_ID1=$(echo "$RESPONSE1" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
31+
echo " Job ID: $JOB_ID1"
32+
33+
# Second submission with same key
34+
echo ""
35+
echo "2. Second submission with SAME Idempotency-Key: $IDEM_KEY"
36+
RESPONSE2=$(curl -s -X POST "$API_URL/api/v1/runs" \
37+
-H "Content-Type: application/json" \
38+
-H "Idempotency-Key: $IDEM_KEY" \
39+
-d '{"prompt": "Different prompt but same key"}')
40+
41+
JOB_ID2=$(echo "$RESPONSE2" | python3 -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
42+
echo " Job ID: $JOB_ID2"
43+
44+
# Verify same job ID
45+
echo ""
46+
echo "3. Verification:"
47+
if [ "$JOB_ID1" = "$JOB_ID2" ]; then
48+
echo " ✓ SUCCESS: Same job ID returned (no duplicate created)"
49+
else
50+
echo " ✗ FAILURE: Different job IDs returned"
51+
exit 1
52+
fi
53+
54+
echo ""
55+
echo "============================================================"
56+
echo "Idempotency example completed!"
57+
echo "============================================================"

0 commit comments

Comments
 (0)