-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: add openAiNativeStatelessMode configuration option #7792
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -255,7 +255,8 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio | |||||
| model: model.id, | ||||||
| input: formattedInput, | ||||||
| stream: true, | ||||||
| store: metadata?.store !== false, // Default to true unless explicitly set to false | ||||||
| // Check if stateless mode is enabled in configuration, otherwise use metadata.store | ||||||
| store: this.options.openAiNativeStatelessMode ? false : metadata?.store !== false, | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider extracting the store property logic into a helper method like |
||||||
| // Always include instructions (system prompt) for Responses API. | ||||||
| // Unlike Chat Completions, system/developer roles in input have no special semantics here. | ||||||
| // The official way to set system behavior is the top-level `instructions` field. | ||||||
|
|
@@ -1286,7 +1287,8 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio | |||||
| }, | ||||||
| ], | ||||||
| stream: false, // Non-streaming for completePrompt | ||||||
| store: false, // Don't store prompt completions | ||||||
| // Use stateless mode if configured, otherwise don't store prompt completions | ||||||
| store: this.options.openAiNativeStatelessMode ? false : false, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In completePrompt, the code sets the store field as: store: this.options.openAiNativeStatelessMode ? false : false This always yields false. If prompt completions are meant to be non-stored regardless of configuration, consider simplifying to a literal false and adding a comment to explain the rationale.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this intentional? The expression |
||||||
| } | ||||||
|
|
||||||
| // Include service tier if selected and supported | ||||||
|
|
||||||
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.
Would it be helpful to add a test case for when
openAiNativeStatelessModeistrueANDmetadata.storeis explicitly set totrue? This would verify that the global setting takes precedence over per-request settings as documented.