Expand description
§LLM Auto Optimizer - Integrations
Production-ready integrations with external services for the LLM Auto Optimizer.
§Features
§Jira Integration
- Full CRUD operations for issues
- Project and board management
- JQL query support
- Webhook event handling
- OAuth 2.0 and Basic authentication
- Rate limiting and retry logic
§Anthropic Claude Integration
- Message/completion endpoints
- Streaming support via Server-Sent Events
- Token counting and validation
- Cost tracking and estimation
- Rate limiting
- Multiple Claude model support
§Examples
§Jira Client
use integrations::jira::{JiraClient, JiraConfig, JiraAuth};
let config = JiraConfig {
base_url: "https://your-domain.atlassian.net".to_string(),
auth: JiraAuth::Basic {
email: "your-email@example.com".to_string(),
api_token: "your-api-token".to_string(),
},
timeout_secs: 30,
max_retries: 3,
rate_limit_per_minute: 100,
};
let client = JiraClient::new(config).await?;
let projects = client.get_projects().await?;
for project in projects {
println!("{}: {}", project.key, project.name);
}§Anthropic Client
use integrations::anthropic::{AnthropicClient, AnthropicConfig, ClaudeModel};
let config = AnthropicConfig {
api_key: "your-api-key".to_string(),
base_url: "https://api.anthropic.com".to_string(),
timeout_secs: 60,
max_retries: 3,
rate_limit_per_minute: 50,
api_version: "2023-06-01".to_string(),
};
let client = AnthropicClient::new(config).await?;
let response = client.complete(
ClaudeModel::Claude3Haiku,
"What is the capital of France?",
100,
).await?;
println!("Response: {}", response);
// Get cost statistics
let stats = client.get_cost_stats().await;
println!("Total cost: ${:.4}", stats.total_cost);§Architecture
The integrations are designed with:
- Modularity: Each integration is independent and self-contained
- Type Safety: Comprehensive type definitions with Serde support
- Error Handling: Detailed error types and context
- Observability: Built-in logging and tracing
- Resilience: Automatic retries, rate limiting, and circuit breakers
- Testing: Comprehensive unit and integration tests
§Production Readiness
All integrations include:
- Authentication and authorization
- Rate limiting and backoff strategies
- Comprehensive error handling
- Request/response logging
- Input validation
- Cost tracking (where applicable)
- Full test coverage
Re-exports§
pub use jira::JiraAuth;pub use jira::JiraClient;pub use jira::JiraConfig;pub use anthropic::AnthropicClient;pub use anthropic::AnthropicConfig;pub use anthropic::ClaudeModel;
Modules§
- anthropic
- Anthropic Claude API integration Anthropic Claude API integration
- jira
- Jira REST API integration Jira REST API integration
Constants§
- VERSION
- Library version
Functions§
- version
- Get the library version