pub struct OpenAICompatibleConfig {
pub provider_name: String,
pub api_key: String,
pub model: String,
pub base_url: Option<String>,
pub organization_id: Option<String>,
pub project_id: Option<String>,
pub reasoning_effort: Option<ReasoningEffort>,
}Available on crate features
models and openai only.Expand description
Configuration for OpenAI-compatible providers.
Fields§
§provider_name: StringProvider display name used in error messages.
api_key: StringAPI key.
model: StringModel name.
base_url: Option<String>Optional API base URL.
organization_id: Option<String>Optional organization ID.
project_id: Option<String>Optional project ID for providers that support it.
reasoning_effort: Option<ReasoningEffort>Optional reasoning effort for OpenAI reasoning models.
Implementations§
Source§impl OpenAICompatibleConfig
impl OpenAICompatibleConfig
Sourcepub fn new(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn new( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
Create config for an OpenAI-compatible provider.
Sourcepub fn with_provider_name(
self,
provider_name: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn with_provider_name( self, provider_name: impl Into<String>, ) -> OpenAICompatibleConfig
Set provider display name used in errors.
Sourcepub fn with_base_url(
self,
base_url: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn with_base_url( self, base_url: impl Into<String>, ) -> OpenAICompatibleConfig
Set a custom API base URL.
Sourcepub fn with_organization(
self,
organization_id: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn with_organization( self, organization_id: impl Into<String>, ) -> OpenAICompatibleConfig
Set organization ID.
Sourcepub fn with_project(
self,
project_id: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn with_project( self, project_id: impl Into<String>, ) -> OpenAICompatibleConfig
Set project ID.
Sourcepub fn with_reasoning_effort(
self,
effort: ReasoningEffort,
) -> OpenAICompatibleConfig
pub fn with_reasoning_effort( self, effort: ReasoningEffort, ) -> OpenAICompatibleConfig
Set reasoning effort for reasoning models.
Sourcepub fn fireworks(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn fireworks( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
Fireworks AI preset.
Default model: accounts/fireworks/models/llama-v3p1-8b-instruct
Sourcepub fn together(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn together( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
Together AI preset.
Default model: meta-llama/Llama-3.3-70B-Instruct-Turbo
Sourcepub fn mistral(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn mistral( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
Mistral AI preset.
Default model: mistral-small-latest
Sourcepub fn perplexity(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn perplexity( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
Perplexity preset.
Default model: sonar
Sourcepub fn cerebras(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
pub fn cerebras( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
Cerebras preset.
Default model: llama-3.3-70b
Trait Implementations§
Source§impl Clone for OpenAICompatibleConfig
impl Clone for OpenAICompatibleConfig
Source§fn clone(&self) -> OpenAICompatibleConfig
fn clone(&self) -> OpenAICompatibleConfig
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 moreSource§impl Debug for OpenAICompatibleConfig
impl Debug for OpenAICompatibleConfig
Source§impl<'de> Deserialize<'de> for OpenAICompatibleConfig
impl<'de> Deserialize<'de> for OpenAICompatibleConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OpenAICompatibleConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OpenAICompatibleConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for OpenAICompatibleConfig
impl Serialize for OpenAICompatibleConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for OpenAICompatibleConfig
impl RefUnwindSafe for OpenAICompatibleConfig
impl Send for OpenAICompatibleConfig
impl Sync for OpenAICompatibleConfig
impl Unpin for OpenAICompatibleConfig
impl UnsafeUnpin for OpenAICompatibleConfig
impl UnwindSafe for OpenAICompatibleConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.