rig_core/providers/mod.rs
1//! Provider integrations included in `rig-core`.
2//!
3//! - Anthropic
4//! - Azure OpenAI
5//! - ChatGPT and GitHub Copilot auth-backed clients
6//! - Cohere
7//! - DeepSeek
8//! - Gemini
9//! - Groq
10//! - Hugging Face
11//! - Hyperbolic
12//! - Llamafile
13//! - MiniMax
14//! - Mira
15//! - Mistral
16//! - Moonshot
17//! - Ollama
18//! - OpenAI
19//! - OpenRouter
20//! - Perplexity
21//! - Together
22//! - Voyage AI
23//! - xAI
24//! - Xiaomi MiMo
25//! - Z.ai
26//!
27//! Each provider module defines a `Client` type and model types for the
28//! capabilities it supports. Capability traits such as
29//! [`CompletionClient`](crate::client::CompletionClient) and
30//! [`EmbeddingsClient`](crate::client::EmbeddingsClient) are implemented only
31//! when the provider declares that capability.
32//!
33//! # Provider implementation checklist
34//!
35//! When adding or changing a provider, verify that the integration includes:
36//!
37//! - for OpenAI-chat-compatible APIs: completions driven by
38//! [`GenericCompletionModel`](crate::providers::openai::completion::GenericCompletionModel)
39//! via an
40//! [`OpenAICompatibleProvider`](crate::providers::openai::completion::OpenAICompatibleProvider)
41//! impl on the provider extension (never a hand-rolled completion model,
42//! request struct, or message conversion — dialect differences go in the
43//! trait's hooks);
44//! - public `Client` and `ClientBuilder` aliases with the correct generics,
45//! including a `ClientBuilder` API-key generic matching `ProviderBuilder::ApiKey`;
46//! - the `Provider`, `ProviderBuilder`, `Capabilities`, and `ProviderClient`
47//! implementations;
48//! - explicit API-key marker/auth types with redacted debug behavior for
49//! credential-bearing values;
50//! - model constants where they are useful and current;
51//! - request conversion from Rig request types, such as
52//! [`CompletionRequest`](crate::completion::CompletionRequest), without
53//! inventing unsupported provider API fields;
54//! - response conversion into Rig response types, including usage and tool or
55//! multimodal content where applicable;
56//! - streaming support when the provider supports streaming;
57//! - provider-response error preservation plus `ProviderResponseExt` and
58//! telemetry fields consistent with nearby providers where applicable;
59//! - unit, cassette, or live-test coverage appropriate to the changed behavior;
60//! - root facade feature/docs updates for companion provider crates; and
61//! - examples and documentation that match the actual API, feature flags, and
62//! credential requirements.
63//!
64//! # Example
65//! ```no_run
66//! use rig_core::{
67//! client::{CompletionClient, ProviderClient},
68//! completion::{AssistantContent, CompletionModel},
69//! providers::openai,
70//! };
71//!
72//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
73//! // Initialize the OpenAI client
74//! let openai = openai::Client::from_env()?;
75//!
76//! // Create a model and send a low-level completion request.
77//! let model = openai.completion_model(openai::GPT_5_2);
78//! let request = model
79//! .completion_request("Discuss the fate of Middle Earth.")
80//! .preamble("\
81//! You are Gandalf the white and you will be conversing with other \
82//! powerful beings to discuss the fate of Middle Earth.\
83//! ".to_string())
84//! .build();
85//! let response = model.completion(request).await?;
86//! for item in response.choice {
87//! if let AssistantContent::Text(text) = item {
88//! println!("{}", text.text);
89//! }
90//! }
91//! # Ok(())
92//! # }
93//! ```
94pub mod anthropic;
95pub mod azure;
96pub mod chatgpt;
97pub mod cohere;
98pub mod copilot;
99pub mod deepseek;
100pub mod doubleword;
101pub mod gemini;
102pub mod groq;
103pub mod huggingface;
104pub mod hyperbolic;
105pub(crate) mod internal;
106pub mod llamafile;
107pub mod minimax;
108pub mod mira;
109pub mod mistral;
110pub mod moonshot;
111pub mod ollama;
112pub mod openai;
113pub mod openrouter;
114pub mod perplexity;
115pub mod together;
116pub mod voyageai;
117pub mod xai;
118pub mod xiaomimimo;
119pub mod zai;