rig_core/completion/mod.rs
1//! Provider-agnostic completion requests and responses. A provider's wire
2//! translates [`CompletionRequest`] into its own request and normalizes the
3//! reply as [`CompletionResponse`]; a [`Model`](crate::Model) sends it.
4//!
5//! ```no_run
6//! use rig_core::{Model, completion::CompletionRequest, providers::openai::OpenAIConfig};
7//!
8//! # async fn run(http: rig_core::http_client::DynHttpClient) -> Result<(), Box<dyn std::error::Error>> {
9//! let model = OpenAIConfig::from_env()?.connect(http).completion("gpt-4o");
10//! let request = CompletionRequest::new("What is Rig?");
11//! let response = model.call(request).await?;
12//! println!("{:?}", response.choice);
13//! # Ok(())
14//! # }
15//! ```
16
17pub mod handle;
18pub mod history;
19pub mod message;
20pub mod options;
21pub mod prompt;
22pub mod provider_options;
23pub mod request;
24
25pub use handle::ModelRef;
26pub use history::{Accepts, LaterSystem, Media, Pairing, Place, Replay, ReplayTarget, adapt};
27pub use message::{AssistantContent, AssistantMessage, Message};
28pub use options::{
29 CacheRetention, CheckError, Effort, GenerationOptions, OnUnsupported, Reasoning, ServiceTier,
30 UnsupportedOption, Verbosity,
31};
32pub use prompt::{Section, SystemPrompt};
33pub use provider_options::{
34 ExtensionOptions, OptionsError, ProviderExtension, ProviderOptions, ReplyExtras, SHARED,
35};
36pub use request::*;