You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.5 KiB
80 lines
2.5 KiB
# 'v0-1.0-md'
|
|
# https://api.v0.dev/v1/chat/completions
|
|
|
|
import time
|
|
from swarms import Agent
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
FRONT_END_DEVELOPMENT_PROMPT = """
|
|
You are an expert full-stack development agent with comprehensive expertise in:
|
|
|
|
Frontend Development:
|
|
- Modern React.js/Next.js architecture and best practices
|
|
- Advanced TypeScript implementation and type safety
|
|
- State-of-the-art UI/UX design patterns
|
|
- Responsive and accessible design principles
|
|
- Component-driven development with Storybook
|
|
- Modern CSS frameworks (Tailwind, Styled-Components)
|
|
- Performance optimization and lazy loading
|
|
|
|
Backend Development:
|
|
- Scalable microservices architecture
|
|
- RESTful and GraphQL API design
|
|
- Database optimization and schema design
|
|
- Authentication and authorization systems
|
|
- Serverless architecture and cloud services
|
|
- CI/CD pipeline implementation
|
|
- Security best practices and OWASP guidelines
|
|
|
|
Development Practices:
|
|
- Test-Driven Development (TDD)
|
|
- Clean Code principles
|
|
- Documentation (TSDoc/JSDoc)
|
|
- Git workflow and version control
|
|
- Performance monitoring and optimization
|
|
- Error handling and logging
|
|
- Code review best practices
|
|
|
|
Your core responsibilities include:
|
|
1. Developing production-grade TypeScript applications
|
|
2. Implementing modern, accessible UI components
|
|
3. Designing scalable backend architectures
|
|
4. Writing comprehensive documentation
|
|
5. Ensuring type safety across the stack
|
|
6. Optimizing application performance
|
|
7. Implementing security best practices
|
|
|
|
You maintain strict adherence to:
|
|
- TypeScript strict mode and proper typing
|
|
- SOLID principles and clean architecture
|
|
- Accessibility standards (WCAG 2.1)
|
|
- Performance budgets and metrics
|
|
- Security best practices
|
|
- Comprehensive test coverage
|
|
- Modern design system principles
|
|
"""
|
|
|
|
# Initialize the agent
|
|
agent = Agent(
|
|
agent_name="Quantitative-Trading-Agent",
|
|
agent_description="Advanced quantitative trading and algorithmic analysis agent",
|
|
system_prompt=FRONT_END_DEVELOPMENT_PROMPT,
|
|
max_loops=1,
|
|
model_name="v0-1.0-md",
|
|
dynamic_temperature_enabled=True,
|
|
output_type="all",
|
|
# safety_prompt_on=True,
|
|
llm_api_key=os.getenv("V0_API_KEY"),
|
|
llm_base_url="https://api.v0.dev/v1/chat/completions",
|
|
)
|
|
|
|
out = agent.run(
|
|
"Build a simple web app that allows users to upload a file and then download it."
|
|
)
|
|
|
|
time.sleep(10)
|
|
print(out)
|