feat(ask_sb): Add reasoningEffort option to openai provider (#446)

This commit is contained in:
Brendan Kellam 2025-08-07 17:26:51 -07:00 committed by GitHub
parent 6215a8e949
commit 0773399392
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 102 additions and 2 deletions

View file

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Added multi-branch indexing support for Gerrit. [#433](https://github.com/sourcebot-dev/sourcebot/pull/433) - Added multi-branch indexing support for Gerrit. [#433](https://github.com/sourcebot-dev/sourcebot/pull/433)
- [ask sb] Added `reasoningEffort` option to OpenAI provider. [#446](https://github.com/sourcebot-dev/sourcebot/pull/446)
### Fixed ### Fixed
- Removed prefix from structured log output. [#443](https://github.com/sourcebot-dev/sourcebot/pull/443) - Removed prefix from structured log output. [#443](https://github.com/sourcebot-dev/sourcebot/pull/443)

View file

@ -248,7 +248,8 @@ For a detailed description of all the providers, please refer to the [schema](ht
"token": { "token": {
"env": "OPENAI_API_KEY" "env": "OPENAI_API_KEY"
}, },
"baseUrl": "OPTIONAL_BASE_URL" "baseUrl": "OPTIONAL_BASE_URL",
"reasoningEffort": "OPTIONAL_REASONING_EFFORT" // defaults to "medium"
} }
] ]
} }

View file

@ -1818,6 +1818,16 @@
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [
@ -2624,6 +2634,16 @@
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [

View file

@ -615,6 +615,16 @@
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [
@ -1421,6 +1431,16 @@
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [

View file

@ -1817,6 +1817,16 @@ const schema = {
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [
@ -2623,6 +2633,16 @@ const schema = {
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [

View file

@ -792,6 +792,10 @@ export interface OpenAILanguageModel {
* Optional base URL. * Optional base URL.
*/ */
baseUrl?: string; baseUrl?: string;
/**
* The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings
*/
reasoningEffort?: string;
} }
export interface OpenAICompatibleLanguageModel { export interface OpenAICompatibleLanguageModel {
/** /**

View file

@ -614,6 +614,16 @@ const schema = {
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [
@ -1420,6 +1430,16 @@ const schema = {
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [

View file

@ -363,6 +363,10 @@ export interface OpenAILanguageModel {
* Optional base URL. * Optional base URL.
*/ */
baseUrl?: string; baseUrl?: string;
/**
* The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings
*/
reasoningEffort?: string;
} }
export interface OpenAICompatibleLanguageModel { export interface OpenAICompatibleLanguageModel {
/** /**

View file

@ -440,7 +440,7 @@ const getAISDKLanguageModelAndOptions = async (config: LanguageModel, orgId: num
model: openai(modelId), model: openai(modelId),
providerOptions: { providerOptions: {
openai: { openai: {
reasoningEffort: 'high' reasoningEffort: config.reasoningEffort ?? 'medium'
} satisfies OpenAIResponsesProviderOptions, } satisfies OpenAIResponsesProviderOptions,
}, },
}; };

View file

@ -343,6 +343,16 @@
"format": "url", "format": "url",
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$",
"description": "Optional base URL." "description": "Optional base URL."
},
"reasoningEffort": {
"type": "string",
"description": "The reasoning effort to use with the model. Defaults to `medium`. See https://platform.openai.com/docs/guides/reasoning#get-started-with-reasonings",
"examples": [
"minimal",
"low",
"medium",
"high"
]
} }
}, },
"required": [ "required": [