Spaces:
Paused
Paused
File size: 4,210 Bytes
918bdb4 3b9a6b5 e2685f7 3b9a6b5 918bdb4 3b9a6b5 918bdb4 3b9a6b5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
import os, warnings
from dataclasses import dataclass
# Load secrets if environment variables are not set
from utils.load_secrets import load_secrets
if not os.getenv("NEBIUS_API_KEY") or not os.getenv("NEBIUS_MODEL"):
load_secrets("tests/secrets/creds.py")
# =========================
# MOCK PROJECTS
# =========================
MOCK_PROJECTS: dict[str, str] = {
"go-rssagg": """# GO-RSSAGG
## Project Description
RSS aggregator backend written in Go. Features REST API and basic authentication.
## Features
- User authentication and account management
- Fetch and parse RSS feeds
- Store feed content in database
- REST API to access feeds
- Follow/unfollow feed functionality
- Mark posts as read/unread
## Tech Stack
- Go for backend
- PostgreSQL for database
- RESTful API endpoints
- JWT for authentication
""",
"rust-chess-pipeline": """# RUST CHESS PIPELINE
## Project Description
Data Pipeline that extracts chess match metrics and match annotations from Excel files, using AWS Lambda and Step Functions written in Rust.
## Features
- Parse Excel files containing chess match data
- Extract player statistics, game metadata, and move annotations
- Calculate performance metrics and ELO adjustments
- Store results in data warehouse
- Generate analytical reports
## Tech Stack
- Rust for core processing logic
- AWS Lambda for serverless compute
- AWS Step Functions for orchestration
- Amazon S3 for storage
- AWS Glue for ETL processing
""",
"python-ml-forecasting": """# PYTHON ML FORECASTING
## Project Description
Machine learning service for time-series forecasting of inventory demands, with API endpoints for integration with existing systems.
## Features
- Historical data ingestion and preprocessing
- Feature engineering for time-series data
- Multiple forecasting models (ARIMA, Prophet, LSTM)
- Model selection and hyperparameter optimization
- REST API for predictions and model management
- Visualization of forecasts and confidence intervals
## Tech Stack
- Python for core functionality
- FastAPI for REST endpoints
- PyTorch and scikit-learn for ML models
- PostgreSQL for metadata storage
- Docker for containerization
""",
}
# =========================
# AGENTS CONFIG
# =========================
@dataclass
class AgentsConfig:
"""Global configuration for all agents"""
# Model settings
nebius_api_key: str
nebius_model: str
# Prompt templates
task_splitter_prompt: str = "Split the following task into an accurate and concise tree of required subtasks:\n{{query}}\n\nAim for 3 to 15 subtasks.\n\nYour output must be a markdown bullet list, with no additional comments.\n\n"
task_evaluator_prompt: str = "Evaluate the elapsed time, in 30 minute units, for a competent human to complete the following task:\n{{query}}\n\nYour output must be a one integer, with no additional comments.\n\n"
task_deps_matcher_prompt: str = "Given the following task:\n{{task}}\n\nAnd these available skills:\n{{skills}}\n\nIn this context:\n{{context}}\n\nSelect the most appropriate skill to complete this task. Return only the skill name as a string, with no additional comments or formatting.\n\n"
# LLM settings
timeout: int = 30
max_retries: int = 3
verify_ssl: bool = True
request_timeout: int = 30
max_tokens: int = 1024
temperature: float = 0.1
workflow_timeout: int = 300 # 5 minutes for workflow timeout
def __post_init__(self):
"""Validate required configuration"""
if not self.nebius_model or not self.nebius_api_key:
if self.nebius_model == "dev-model" and self.nebius_api_key == "dev-key":
warnings.warn(
"Using development defaults for NEBIUS_MODEL and NEBIUS_API_KEY"
)
else:
raise ValueError(
"NEBIUS_MODEL and NEBIUS_API_KEY environment variables must be set"
)
# Global configuration instance
# For development environments where env vars might not be set, use defaults
AGENTS_CONFIG = AgentsConfig(
nebius_api_key=os.getenv("NEBIUS_API_KEY", "dev-key"),
nebius_model=os.getenv("NEBIUS_MODEL", "dev-model"),
)
|