OpenaiEnvironment

Trait OpenaiEnvironment 

Source
pub trait OpenaiEnvironment:
    Send
    + Sync
    + 'static {
    // Required methods
    fn api_key(&self) -> &Secret;
    fn organization_id(&self) -> Option<&str>;
    fn project_id(&self) -> Option<&str>;
    fn base_url(&self) -> &Url;
    fn realtime_base_url(&self) -> &Url;
    fn diagnostics_config(&self) -> Option<&DiagnosticsConfig>;
    fn headers(&self) -> Result<HeaderMap>;
    fn join_base_url(&self, path: &str) -> Result<Url>;
    fn join_realtime_base_url(&self, path: &str) -> Result<Url>;
}
Expand description

A trait defining the interface for OpenAI environment configuration.

Required Methods§

Source

fn api_key(&self) -> &Secret

Returns the API key.

Source

fn organization_id(&self) -> Option<&str>

Returns the organization ID, if available.

Source

fn project_id(&self) -> Option<&str>

Returns the project ID, if available.

Source

fn base_url(&self) -> &Url

Returns the base URL for the OpenAI API.

Source

fn realtime_base_url(&self) -> &Url

Returns the base URL for the OpenAI Realtime API.

Source

fn diagnostics_config(&self) -> Option<&DiagnosticsConfig>

Returns the diagnostics configuration, if available.

Source

fn headers(&self) -> Result<HeaderMap>

Returns the HTTP headers for the OpenAI API.

§Errors

Returns OpenAIError::InvalidArgument if headers contain invalid values.

Source

fn join_base_url(&self, path: &str) -> Result<Url>

Joins a path to the base URL.

§Errors

Returns OpenAIError::Internal if URL joining fails.

Source

fn join_realtime_base_url(&self, path: &str) -> Result<Url>

Joins a path to the realtime base URL.

§Errors

Returns OpenAIError::Internal if URL joining fails.

Implementors§