pub struct GeneratorInfo {
pub name: String,
pub base_url: String,
pub model: String,
pub api_key: Option<SecretString>,
pub organization_id: Option<String>,
pub custom_headers: Vec<(String, String)>,
pub supports_streaming: bool,
pub supports_vision: bool,
pub supports_audio: bool,
pub max_context_length: Option<usize>,
pub default_params: CompletionParameters,
}Expand description
Configuration for an LLM provider/generator
Fields§
§name: StringDisplay name for this generator
base_url: StringBase URL for the API (e.g., https://openrouter.ai/api/v1)
model: StringModel identifier (e.g., “anthropic/claude-3.5-sonnet”)
api_key: Option<SecretString>API key (stored securely)
organization_id: Option<String>Optional organization ID
custom_headers: Vec<(String, String)>Custom headers to include in requests
supports_streaming: boolWhether this provider supports streaming
supports_vision: boolWhether this provider supports vision/images
supports_audio: boolWhether this provider supports audio input
max_context_length: Option<usize>Maximum context length (tokens)
default_params: CompletionParametersDefault completion parameters for this generator
Implementations§
Source§impl GeneratorInfo
impl GeneratorInfo
Sourcepub fn new(
name: impl Into<String>,
base_url: impl Into<String>,
model: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, base_url: impl Into<String>, model: impl Into<String>, ) -> Self
Create a new GeneratorInfo with minimal configuration
Sourcepub fn with_api_key(self, key: impl Into<String>) -> Self
pub fn with_api_key(self, key: impl Into<String>) -> Self
Set the API key
Sourcepub fn with_api_key_from_env(self, env_var: &str) -> Self
pub fn with_api_key_from_env(self, env_var: &str) -> Self
Set API key from environment variable
Sourcepub fn with_header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Add a custom header
Sourcepub fn with_vision(self) -> Self
pub fn with_vision(self) -> Self
Enable vision support
Sourcepub fn with_audio(self) -> Self
pub fn with_audio(self) -> Self
Enable audio support
Sourcepub fn with_max_context(self, length: usize) -> Self
pub fn with_max_context(self, length: usize) -> Self
Set max context length
Sourcepub fn with_default_params(self, params: CompletionParameters) -> Self
pub fn with_default_params(self, params: CompletionParameters) -> Self
Set default completion parameters
Sourcepub fn completions_url(&self) -> String
pub fn completions_url(&self) -> String
Get the full completions endpoint URL
Trait Implementations§
Source§impl Clone for GeneratorInfo
impl Clone for GeneratorInfo
Source§fn clone(&self) -> GeneratorInfo
fn clone(&self) -> GeneratorInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GeneratorInfo
impl RefUnwindSafe for GeneratorInfo
impl Send for GeneratorInfo
impl Sync for GeneratorInfo
impl Unpin for GeneratorInfo
impl UnwindSafe for GeneratorInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more