-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add with_headers method #245
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR, I'll leave review seperately |
@@ -31,17 +33,28 @@ pub trait Config: Clone { | |||
pub struct OpenAIConfig { | |||
api_base: String, | |||
api_key: Secret<String>, | |||
#[serde(deserialize_with = "deserialize_header_map")] | |||
headers: HashMap<String, String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use native HeaderMap
instead of custom conversion with custom deserializer.
impl Default for OpenAIConfig { | ||
fn default() -> Self { | ||
Self { | ||
api_base: OPENAI_API_BASE.to_string(), | ||
api_key: std::env::var("OPENAI_API_KEY") | ||
.unwrap_or_else(|_| "".to_string()) | ||
.into(), | ||
headers: HashMap::new(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: since this is platform independent - this and with_headers
could be a nice addition to AzureConfig as well for consistency. Not required though.
Support custom headers required for observability applications