pub struct ProtocolModelClient { /* private fields */ }Expand description
Shared production model client for a supported wire protocol family.
Implementations§
Source§impl ProtocolModelClient
impl ProtocolModelClient
Sourcepub fn openai_chat(
model_name: impl Into<String>,
token: impl Into<String>,
) -> Result<Self, ModelError>
pub fn openai_chat( model_name: impl Into<String>, token: impl Into<String>, ) -> Result<Self, ModelError>
Create an OpenAI Chat Completions client.
§Errors
Returns an error when the default HTTP client cannot be created.
Sourcepub fn openai_responses(
model_name: impl Into<String>,
token: impl Into<String>,
) -> Result<Self, ModelError>
pub fn openai_responses( model_name: impl Into<String>, token: impl Into<String>, ) -> Result<Self, ModelError>
Create an OpenAI Responses client.
§Errors
Returns an error when the default HTTP client cannot be created.
Sourcepub fn anthropic_messages(
model_name: impl Into<String>,
api_key: impl Into<String>,
) -> Result<Self, ModelError>
pub fn anthropic_messages( model_name: impl Into<String>, api_key: impl Into<String>, ) -> Result<Self, ModelError>
Create an Anthropic Messages client.
§Errors
Returns an error when the default HTTP client cannot be created.
Sourcepub fn gemini_generate_content(
model_name: impl Into<String>,
api_key: impl Into<String>,
) -> Result<Self, ModelError>
pub fn gemini_generate_content( model_name: impl Into<String>, api_key: impl Into<String>, ) -> Result<Self, ModelError>
Create a Gemini generateContent client.
§Errors
Returns an error when the default HTTP client cannot be created.
Sourcepub fn bedrock_converse_gateway(
model_name: impl Into<String>,
http_config: HttpModelConfig,
http_client: DynHttpClient,
) -> Self
pub fn bedrock_converse_gateway( model_name: impl Into<String>, http_config: HttpModelConfig, http_client: DynHttpClient, ) -> Self
Create a Bedrock Converse client for a gateway endpoint.
Bedrock production calls usually require AWS SigV4. Gateways and signed clients can inject
the final endpoint and headers through HttpModelConfig and ModelHttpClient.
Source§impl ProtocolModelClient
impl ProtocolModelClient
Sourcepub fn new(
provider_name: impl Into<String>,
model_name: impl Into<String>,
profile: ModelProfile,
http_config: HttpModelConfig,
http_client: DynHttpClient,
) -> Self
pub fn new( provider_name: impl Into<String>, model_name: impl Into<String>, profile: ModelProfile, http_config: HttpModelConfig, http_client: DynHttpClient, ) -> Self
Create a protocol client with an injected HTTP client.
Sourcepub fn with_default_settings(self, settings: ModelSettings) -> Self
pub fn with_default_settings(self, settings: ModelSettings) -> Self
Set adapter-level default settings.
Sourcepub fn with_profile(self, profile: ModelProfile) -> Self
pub fn with_profile(self, profile: ModelProfile) -> Self
Override the model capability profile.
Sourcepub fn with_sleeper(self, sleeper: DynSleeper) -> Self
pub fn with_sleeper(self, sleeper: DynSleeper) -> Self
Set a custom sleeper for retry policy execution.
Sourcepub fn with_provider_request_audit(
self,
recorder: DynProviderRequestAuditRecorder,
policy: ProviderRequestAuditPolicy,
) -> Self
pub fn with_provider_request_audit( self, recorder: DynProviderRequestAuditRecorder, policy: ProviderRequestAuditPolicy, ) -> Self
Record provider HTTP request audit snapshots outside redacted trace events.