pub struct ProviderConfig {
pub base_url: String,
pub api_key_env: String,
pub chat_endpoint: String,
pub upload_endpoint: Option<String>,
pub upload_size_limit: Option<u64>,
pub models_endpoint: Option<String>,
pub headers: HashMap<String, String>,
pub field_mapping: FieldMapping,
}
Expand description
提供商配置模板,定义API访问参数
Provider configuration template defining API access parameters
Fields§
§base_url: String
Base URL
api_key_env: String
API key environment variable name
chat_endpoint: String
Chat completion endpoint path
upload_endpoint: Option<String>
Optional file upload endpoint path (e.g. OpenAI: “/v1/files”)
upload_size_limit: Option<u64>
Optional file size limit (bytes) above which files should be uploaded instead of inlined
models_endpoint: Option<String>
Model list endpoint path
headers: HashMap<String, String>
Request headers template
field_mapping: FieldMapping
Field mapping configuration
Implementations§
Source§impl ProviderConfig
impl ProviderConfig
Sourcepub fn openai_compatible(base_url: &str, api_key_env: &str) -> Self
pub fn openai_compatible(base_url: &str, api_key_env: &str) -> Self
OpenAI-compatible configuration template
Sourcepub fn validate(&self) -> Result<(), AiLibError>
pub fn validate(&self) -> Result<(), AiLibError>
Sourcepub fn models_url(&self) -> Option<String>
pub fn models_url(&self) -> Option<String>
获取完整的模型列表URL
Sourcepub fn upload_url(&self) -> Option<String>
pub fn upload_url(&self) -> Option<String>
获取完整的文件上传URL
Trait Implementations§
Source§impl Clone for ProviderConfig
impl Clone for ProviderConfig
Source§fn clone(&self) -> ProviderConfig
fn clone(&self) -> ProviderConfig
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 ProviderConfig
impl Debug for ProviderConfig
Source§impl<'de> Deserialize<'de> for ProviderConfig
impl<'de> Deserialize<'de> for ProviderConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ProviderConfig
impl RefUnwindSafe for ProviderConfig
impl Send for ProviderConfig
impl Sync for ProviderConfig
impl Unpin for ProviderConfig
impl UnwindSafe for ProviderConfig
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