Skip to content

Commit

Permalink
feat: Allow to customize OpenAI-Beta header in openai_dart (davidmigl…
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmigloz authored and KennethKnudsen97 committed Oct 1, 2024
1 parent 52e5b00 commit 3a7e15d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/openai_dart/lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class OpenAIClient extends g.OpenAIClient {
/// - `apiKey`: your OpenAI API key. You can find your API key in the
/// [OpenAI dashboard](https://platform.openai.com/account/api-keys).
/// - `organization`: your OpenAI organization ID (if applicable).
/// - `beta`: the content to use for the `OpenAI-Beta` header which can be
/// used to enable beta features.
///
/// Advance configuration options:
/// - `baseUrl`: the base URL to use. Defaults to OpenAI's API URL. You can
Expand All @@ -32,6 +34,7 @@ class OpenAIClient extends g.OpenAIClient {
OpenAIClient({
final String? apiKey,
final String? organization,
final String? beta = 'assistants=v2',
final String? baseUrl,
final Map<String, String>? headers,
final Map<String, dynamic>? queryParams,
Expand All @@ -41,7 +44,7 @@ class OpenAIClient extends g.OpenAIClient {
baseUrl: baseUrl,
headers: {
if (organization != null) 'OpenAI-Organization': organization,
'OpenAI-Beta': 'assistants=v2',
if (beta != null) 'OpenAI-Beta': beta,
...?headers,
},
queryParams: queryParams ?? const {},
Expand Down

0 comments on commit 3a7e15d

Please sign in to comment.