commit
b6715ddf90
@ -0,0 +1,231 @@
|
||||
# X402 Discovery Query Agent
|
||||
|
||||
This example demonstrates how to create a Swarms agent that can search and query services from the X402 bazaar using the Coinbase CDP API. The agent can discover available services, filter them by price, and provide summaries of the results.
|
||||
|
||||
## Overview
|
||||
|
||||
The X402 Discovery Query Agent enables you to:
|
||||
|
||||
| Feature | Description |
|
||||
|---------|-------------|
|
||||
| Query X402 services | Search the X402 bazaar for available services |
|
||||
| Filter by price | Find services within your budget |
|
||||
| Summarize results | Get AI-powered summaries of discovered services |
|
||||
| Pagination support | Handle large result sets efficiently |
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before you begin, ensure you have:
|
||||
|
||||
- Python 3.10 or higher
|
||||
- API keys for your AI model provider (e.g., Anthropic Claude)
|
||||
- `httpx` library for async HTTP requests
|
||||
|
||||
## Installation
|
||||
|
||||
Install the required dependencies:
|
||||
|
||||
```bash
|
||||
pip install swarms httpx
|
||||
```
|
||||
|
||||
## Code Example
|
||||
|
||||
Here's the complete implementation of the X402 Discovery Query Agent:
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
from typing import List, Optional, Dict, Any
|
||||
from swarms import Agent
|
||||
import httpx
|
||||
|
||||
|
||||
async def query_x402_services(
|
||||
limit: Optional[int] = None,
|
||||
max_price: Optional[int] = None,
|
||||
offset: int = 0,
|
||||
base_url: str = "https://api.cdp.coinbase.com",
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
Query x402 discovery services from the Coinbase CDP API.
|
||||
|
||||
Args:
|
||||
limit: Optional maximum number of services to return. If None, returns all available.
|
||||
max_price: Optional maximum price in atomic units to filter by. Only services with
|
||||
maxAmountRequired <= max_price will be included.
|
||||
offset: Pagination offset for the API request. Defaults to 0.
|
||||
base_url: Base URL for the API. Defaults to Coinbase CDP API.
|
||||
|
||||
Returns:
|
||||
Dict containing the API response with 'items' list and pagination info.
|
||||
|
||||
Raises:
|
||||
httpx.HTTPError: If the HTTP request fails.
|
||||
httpx.RequestError: If there's a network error.
|
||||
"""
|
||||
url = f"{base_url}/platform/v2/x402/discovery/resources"
|
||||
params = {"offset": offset}
|
||||
|
||||
# If both limit and max_price are specified, fetch more services to account for filtering
|
||||
api_limit = limit
|
||||
if limit is not None and max_price is not None:
|
||||
# Fetch 5x the limit to account for services that might be filtered out
|
||||
api_limit = limit * 5
|
||||
|
||||
if api_limit is not None:
|
||||
params["limit"] = api_limit
|
||||
|
||||
async with httpx.AsyncClient(timeout=30.0) as client:
|
||||
response = await client.get(url, params=params)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
|
||||
# Filter by price if max_price is specified
|
||||
if max_price is not None and "items" in data:
|
||||
filtered_items = []
|
||||
for item in data.get("items", []):
|
||||
# Check if any payment option in 'accepts' has maxAmountRequired <= max_price
|
||||
accepts = item.get("accepts", [])
|
||||
for accept in accepts:
|
||||
max_amount_str = accept.get("maxAmountRequired", "")
|
||||
if max_amount_str:
|
||||
try:
|
||||
max_amount = int(max_amount_str)
|
||||
if max_amount <= max_price:
|
||||
filtered_items.append(item)
|
||||
break # Only add item once if any payment option matches
|
||||
except (ValueError, TypeError):
|
||||
continue
|
||||
|
||||
# Apply limit to filtered results if specified
|
||||
if limit is not None:
|
||||
filtered_items = filtered_items[:limit]
|
||||
|
||||
data["items"] = filtered_items
|
||||
# Update pagination total if we filtered
|
||||
if "pagination" in data:
|
||||
data["pagination"]["total"] = len(filtered_items)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
def get_x402_services_sync(
|
||||
limit: Optional[int] = None,
|
||||
max_price: Optional[int] = None,
|
||||
offset: int = 0,
|
||||
) -> str:
|
||||
"""
|
||||
Synchronous wrapper for get_x402_services that returns a formatted string.
|
||||
|
||||
Args:
|
||||
limit: Optional maximum number of services to return.
|
||||
max_price: Optional maximum price in atomic units to filter by.
|
||||
offset: Pagination offset for the API request. Defaults to 0.
|
||||
|
||||
Returns:
|
||||
JSON-formatted string of service dictionaries matching the criteria.
|
||||
"""
|
||||
async def get_x402_services():
|
||||
result = await query_x402_services(
|
||||
limit=limit, max_price=max_price, offset=offset
|
||||
)
|
||||
return result.get("items", [])
|
||||
|
||||
services = asyncio.run(get_x402_services())
|
||||
return str(services)
|
||||
|
||||
|
||||
# Initialize the agent with the discovery tool
|
||||
agent = Agent(
|
||||
agent_name="X402-Discovery-Agent",
|
||||
agent_description="A agent that queries the x402 discovery services from the Coinbase CDP API.",
|
||||
model_name="claude-haiku-4-5",
|
||||
dynamic_temperature_enabled=True,
|
||||
max_loops=1,
|
||||
dynamic_context_window=True,
|
||||
tools=[get_x402_services_sync],
|
||||
top_p=None,
|
||||
temperature=None,
|
||||
tool_call_summary=True,
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Run the agent
|
||||
out = agent.run(
|
||||
task="Summarize the first 10 services under 100000 atomic units (e.g., $0.10 USDC)"
|
||||
)
|
||||
print(out)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Query
|
||||
|
||||
Query all available services:
|
||||
|
||||
```python
|
||||
result = await query_x402_services()
|
||||
print(f"Found {len(result['items'])} services")
|
||||
```
|
||||
|
||||
### Filtered Query
|
||||
|
||||
Get services within a specific price range:
|
||||
|
||||
```python
|
||||
# Get first 10 services under 100000 atomic units ($0.10 USDC with 6 decimals)
|
||||
services = await get_x402_services(limit=10, max_price=100000)
|
||||
for service in services:
|
||||
print(service["resource"])
|
||||
```
|
||||
|
||||
### Using the Agent
|
||||
|
||||
Run the agent to get AI-powered summaries:
|
||||
|
||||
```python
|
||||
# The agent will automatically call the tool and provide a summary
|
||||
out = agent.run(
|
||||
task="Find and summarize 5 affordable services under 50000 atomic units"
|
||||
)
|
||||
print(out)
|
||||
```
|
||||
|
||||
## Understanding Price Units
|
||||
|
||||
X402 services use atomic units for pricing. For example:
|
||||
|
||||
- **USDC** typically uses 6 decimals
|
||||
- 100,000 atomic units = $0.10 USDC
|
||||
- 1,000,000 atomic units = $1.00 USDC
|
||||
|
||||
Always check the `accepts` array in each service to understand the payment options and their price requirements.
|
||||
|
||||
## API Response Structure
|
||||
|
||||
Each service in the response contains:
|
||||
|
||||
- `resource`: The service endpoint or resource identifier
|
||||
- `accepts`: Array of payment options with `maxAmountRequired` values
|
||||
- Additional metadata about the service
|
||||
|
||||
## Error Handling
|
||||
|
||||
The functions handle various error cases:
|
||||
|
||||
- Network errors are raised as `httpx.RequestError`
|
||||
- HTTP errors are raised as `httpx.HTTPError`
|
||||
- Invalid price values are silently skipped during filtering
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Customize the agent's system prompt for specific use cases
|
||||
2. Add additional filtering criteria (e.g., by service type)
|
||||
3. Implement caching for frequently accessed services
|
||||
4. Create a web interface for browsing services
|
||||
5. Integrate with payment processing to actually use discovered services
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [X402 Payment Integration](x402_payment_integration.md) - Learn how to monetize your agents with X402
|
||||
- [Agent Tools Reference](../swarms/tools/tools_examples.md) - Understand how to create and use tools with agents
|
||||
@ -1,429 +0,0 @@
|
||||
# VLLM Swarm Agents
|
||||
|
||||
!!! tip "Quick Summary"
|
||||
This guide demonstrates how to create a sophisticated multi-agent system using VLLM and Swarms for comprehensive stock market analysis. You'll learn how to configure and orchestrate multiple AI agents working together to provide deep market insights.
|
||||
|
||||
## Overview
|
||||
|
||||
The example showcases how to build a stock analysis system with 5 specialized agents:
|
||||
|
||||
- Technical Analysis Agent
|
||||
- Fundamental Analysis Agent
|
||||
- Market Sentiment Agent
|
||||
- Quantitative Strategy Agent
|
||||
- Portfolio Strategy Agent
|
||||
|
||||
Each agent has specific expertise and works collaboratively through a concurrent workflow.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
!!! warning "Requirements"
|
||||
Before starting, ensure you have:
|
||||
|
||||
- Python 3.7 or higher
|
||||
- The Swarms package installed
|
||||
- Access to VLLM compatible models
|
||||
- Sufficient compute resources for running VLLM
|
||||
|
||||
## Installation
|
||||
|
||||
!!! example "Setup Steps"
|
||||
|
||||
1. Install the Swarms package:
|
||||
```bash
|
||||
pip install swarms
|
||||
```
|
||||
|
||||
2. Install VLLM dependencies (if not already installed):
|
||||
```bash
|
||||
pip install vllm
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
|
||||
Here's a complete example of setting up the stock analysis swarm:
|
||||
|
||||
```python
|
||||
from swarms import Agent, ConcurrentWorkflow
|
||||
from swarms.utils.vllm_wrapper import VLLMWrapper
|
||||
|
||||
# Initialize the VLLM wrapper
|
||||
vllm = VLLMWrapper(
|
||||
model_name="meta-llama/Llama-2-7b-chat-hf",
|
||||
system_prompt="You are a helpful assistant.",
|
||||
)
|
||||
```
|
||||
|
||||
!!! note "Model Selection"
|
||||
The example uses Llama-2-7b-chat, but you can use any VLLM-compatible model. Make sure you have the necessary permissions and resources to run your chosen model.
|
||||
|
||||
## Agent Configuration
|
||||
|
||||
### Technical Analysis Agent
|
||||
|
||||
```python
|
||||
technical_analyst = Agent(
|
||||
agent_name="Technical-Analysis-Agent",
|
||||
agent_description="Expert in technical analysis and chart patterns",
|
||||
system_prompt="""You are an expert Technical Analysis Agent specializing in market technicals and chart patterns. Your responsibilities include:
|
||||
|
||||
1. PRICE ACTION ANALYSIS
|
||||
- Identify key support and resistance levels
|
||||
- Analyze price trends and momentum
|
||||
- Detect chart patterns (e.g., head & shoulders, triangles, flags)
|
||||
- Evaluate volume patterns and their implications
|
||||
|
||||
2. TECHNICAL INDICATORS
|
||||
- Calculate and interpret moving averages (SMA, EMA)
|
||||
- Analyze momentum indicators (RSI, MACD, Stochastic)
|
||||
- Evaluate volume indicators (OBV, Volume Profile)
|
||||
- Monitor volatility indicators (Bollinger Bands, ATR)
|
||||
|
||||
3. TRADING SIGNALS
|
||||
- Generate clear buy/sell signals based on technical criteria
|
||||
- Identify potential entry and exit points
|
||||
- Set appropriate stop-loss and take-profit levels
|
||||
- Calculate position sizing recommendations
|
||||
|
||||
4. RISK MANAGEMENT
|
||||
- Assess market volatility and trend strength
|
||||
- Identify potential reversal points
|
||||
- Calculate risk/reward ratios for trades
|
||||
- Suggest position sizing based on risk parameters
|
||||
|
||||
Your analysis should be data-driven, precise, and actionable. Always include specific price levels, time frames, and risk parameters in your recommendations.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
```
|
||||
|
||||
!!! tip "Agent Customization"
|
||||
Each agent can be customized with different:
|
||||
|
||||
- System prompts
|
||||
|
||||
- Temperature settings
|
||||
|
||||
- Max token limits
|
||||
|
||||
- Response formats
|
||||
|
||||
## Running the Swarm
|
||||
|
||||
To execute the swarm analysis:
|
||||
|
||||
```python
|
||||
swarm = ConcurrentWorkflow(
|
||||
name="Stock-Analysis-Swarm",
|
||||
description="A swarm of agents that analyze stocks and provide comprehensive analysis.",
|
||||
agents=stock_analysis_agents,
|
||||
)
|
||||
|
||||
# Run the analysis
|
||||
response = swarm.run("Analyze the best etfs for gold and other similar commodities in volatile markets")
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Full Code Example
|
||||
|
||||
```python
|
||||
from swarms import Agent, ConcurrentWorkflow
|
||||
from swarms.utils.vllm_wrapper import VLLMWrapper
|
||||
|
||||
# Initialize the VLLM wrapper
|
||||
vllm = VLLMWrapper(
|
||||
model_name="meta-llama/Llama-2-7b-chat-hf",
|
||||
system_prompt="You are a helpful assistant.",
|
||||
)
|
||||
|
||||
# Technical Analysis Agent
|
||||
technical_analyst = Agent(
|
||||
agent_name="Technical-Analysis-Agent",
|
||||
agent_description="Expert in technical analysis and chart patterns",
|
||||
system_prompt="""You are an expert Technical Analysis Agent specializing in market technicals and chart patterns. Your responsibilities include:
|
||||
|
||||
1. PRICE ACTION ANALYSIS
|
||||
- Identify key support and resistance levels
|
||||
- Analyze price trends and momentum
|
||||
- Detect chart patterns (e.g., head & shoulders, triangles, flags)
|
||||
- Evaluate volume patterns and their implications
|
||||
|
||||
2. TECHNICAL INDICATORS
|
||||
- Calculate and interpret moving averages (SMA, EMA)
|
||||
- Analyze momentum indicators (RSI, MACD, Stochastic)
|
||||
- Evaluate volume indicators (OBV, Volume Profile)
|
||||
- Monitor volatility indicators (Bollinger Bands, ATR)
|
||||
|
||||
3. TRADING SIGNALS
|
||||
- Generate clear buy/sell signals based on technical criteria
|
||||
- Identify potential entry and exit points
|
||||
- Set appropriate stop-loss and take-profit levels
|
||||
- Calculate position sizing recommendations
|
||||
|
||||
4. RISK MANAGEMENT
|
||||
- Assess market volatility and trend strength
|
||||
- Identify potential reversal points
|
||||
- Calculate risk/reward ratios for trades
|
||||
- Suggest position sizing based on risk parameters
|
||||
|
||||
Your analysis should be data-driven, precise, and actionable. Always include specific price levels, time frames, and risk parameters in your recommendations.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Fundamental Analysis Agent
|
||||
fundamental_analyst = Agent(
|
||||
agent_name="Fundamental-Analysis-Agent",
|
||||
agent_description="Expert in company fundamentals and valuation",
|
||||
system_prompt="""You are an expert Fundamental Analysis Agent specializing in company valuation and financial metrics. Your core responsibilities include:
|
||||
|
||||
1. FINANCIAL STATEMENT ANALYSIS
|
||||
- Analyze income statements, balance sheets, and cash flow statements
|
||||
- Calculate and interpret key financial ratios
|
||||
- Evaluate revenue growth and profit margins
|
||||
- Assess company's debt levels and cash position
|
||||
|
||||
2. VALUATION METRICS
|
||||
- Calculate fair value using multiple valuation methods:
|
||||
* Discounted Cash Flow (DCF)
|
||||
* Price-to-Earnings (P/E)
|
||||
* Price-to-Book (P/B)
|
||||
* Enterprise Value/EBITDA
|
||||
- Compare valuations against industry peers
|
||||
|
||||
3. BUSINESS MODEL ASSESSMENT
|
||||
- Evaluate competitive advantages and market position
|
||||
- Analyze industry dynamics and market share
|
||||
- Assess management quality and corporate governance
|
||||
- Identify potential risks and growth opportunities
|
||||
|
||||
4. ECONOMIC CONTEXT
|
||||
- Consider macroeconomic factors affecting the company
|
||||
- Analyze industry cycles and trends
|
||||
- Evaluate regulatory environment and compliance
|
||||
- Assess global market conditions
|
||||
|
||||
Your analysis should be comprehensive, focusing on both quantitative metrics and qualitative factors that impact long-term value.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Market Sentiment Agent
|
||||
sentiment_analyst = Agent(
|
||||
agent_name="Market-Sentiment-Agent",
|
||||
agent_description="Expert in market psychology and sentiment analysis",
|
||||
system_prompt="""You are an expert Market Sentiment Agent specializing in analyzing market psychology and investor behavior. Your key responsibilities include:
|
||||
|
||||
1. SENTIMENT INDICATORS
|
||||
- Monitor and interpret market sentiment indicators:
|
||||
* VIX (Fear Index)
|
||||
* Put/Call Ratio
|
||||
* Market Breadth
|
||||
* Investor Surveys
|
||||
- Track institutional vs retail investor behavior
|
||||
|
||||
2. NEWS AND SOCIAL MEDIA ANALYSIS
|
||||
- Analyze news flow and media sentiment
|
||||
- Monitor social media trends and discussions
|
||||
- Track analyst recommendations and changes
|
||||
- Evaluate corporate insider trading patterns
|
||||
|
||||
3. MARKET POSITIONING
|
||||
- Assess hedge fund positioning and exposure
|
||||
- Monitor short interest and short squeeze potential
|
||||
- Track fund flows and asset allocation trends
|
||||
- Analyze options market sentiment
|
||||
|
||||
4. CONTRARIAN SIGNALS
|
||||
- Identify extreme sentiment readings
|
||||
- Detect potential market turning points
|
||||
- Analyze historical sentiment patterns
|
||||
- Provide contrarian trading opportunities
|
||||
|
||||
Your analysis should combine quantitative sentiment metrics with qualitative assessment of market psychology and crowd behavior.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Quantitative Strategy Agent
|
||||
quant_analyst = Agent(
|
||||
agent_name="Quantitative-Strategy-Agent",
|
||||
agent_description="Expert in quantitative analysis and algorithmic strategies",
|
||||
system_prompt="""You are an expert Quantitative Strategy Agent specializing in data-driven investment strategies. Your primary responsibilities include:
|
||||
|
||||
1. FACTOR ANALYSIS
|
||||
- Analyze and monitor factor performance:
|
||||
* Value
|
||||
* Momentum
|
||||
* Quality
|
||||
* Size
|
||||
* Low Volatility
|
||||
- Calculate factor exposures and correlations
|
||||
|
||||
2. STATISTICAL ANALYSIS
|
||||
- Perform statistical arbitrage analysis
|
||||
- Calculate and monitor pair trading opportunities
|
||||
- Analyze market anomalies and inefficiencies
|
||||
- Develop mean reversion strategies
|
||||
|
||||
3. RISK MODELING
|
||||
- Build and maintain risk models
|
||||
- Calculate portfolio optimization metrics
|
||||
- Monitor correlation matrices
|
||||
- Analyze tail risk and stress scenarios
|
||||
|
||||
4. ALGORITHMIC STRATEGIES
|
||||
- Develop systematic trading strategies
|
||||
- Backtest and validate trading algorithms
|
||||
- Monitor strategy performance metrics
|
||||
- Optimize execution algorithms
|
||||
|
||||
Your analysis should be purely quantitative, based on statistical evidence and mathematical models rather than subjective opinions.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Portfolio Strategy Agent
|
||||
portfolio_strategist = Agent(
|
||||
agent_name="Portfolio-Strategy-Agent",
|
||||
agent_description="Expert in portfolio management and asset allocation",
|
||||
system_prompt="""You are an expert Portfolio Strategy Agent specializing in portfolio construction and management. Your core responsibilities include:
|
||||
|
||||
1. ASSET ALLOCATION
|
||||
- Develop strategic asset allocation frameworks
|
||||
- Recommend tactical asset allocation shifts
|
||||
- Optimize portfolio weightings
|
||||
- Balance risk and return objectives
|
||||
|
||||
2. PORTFOLIO ANALYSIS
|
||||
- Calculate portfolio risk metrics
|
||||
- Monitor sector and factor exposures
|
||||
- Analyze portfolio correlation matrix
|
||||
- Track performance attribution
|
||||
|
||||
3. RISK MANAGEMENT
|
||||
- Implement portfolio hedging strategies
|
||||
- Monitor and adjust position sizing
|
||||
- Set stop-loss and rebalancing rules
|
||||
- Develop drawdown protection strategies
|
||||
|
||||
4. PORTFOLIO OPTIMIZATION
|
||||
- Calculate efficient frontier analysis
|
||||
- Optimize for various objectives:
|
||||
* Maximum Sharpe Ratio
|
||||
* Minimum Volatility
|
||||
* Maximum Diversification
|
||||
- Consider transaction costs and taxes
|
||||
|
||||
Your recommendations should focus on portfolio-level decisions that optimize risk-adjusted returns while meeting specific investment objectives.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Create a list of all agents
|
||||
stock_analysis_agents = [
|
||||
technical_analyst,
|
||||
fundamental_analyst,
|
||||
sentiment_analyst,
|
||||
quant_analyst,
|
||||
portfolio_strategist
|
||||
]
|
||||
|
||||
swarm = ConcurrentWorkflow(
|
||||
name="Stock-Analysis-Swarm",
|
||||
description="A swarm of agents that analyze stocks and provide a comprehensive analysis of the current trends and opportunities.",
|
||||
agents=stock_analysis_agents,
|
||||
)
|
||||
|
||||
swarm.run("Analyze the best etfs for gold and other similiar commodities in volatile markets")
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
!!! success "Optimization Tips"
|
||||
1. **Agent Design**
|
||||
- Keep system prompts focused and specific
|
||||
|
||||
- Use clear role definitions
|
||||
|
||||
- Include error handling guidelines
|
||||
|
||||
2. **Resource Management**
|
||||
|
||||
- Monitor memory usage with large models
|
||||
|
||||
- Implement proper cleanup procedures
|
||||
|
||||
- Use batching for multiple queries
|
||||
|
||||
3. **Output Handling**
|
||||
|
||||
- Implement proper logging
|
||||
|
||||
- Format outputs consistently
|
||||
|
||||
- Include error checking
|
||||
|
||||
## Common Issues and Solutions
|
||||
|
||||
!!! warning "Troubleshooting"
|
||||
Common issues you might encounter:
|
||||
|
||||
1. **Memory Issues**
|
||||
|
||||
- *Problem*: VLLM consuming too much memory
|
||||
|
||||
- *Solution*: Adjust batch sizes and model parameters
|
||||
|
||||
2. **Agent Coordination**
|
||||
|
||||
- *Problem*: Agents providing conflicting information
|
||||
|
||||
- *Solution*: Implement consensus mechanisms or priority rules
|
||||
|
||||
3. **Performance**
|
||||
|
||||
- *Problem*: Slow response times
|
||||
|
||||
- *Solution*: Use proper batching and optimize model loading
|
||||
|
||||
## FAQ
|
||||
|
||||
??? question "Can I use different models for different agents?"
|
||||
Yes, you can initialize multiple VLLM wrappers with different models for each agent. However, be mindful of memory usage.
|
||||
|
||||
??? question "How many agents can run concurrently?"
|
||||
The number depends on your hardware resources. Start with 3-5 agents and scale based on performance.
|
||||
|
||||
??? question "Can I customize agent communication patterns?"
|
||||
Yes, you can modify the ConcurrentWorkflow class or create custom workflows for specific communication patterns.
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
!!! example "Extended Settings"
|
||||
```python
|
||||
vllm = VLLMWrapper(
|
||||
model_name="meta-llama/Llama-2-7b-chat-hf",
|
||||
system_prompt="You are a helpful assistant.",
|
||||
temperature=0.7,
|
||||
max_tokens=2048,
|
||||
top_p=0.95,
|
||||
)
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
!!! info "Get Involved"
|
||||
We welcome contributions! Here's how you can help:
|
||||
|
||||
1. Report bugs and issues
|
||||
2. Submit feature requests
|
||||
3. Contribute to documentation
|
||||
4. Share example use cases
|
||||
|
||||
## Resources
|
||||
|
||||
!!! abstract "Additional Reading"
|
||||
- [VLLM Documentation](https://docs.vllm.ai/en/latest/)
|
||||
|
||||
@ -1,194 +0,0 @@
|
||||
|
||||
|
||||
# vLLM Integration Guide
|
||||
|
||||
!!! info "Overview"
|
||||
vLLM is a high-performance and easy-to-use library for LLM inference and serving. This guide explains how to integrate vLLM with Swarms for efficient, production-grade language model deployment.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
!!! note "Prerequisites"
|
||||
Before you begin, make sure you have Python 3.8+ installed on your system.
|
||||
|
||||
=== "pip"
|
||||
```bash
|
||||
pip install -U vllm swarms
|
||||
```
|
||||
|
||||
=== "poetry"
|
||||
```bash
|
||||
poetry add vllm swarms
|
||||
```
|
||||
|
||||
## Basic Usage
|
||||
|
||||
Here's a simple example of how to use vLLM with Swarms:
|
||||
|
||||
```python title="basic_usage.py"
|
||||
from swarms.utils.vllm_wrapper import VLLMWrapper
|
||||
|
||||
# Initialize the vLLM wrapper
|
||||
vllm = VLLMWrapper(
|
||||
model_name="meta-llama/Llama-2-7b-chat-hf",
|
||||
system_prompt="You are a helpful assistant.",
|
||||
temperature=0.7,
|
||||
max_tokens=4000
|
||||
)
|
||||
|
||||
# Run inference
|
||||
response = vllm.run("What is the capital of France?")
|
||||
print(response)
|
||||
```
|
||||
|
||||
## VLLMWrapper Class
|
||||
|
||||
!!! abstract "Class Overview"
|
||||
The `VLLMWrapper` class provides a convenient interface for working with vLLM models.
|
||||
|
||||
### Key Parameters
|
||||
|
||||
| Parameter | Type | Description | Default |
|
||||
|-----------|------|-------------|---------|
|
||||
| `model_name` | str | Name of the model to use | "meta-llama/Llama-2-7b-chat-hf" |
|
||||
| `system_prompt` | str | System prompt to use | None |
|
||||
| `stream` | bool | Whether to stream the output | False |
|
||||
| `temperature` | float | Sampling temperature | 0.5 |
|
||||
| `max_tokens` | int | Maximum number of tokens to generate | 4000 |
|
||||
|
||||
### Example with Custom Parameters
|
||||
|
||||
```python title="custom_parameters.py"
|
||||
vllm = VLLMWrapper(
|
||||
model_name="meta-llama/Llama-2-13b-chat-hf",
|
||||
system_prompt="You are an expert in artificial intelligence.",
|
||||
temperature=0.8,
|
||||
max_tokens=2000
|
||||
)
|
||||
```
|
||||
|
||||
## Integration with Agents
|
||||
|
||||
You can easily integrate vLLM with Swarms agents for more complex workflows:
|
||||
|
||||
```python title="agent_integration.py"
|
||||
from swarms import Agent
|
||||
from swarms.utils.vllm_wrapper import VLLMWrapper
|
||||
|
||||
# Initialize vLLM
|
||||
vllm = VLLMWrapper(
|
||||
model_name="meta-llama/Llama-2-7b-chat-hf",
|
||||
system_prompt="You are a helpful assistant."
|
||||
)
|
||||
|
||||
# Create an agent with vLLM
|
||||
agent = Agent(
|
||||
agent_name="Research-Agent",
|
||||
agent_description="Expert in conducting research and analysis",
|
||||
system_prompt="""You are an expert research agent. Your tasks include:
|
||||
1. Analyzing complex topics
|
||||
2. Providing detailed summaries
|
||||
3. Making data-driven recommendations""",
|
||||
llm=vllm,
|
||||
max_loops=1
|
||||
)
|
||||
|
||||
# Run the agent
|
||||
response = agent.run("Research the impact of AI on healthcare")
|
||||
```
|
||||
|
||||
## Advanced Features
|
||||
|
||||
### Batch Processing
|
||||
|
||||
!!! tip "Performance Optimization"
|
||||
Use batch processing for efficient handling of multiple tasks simultaneously.
|
||||
|
||||
```python title="batch_processing.py"
|
||||
tasks = [
|
||||
"What is machine learning?",
|
||||
"Explain neural networks",
|
||||
"Describe deep learning"
|
||||
]
|
||||
|
||||
results = vllm.batched_run(tasks, batch_size=3)
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
||||
!!! warning "Error Management"
|
||||
Always implement proper error handling in production environments.
|
||||
|
||||
```python title="error_handling.py"
|
||||
from loguru import logger
|
||||
|
||||
try:
|
||||
response = vllm.run("Complex task")
|
||||
except Exception as error:
|
||||
logger.error(f"Error occurred: {error}")
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
!!! success "Recommended Practices"
|
||||
=== "Model Selection"
|
||||
- Choose appropriate model sizes based on your requirements
|
||||
- Consider the trade-off between model size and inference speed
|
||||
|
||||
=== "System Resources"
|
||||
- Ensure sufficient GPU memory for your chosen model
|
||||
- Monitor resource usage during batch processing
|
||||
|
||||
=== "Prompt Engineering"
|
||||
- Use clear and specific system prompts
|
||||
- Structure user prompts for optimal results
|
||||
|
||||
=== "Error Handling"
|
||||
- Implement proper error handling and logging
|
||||
- Set up monitoring for production deployments
|
||||
|
||||
=== "Performance"
|
||||
- Use batch processing for multiple tasks
|
||||
- Adjust max_tokens based on your use case
|
||||
- Fine-tune temperature for optimal output quality
|
||||
|
||||
## Example: Multi-Agent System
|
||||
|
||||
Here's an example of creating a multi-agent system using vLLM:
|
||||
|
||||
```python title="multi_agent_system.py"
|
||||
from swarms import Agent, ConcurrentWorkflow
|
||||
from swarms.utils.vllm_wrapper import VLLMWrapper
|
||||
|
||||
# Initialize vLLM
|
||||
vllm = VLLMWrapper(
|
||||
model_name="meta-llama/Llama-2-7b-chat-hf",
|
||||
system_prompt="You are a helpful assistant."
|
||||
)
|
||||
|
||||
# Create specialized agents
|
||||
research_agent = Agent(
|
||||
agent_name="Research-Agent",
|
||||
agent_description="Expert in research",
|
||||
system_prompt="You are a research expert.",
|
||||
llm=vllm
|
||||
)
|
||||
|
||||
analysis_agent = Agent(
|
||||
agent_name="Analysis-Agent",
|
||||
agent_description="Expert in analysis",
|
||||
system_prompt="You are an analysis expert.",
|
||||
llm=vllm
|
||||
)
|
||||
|
||||
# Create a workflow
|
||||
agents = [research_agent, analysis_agent]
|
||||
workflow = ConcurrentWorkflow(
|
||||
name="Research-Analysis-Workflow",
|
||||
description="Comprehensive research and analysis workflow",
|
||||
agents=agents
|
||||
)
|
||||
|
||||
# Run the workflow
|
||||
result = workflow.run("Analyze the impact of renewable energy")
|
||||
```
|
||||
@ -0,0 +1,18 @@
|
||||
# AOP Client Examples
|
||||
|
||||
This directory contains examples demonstrating AOP (Agents over Protocol) client implementations.
|
||||
|
||||
## Examples
|
||||
|
||||
- [aop_cluster_example.py](aop_cluster_example.py) - AOP cluster client example
|
||||
- [aop_queue_example.py](aop_queue_example.py) - Queue-based task submission
|
||||
- [aop_raw_client_code.py](aop_raw_client_code.py) - Raw AOP client implementation
|
||||
- [aop_raw_task_example.py](aop_raw_task_example.py) - Raw AOP task example
|
||||
- [example_new_agent_tools.py](example_new_agent_tools.py) - New agent tools example
|
||||
- [get_all_agents.py](get_all_agents.py) - Agent discovery example
|
||||
- [list_agents_and_call_them.py](list_agents_and_call_them.py) - List and call agents
|
||||
|
||||
## Overview
|
||||
|
||||
AOP client examples demonstrate how to connect to AOP servers, discover available agents, submit tasks, and interact with agents over the protocol. These examples show various client patterns including queue-based submission, cluster management, and agent discovery.
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
# AOP Discovery Examples
|
||||
|
||||
This directory contains examples demonstrating agent discovery mechanisms in AOP.
|
||||
|
||||
## Examples
|
||||
|
||||
- [example_agent_communication.py](example_agent_communication.py) - Agent communication example
|
||||
- [example_aop_discovery.py](example_aop_discovery.py) - AOP discovery implementation
|
||||
- [simple_discovery_example.py](simple_discovery_example.py) - Simple discovery example
|
||||
- [test_aop_discovery.py](test_aop_discovery.py) - Discovery testing
|
||||
|
||||
## Overview
|
||||
|
||||
AOP discovery examples demonstrate how agents can discover and communicate with each other over the protocol. These examples show various discovery patterns, agent registration, and communication protocols for distributed agent systems.
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
# Medical AOP Examples
|
||||
|
||||
This directory contains medical domain-specific AOP implementations.
|
||||
|
||||
## Examples
|
||||
|
||||
- [client.py](client.py) - Medical AOP client
|
||||
- [server.py](server.py) - Medical AOP server
|
||||
|
||||
## Overview
|
||||
|
||||
Medical AOP examples demonstrate domain-specific implementations of Agents over Protocol for healthcare applications. These examples show how to structure AOP servers and clients for medical use cases, including patient data handling, medical analysis, and healthcare workflows.
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
# AOP Utils
|
||||
|
||||
This directory contains utility functions and helpers for AOP implementations.
|
||||
|
||||
## Examples
|
||||
|
||||
- [comprehensive_aop_example.py](comprehensive_aop_example.py) - Comprehensive AOP example
|
||||
- [network_error_example.py](network_error_example.py) - Network error handling
|
||||
- [network_management_example.py](network_management_example.py) - Network management utilities
|
||||
- [persistence_example.py](persistence_example.py) - Persistence implementation
|
||||
- [persistence_management_example.py](persistence_management_example.py) - Persistence management
|
||||
|
||||
## Overview
|
||||
|
||||
AOP utils provide helper functions, error handling patterns, network management utilities, and persistence mechanisms for AOP implementations. These examples demonstrate best practices for building robust AOP systems.
|
||||
|
||||
@ -1,214 +0,0 @@
|
||||
from swarms import Agent, ConcurrentWorkflow
|
||||
from swarms.utils.vllm_wrapper import VLLMWrapper
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
# Initialize the VLLM wrapper
|
||||
vllm = VLLMWrapper(
|
||||
model_name="meta-llama/Llama-2-7b-chat-hf",
|
||||
system_prompt="You are a helpful assistant.",
|
||||
)
|
||||
|
||||
# Technical Analysis Agent
|
||||
technical_analyst = Agent(
|
||||
agent_name="Technical-Analysis-Agent",
|
||||
agent_description="Expert in technical analysis and chart patterns",
|
||||
system_prompt="""You are an expert Technical Analysis Agent specializing in market technicals and chart patterns. Your responsibilities include:
|
||||
|
||||
1. PRICE ACTION ANALYSIS
|
||||
- Identify key support and resistance levels
|
||||
- Analyze price trends and momentum
|
||||
- Detect chart patterns (e.g., head & shoulders, triangles, flags)
|
||||
- Evaluate volume patterns and their implications
|
||||
|
||||
2. TECHNICAL INDICATORS
|
||||
- Calculate and interpret moving averages (SMA, EMA)
|
||||
- Analyze momentum indicators (RSI, MACD, Stochastic)
|
||||
- Evaluate volume indicators (OBV, Volume Profile)
|
||||
- Monitor volatility indicators (Bollinger Bands, ATR)
|
||||
|
||||
3. TRADING SIGNALS
|
||||
- Generate clear buy/sell signals based on technical criteria
|
||||
- Identify potential entry and exit points
|
||||
- Set appropriate stop-loss and take-profit levels
|
||||
- Calculate position sizing recommendations
|
||||
|
||||
4. RISK MANAGEMENT
|
||||
- Assess market volatility and trend strength
|
||||
- Identify potential reversal points
|
||||
- Calculate risk/reward ratios for trades
|
||||
- Suggest position sizing based on risk parameters
|
||||
|
||||
Your analysis should be data-driven, precise, and actionable. Always include specific price levels, time frames, and risk parameters in your recommendations.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Fundamental Analysis Agent
|
||||
fundamental_analyst = Agent(
|
||||
agent_name="Fundamental-Analysis-Agent",
|
||||
agent_description="Expert in company fundamentals and valuation",
|
||||
system_prompt="""You are an expert Fundamental Analysis Agent specializing in company valuation and financial metrics. Your core responsibilities include:
|
||||
|
||||
1. FINANCIAL STATEMENT ANALYSIS
|
||||
- Analyze income statements, balance sheets, and cash flow statements
|
||||
- Calculate and interpret key financial ratios
|
||||
- Evaluate revenue growth and profit margins
|
||||
- Assess company's debt levels and cash position
|
||||
|
||||
2. VALUATION METRICS
|
||||
- Calculate fair value using multiple valuation methods:
|
||||
* Discounted Cash Flow (DCF)
|
||||
* Price-to-Earnings (P/E)
|
||||
* Price-to-Book (P/B)
|
||||
* Enterprise Value/EBITDA
|
||||
- Compare valuations against industry peers
|
||||
|
||||
3. BUSINESS MODEL ASSESSMENT
|
||||
- Evaluate competitive advantages and market position
|
||||
- Analyze industry dynamics and market share
|
||||
- Assess management quality and corporate governance
|
||||
- Identify potential risks and growth opportunities
|
||||
|
||||
4. ECONOMIC CONTEXT
|
||||
- Consider macroeconomic factors affecting the company
|
||||
- Analyze industry cycles and trends
|
||||
- Evaluate regulatory environment and compliance
|
||||
- Assess global market conditions
|
||||
|
||||
Your analysis should be comprehensive, focusing on both quantitative metrics and qualitative factors that impact long-term value.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Market Sentiment Agent
|
||||
sentiment_analyst = Agent(
|
||||
agent_name="Market-Sentiment-Agent",
|
||||
agent_description="Expert in market psychology and sentiment analysis",
|
||||
system_prompt="""You are an expert Market Sentiment Agent specializing in analyzing market psychology and investor behavior. Your key responsibilities include:
|
||||
|
||||
1. SENTIMENT INDICATORS
|
||||
- Monitor and interpret market sentiment indicators:
|
||||
* VIX (Fear Index)
|
||||
* Put/Call Ratio
|
||||
* Market Breadth
|
||||
* Investor Surveys
|
||||
- Track institutional vs retail investor behavior
|
||||
|
||||
2. NEWS AND SOCIAL MEDIA ANALYSIS
|
||||
- Analyze news flow and media sentiment
|
||||
- Monitor social media trends and discussions
|
||||
- Track analyst recommendations and changes
|
||||
- Evaluate corporate insider trading patterns
|
||||
|
||||
3. MARKET POSITIONING
|
||||
- Assess hedge fund positioning and exposure
|
||||
- Monitor short interest and short squeeze potential
|
||||
- Track fund flows and asset allocation trends
|
||||
- Analyze options market sentiment
|
||||
|
||||
4. CONTRARIAN SIGNALS
|
||||
- Identify extreme sentiment readings
|
||||
- Detect potential market turning points
|
||||
- Analyze historical sentiment patterns
|
||||
- Provide contrarian trading opportunities
|
||||
|
||||
Your analysis should combine quantitative sentiment metrics with qualitative assessment of market psychology and crowd behavior.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Quantitative Strategy Agent
|
||||
quant_analyst = Agent(
|
||||
agent_name="Quantitative-Strategy-Agent",
|
||||
agent_description="Expert in quantitative analysis and algorithmic strategies",
|
||||
system_prompt="""You are an expert Quantitative Strategy Agent specializing in data-driven investment strategies. Your primary responsibilities include:
|
||||
|
||||
1. FACTOR ANALYSIS
|
||||
- Analyze and monitor factor performance:
|
||||
* Value
|
||||
* Momentum
|
||||
* Quality
|
||||
* Size
|
||||
* Low Volatility
|
||||
- Calculate factor exposures and correlations
|
||||
|
||||
2. STATISTICAL ANALYSIS
|
||||
- Perform statistical arbitrage analysis
|
||||
- Calculate and monitor pair trading opportunities
|
||||
- Analyze market anomalies and inefficiencies
|
||||
- Develop mean reversion strategies
|
||||
|
||||
3. RISK MODELING
|
||||
- Build and maintain risk models
|
||||
- Calculate portfolio optimization metrics
|
||||
- Monitor correlation matrices
|
||||
- Analyze tail risk and stress scenarios
|
||||
|
||||
4. ALGORITHMIC STRATEGIES
|
||||
- Develop systematic trading strategies
|
||||
- Backtest and validate trading algorithms
|
||||
- Monitor strategy performance metrics
|
||||
- Optimize execution algorithms
|
||||
|
||||
Your analysis should be purely quantitative, based on statistical evidence and mathematical models rather than subjective opinions.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Portfolio Strategy Agent
|
||||
portfolio_strategist = Agent(
|
||||
agent_name="Portfolio-Strategy-Agent",
|
||||
agent_description="Expert in portfolio management and asset allocation",
|
||||
system_prompt="""You are an expert Portfolio Strategy Agent specializing in portfolio construction and management. Your core responsibilities include:
|
||||
|
||||
1. ASSET ALLOCATION
|
||||
- Develop strategic asset allocation frameworks
|
||||
- Recommend tactical asset allocation shifts
|
||||
- Optimize portfolio weightings
|
||||
- Balance risk and return objectives
|
||||
|
||||
2. PORTFOLIO ANALYSIS
|
||||
- Calculate portfolio risk metrics
|
||||
- Monitor sector and factor exposures
|
||||
- Analyze portfolio correlation matrix
|
||||
- Track performance attribution
|
||||
|
||||
3. RISK MANAGEMENT
|
||||
- Implement portfolio hedging strategies
|
||||
- Monitor and adjust position sizing
|
||||
- Set stop-loss and rebalancing rules
|
||||
- Develop drawdown protection strategies
|
||||
|
||||
4. PORTFOLIO OPTIMIZATION
|
||||
- Calculate efficient frontier analysis
|
||||
- Optimize for various objectives:
|
||||
* Maximum Sharpe Ratio
|
||||
* Minimum Volatility
|
||||
* Maximum Diversification
|
||||
- Consider transaction costs and taxes
|
||||
|
||||
Your recommendations should focus on portfolio-level decisions that optimize risk-adjusted returns while meeting specific investment objectives.""",
|
||||
max_loops=1,
|
||||
llm=vllm,
|
||||
)
|
||||
|
||||
# Create a list of all agents
|
||||
stock_analysis_agents = [
|
||||
technical_analyst,
|
||||
fundamental_analyst,
|
||||
sentiment_analyst,
|
||||
quant_analyst,
|
||||
portfolio_strategist,
|
||||
]
|
||||
|
||||
swarm = ConcurrentWorkflow(
|
||||
name="Stock-Analysis-Swarm",
|
||||
description="A swarm of agents that analyze stocks and provide a comprehensive analysis of the current trends and opportunities.",
|
||||
agents=stock_analysis_agents,
|
||||
)
|
||||
|
||||
swarm.run(
|
||||
"Analyze the best etfs for gold and other similiar commodities in volatile markets"
|
||||
)
|
||||
@ -0,0 +1,19 @@
|
||||
# Cron Job Examples
|
||||
|
||||
This directory contains examples demonstrating scheduled task execution using cron jobs.
|
||||
|
||||
## Examples
|
||||
|
||||
- [callback_cron_example.py](callback_cron_example.py) - Cron job with callbacks
|
||||
- [cron_job_example.py](cron_job_example.py) - Basic cron job example
|
||||
- [cron_job_figma_stock_swarms_tools_example.py](cron_job_figma_stock_swarms_tools_example.py) - Figma stock swarms tools cron job
|
||||
- [crypto_concurrent_cron_example.py](crypto_concurrent_cron_example.py) - Concurrent crypto cron job
|
||||
- [figma_stock_example.py](figma_stock_example.py) - Figma stock example
|
||||
- [simple_callback_example.py](simple_callback_example.py) - Simple callback example
|
||||
- [simple_concurrent_crypto_cron.py](simple_concurrent_crypto_cron.py) - Simple concurrent crypto cron
|
||||
- [solana_price_tracker.py](solana_price_tracker.py) - Solana price tracker cron job
|
||||
|
||||
## Overview
|
||||
|
||||
Cron job examples demonstrate how to schedule and execute agent tasks on a recurring basis. These examples show various patterns including callback handling, concurrent execution, and domain-specific scheduled tasks like price tracking and stock monitoring.
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
# 840 Update Examples
|
||||
|
||||
This directory contains examples from the 840 update, demonstrating new features and improvements.
|
||||
|
||||
## Examples
|
||||
|
||||
- [agent_rearrange_concurrent_example.py](agent_rearrange_concurrent_example.py) - Agent rearrangement with concurrency
|
||||
- [auto_swarm_builder_example.py](auto_swarm_builder_example.py) - Auto swarm builder example
|
||||
- [fallback_example.py](fallback_example.py) - Fallback mechanism example
|
||||
- [server.py](server.py) - Server implementation
|
||||
|
||||
## Overview
|
||||
|
||||
These examples showcase features introduced in the 840 update, including concurrent agent rearrangement, auto swarm building capabilities, and improved fallback mechanisms.
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
# 850 Workshop Examples
|
||||
|
||||
This directory contains examples from the 850 workshop, demonstrating advanced multi-agent patterns and AOP integration.
|
||||
|
||||
## Examples
|
||||
|
||||
- [aop_raw_client_code.py](aop_raw_client_code.py) - Raw AOP client implementation
|
||||
- [aop_raw_task_example.py](aop_raw_task_example.py) - Raw AOP task example
|
||||
- [moa_seq_example.py](moa_seq_example.py) - Mixture of Agents sequential example
|
||||
- [peer_review_example.py](peer_review_example.py) - Peer review pattern
|
||||
- [server.py](server.py) - Server implementation
|
||||
- [test_agent_concurrent.py](test_agent_concurrent.py) - Concurrent agent testing
|
||||
- [uvloop_example.py](uvloop_example.py) - UVLoop integration example
|
||||
|
||||
## Overview
|
||||
|
||||
These examples from the 850 workshop demonstrate advanced patterns including Agents over Protocol (AOP) integration, mixture of agents, peer review workflows, and high-performance async execution with UVLoop.
|
||||
|
||||
|
Can't render this file because it is too large.
|
@ -0,0 +1,13 @@
|
||||
# Generation Length Blog Examples
|
||||
|
||||
This directory contains examples related to generation length management and long-form content generation.
|
||||
|
||||
## Examples
|
||||
|
||||
- [longform_generator.py](longform_generator.py) - Long-form content generator
|
||||
- [universal_api.py](universal_api.py) - Universal API for generation
|
||||
|
||||
## Overview
|
||||
|
||||
These examples demonstrate techniques for managing generation length, creating long-form content, and implementing universal APIs for content generation. Useful for blog posts, articles, and extended text generation tasks.
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
# Hackathon Judge Agent
|
||||
|
||||
This directory contains a hackathon project judging agent example.
|
||||
|
||||
## Examples
|
||||
|
||||
- [hackathon_judger_agent.py](hackathon_judger_agent.py) - Hackathon project judging agent
|
||||
- [projects.csv](projects.csv) - Sample projects dataset
|
||||
|
||||
## Overview
|
||||
|
||||
This example demonstrates an agent system designed to evaluate and judge hackathon projects. The agent can analyze project descriptions, assess quality, and provide structured feedback based on predefined criteria.
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
# Hackathon Examples
|
||||
|
||||
This directory contains hackathon project examples and implementations.
|
||||
|
||||
## Subdirectories
|
||||
|
||||
### Hackathon September 27
|
||||
- [hackathon_sep_27/](hackathon_sep_27/) - September 27 hackathon projects
|
||||
- [api_client.py](hackathon_sep_27/api_client.py) - API client implementation
|
||||
- [diet_coach_agent.py](hackathon_sep_27/diet_coach_agent.py) - Diet coach agent
|
||||
- [nutritional_content_analysis_swarm.py](hackathon_sep_27/nutritional_content_analysis_swarm.py) - Nutritional analysis swarm
|
||||
- [nutritonal_content_analysis_swarm.sh](hackathon_sep_27/nutritonal_content_analysis_swarm.sh) - Analysis script
|
||||
- [pizza.jpg](hackathon_sep_27/pizza.jpg) - Sample image
|
||||
|
||||
## Overview
|
||||
|
||||
This directory contains real hackathon projects built with Swarms, demonstrating practical applications and creative uses of the framework. These examples showcase how Swarms can be used to build domain-specific solutions quickly.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue