Skip to content

Commit dafd212

Browse files
committed
feat!: remove api_key and api_base from config trait
when creating a custom config, it is not clear why these methods would need to be implemented
1 parent 61ab980 commit dafd212

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

async-openai/src/config.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ pub trait Config: Send + Sync {
1919
fn headers(&self) -> HeaderMap;
2020
fn url(&self, path: &str) -> String;
2121
fn query(&self) -> Vec<(&str, &str)>;
22-
23-
fn api_base(&self) -> &str;
24-
25-
fn api_key(&self) -> &SecretString;
2622
}
2723

2824
/// Macro to implement Config trait for pointer types with dyn objects
@@ -38,12 +34,6 @@ macro_rules! impl_config_for_ptr {
3834
fn query(&self) -> Vec<(&str, &str)> {
3935
self.as_ref().query()
4036
}
41-
fn api_base(&self) -> &str {
42-
self.as_ref().api_base()
43-
}
44-
fn api_key(&self) -> &SecretString {
45-
self.as_ref().api_key()
46-
}
4737
}
4838
};
4939
}
@@ -145,14 +135,6 @@ impl Config for OpenAIConfig {
145135
format!("{}{}", self.api_base, path)
146136
}
147137

148-
fn api_base(&self) -> &str {
149-
&self.api_base
150-
}
151-
152-
fn api_key(&self) -> &SecretString {
153-
&self.api_key
154-
}
155-
156138
fn query(&self) -> Vec<(&str, &str)> {
157139
vec![]
158140
}
@@ -225,14 +207,6 @@ impl Config for AzureConfig {
225207
)
226208
}
227209

228-
fn api_base(&self) -> &str {
229-
&self.api_base
230-
}
231-
232-
fn api_key(&self) -> &SecretString {
233-
&self.api_key
234-
}
235-
236210
fn query(&self) -> Vec<(&str, &str)> {
237211
vec![("api-version", &self.api_version)]
238212
}

0 commit comments

Comments
 (0)