Skip to content

Commit

Permalink
Merge pull request #72 from awslabs/improve-doc-with-code-samples
Browse files Browse the repository at this point in the history
refatoring docs & add cookbook section
  • Loading branch information
brnaba-aws authored Oct 23, 2024
2 parents 2c3d153 + 0b9127a commit 6241957
Show file tree
Hide file tree
Showing 24 changed files with 755 additions and 383 deletions.
87 changes: 53 additions & 34 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ export default defineConfig({
]
},
{ label: 'Custom Classifier', link: '/classifiers/custom-classifier' },
{
label: 'Examples',
items: [
{ label: 'Ollama Classifier', link: '/classifiers/examples/ollama-classifier'},
]
},

]
},
{
Expand All @@ -77,13 +72,7 @@ export default defineConfig({
]
},
{ label: 'Custom Agents', link: '/agents/custom-agents' },
{
label: 'Examples',
items: [
{ label: 'Ollama Agent', link: '/agents/examples/ollama-agent'},
{ label: 'Api Agent', link: '/agents/examples/api-agent'},
]
},

]
},
{
Expand Down Expand Up @@ -114,29 +103,59 @@ export default defineConfig({
]
},
{
label: 'Advanced Features',
items: [
{ label: 'Agent Overlap Analysis', link: '/advanced-features/agent-overlap' },
{ label: 'Create a Weather Agent using Tools', link: '/advanced-features/weather-tool-use' },
{ label: 'Create a Math Agent using Tools', link: '/advanced-features/math-tool-use' },
{ label: 'Logging', link: '/advanced-features/logging' },
]
},
{
label: 'Deployment',
label: 'Cookbook',
items: [
{ label: 'Local Development', link: '/deployment/local' },
{ label: 'AWS Lambda Typescript', link: '/deployment/aws-lambda-ts' },
{ label: 'AWS Lambda Python', link: '/deployment/aws-lambda-py' },
{ label: 'Demo Web App', link: '/deployment/demo-web-app' },
{
label: 'Getting Started',
items: [
{ label: 'Overview', link: '/cookbook/overview' },
{ label: 'Local Development', link: '/cookbook/getting-started/local-development' }
]
},
{
label: 'Examples',
items: [
{ label: 'Chat Chainlit App', link: '/cookbook/examples/chat-chainlit-app' },
{ label: 'Chat Demo App', link: '/cookbook/examples/chat-demo-app' },
{ label: 'E-commerce Support Simulator', link: '/cookbook/examples/ecommerce-support-simulator' },
{ label: 'Fast API Streaming', link: '/cookbook/examples/fast-api-streaming' },
{ label: 'Typescript Local Demo', link: '/cookbook/examples/typescript-local-demo' },
{ label: 'Python Local Demo', link: '/cookbook/examples/python-local-demo' },
{ label: 'Api Agent', link: '/cookbook/examples/api-agent' },
{ label: 'Ollama Agent', link: '/cookbook/examples/ollama-agent' },
{ label: 'Ollama Classifier', link: '/cookbook/examples/ollama-classifier' }
]
},
{
label: 'Lambda Implementations',
items: [
{ label: 'Python Lambda', link: '/cookbook/lambda/aws-lambda-python' },
{ label: 'NodeJs Lambda', link: '/cookbook/lambda/aws-lambda-nodejs' }
]
},
{
label: 'Tool Integration',
items: [
{ label: 'Weather API Integration', link: '/cookbook/tools/weather-api' },
{ label: 'Math Operations', link: '/cookbook/tools/math-operations' }
]
},
{
label: 'Routing Patterns',
items: [
{ label: 'Cost-Efficient Routing', link: '/cookbook/patterns/cost-efficient' },
{ label: 'Multi-lingual Routing', link: '/cookbook/patterns/multi-lingual' }
]
},
{
label: 'Optimization & Monitoring',
items: [
{ label: 'Agent Overlap Analysis', link: '/cookbook/monitoring/agent-overlap' },
{ label: 'Logging and Monitoring', link: '/cookbook/monitoring/logging' }
]
}
]
},
{
label: 'Use cases',
items: [
{ label: 'Use case examples', link: '/use-cases/use-cases' },
]
},
}
]
})
]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/ai_e-commerce_support_system.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/chat_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/public/email_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions docs/src/content/docs/cookbook/examples/chat-chainlit-app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Chat Chainlit App with Multi-Agent Orchestrator
description: How to set up a Chainlit App using Multi-Agent Orchestrator
---

This example demonstrates how to build a chat application using Chainlit and the Multi-Agent Orchestrator. It showcases a system with three specialized agents (Tech, Travel, and Health) working together through a streaming-enabled chat interface.

## Key Features
- Streaming responses using Chainlit's real-time capabilities
- Integration with multiple agent types (Bedrock and Ollama)
- Custom classifier configuration using Claude 3 Haiku
- Session management for user interactions
- Complete chat history handling

## Quick Start
```bash
# Clone the repository
git clone https://github.com/awslabs/multi-agent-orchestrator.git
cd multi-agent-orchestrator/examples/chat-chainlit-app

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py
```

## Implementation Details

### Components
1. **Main Application** (`app.py`)
- Orchestrator setup with custom Bedrock classifier
- Chainlit event handlers for chat management
- Streaming response handling

2. **Agent Configuration** (`agents.py`)
- Tech Agent: Uses Claude 3 Sonnet via Bedrock
- Travel Agent: Uses Claude 3 Sonnet via Bedrock
- Health Agent: Uses Ollama with Llama 3.1

3. **Custom Integration** (`ollamaAgent.py`)
- Custom implementation for Ollama integration
- Streaming support for real-time responses

## Usage Notes
- The application creates unique user and session IDs for each chat session
- Responses are streamed in real-time using Chainlit's streaming capabilities
- The system automatically routes queries to the most appropriate agent
- Complete chat history is maintained throughout the session

## Example Interaction
```plaintext
User: "What are the latest trends in AI?"
→ Routed to Tech Agent
User: "Plan a trip to Paris"
→ Routed to Travel Agent
User: "Recommend a workout routine"
→ Routed to Health Agent
```

Ready to build your own multi-agent chat application? Check out the complete [source code]() in our GitHub repository.
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,6 @@ By deploying this demo web app, you can interact with your Multi-Agent Orchestra
## ⚠️ Disclamer
This demo application is intended solely for demonstration purposes. It is not designed for handling, storing, or processing any kind of Personally Identifiable Information (PII) or personal data. Users are strongly advised not to enter, upload, or use any PII or personal data within this application. Any use of PII or personal data is at the user's own risk and the developers of this application shall not be held responsible for any data breaches, misuse, or any other related issues. Please ensure that all data used in this demo is non-sensitive and anonymized.

For production usage, it is crucial to implement proper security measures to protect PII and personal data. This includes obtaining proper permissions from users, utilizing encryption for data both in transit and at rest, and adhering to industry standards and regulations to maximize security. Failure to do so may result in data breaches and other serious security issues.
For production usage, it is crucial to implement proper security measures to protect PII and personal data. This includes obtaining proper permissions from users, utilizing encryption for data both in transit and at rest, and adhering to industry standards and regulations to maximize security. Failure to do so may result in data breaches and other serious security issues.

Ready to build your own multi-agent chat application? Check out the complete [source code](https://github.com/awslabs/multi-agent-orchestrator/tree/main/examples/chat-demo-app) in our GitHub repository.
Loading

0 comments on commit 6241957

Please sign in to comment.