aidale-provider
AI provider implementations for Aidale (OpenAI, DeepSeek, etc.).
Overview
aidale-provider contains concrete implementations of the Provider trait from aidale-core:
- OpenAI: GPT-3.5, GPT-4, and compatible APIs
- DeepSeek: DeepSeek Chat with automatic configuration
- Extensible for custom providers
Supported Providers
OpenAI
use OpenAiProvider;
// Default OpenAI API
let provider = new;
// Custom base URL (for compatible APIs)
let provider = builder
.api_key
.api_base
.build_with_id?;
DeepSeek
use deepseek;
// One-liner setup with automatic configuration
let provider = deepseek?;
The deepseek() helper automatically configures:
- Base URL:
https://api.deepseek.com/v1 - Provider ID:
deepseek - Provider name:
DeepSeek
Features
- OpenAI-compatible: Works with any OpenAI-compatible API
- Streaming support: Full support for streaming responses
- Type-safe: Strongly-typed request/response models
- Async-first: Built on
tokioandreqwest
Usage
Via the main aidale crate:
[]
= { = "0.1", = ["openai"] }
Directly:
[]
= "0.1"
= "0.1"
Examples
Basic Usage
use Provider;
use OpenAiProvider;
async
Streaming
use StreamExt;
let mut stream = provider
.stream_chat_completion
.await?;
while let Some = stream.next.await
Custom Providers
Implement the Provider trait from aidale-core:
use ;
use async_trait;
Related Crates
aidale-core- Core traits and runtimeaidale-layer- Middleware layersaidale-plugin- Plugin system
License
MIT OR Apache-2.0