diff --git a/CHANGELOG.md b/CHANGELOG.md index 222887e9d..041d18134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Linear issue links in chat responses now render as a rich card-style UI showing the Linear logo, issue identifier, and title instead of plain hyperlinks. [#1060](https://github.com/sourcebot-dev/sourcebot/pull/1060) +- Added `reasoningEffort` configuration option for the Azure OpenAI provider. [#1101](https://github.com/sourcebot-dev/sourcebot/pull/1101) ### Changed - Links in Ask Sourcebot chat responses now open in a new tab with a subtle external link icon indicator. [#1059](https://github.com/sourcebot-dev/sourcebot/pull/1059) diff --git a/docs/docs/configuration/language-model-providers.mdx b/docs/docs/configuration/language-model-providers.mdx index 91aab43de..d4830e26a 100644 --- a/docs/docs/configuration/language-model-providers.mdx +++ b/docs/docs/configuration/language-model-providers.mdx @@ -107,20 +107,23 @@ For a detailed description of all the providers, please refer to the [schema](ht [Vercel AI SDK Azure OpenAI Docs](https://ai-sdk.dev/providers/ai-sdk-providers/azure) +The `model` field should be set to your Azure OpenAI deployment name. Either `resourceName` or `baseUrl` must be set. The `resourceName` is used to construct the URL `https://{resourceName}.openai.azure.com/openai/v1{path}`. If `baseUrl` is provided, `resourceName` is ignored. + ```json wrap icon="code" Example config with Azure AI provider { "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json", "models": [ { "provider": "azure", - "model": "YOUR_MODEL_HERE", + "model": "YOUR_DEPLOYMENT_NAME", "displayName": "OPTIONAL_DISPLAY_NAME", "resourceName": "YOUR_RESOURCE_NAME", // defaults to the AZURE_RESOURCE_NAME env var if not set - "apiVersion": "OPTIONAL_API_VERSION", // defaults to 'preview' if not set + "apiVersion": "OPTIONAL_API_VERSION", "token": { "env": "AZURE_API_KEY" }, - "baseUrl": "OPTIONAL_BASE_URL" + "baseUrl": "OPTIONAL_BASE_URL", // use instead of resourceName for custom endpoints + "reasoningEffort": "OPTIONAL_REASONING_EFFORT" // defaults to "medium" } ] } diff --git a/docs/snippets/schemas/v3/index.schema.mdx b/docs/snippets/schemas/v3/index.schema.mdx index 1b5ae0828..1c1706e4c 100644 --- a/docs/snippets/schemas/v3/index.schema.mdx +++ b/docs/snippets/schemas/v3/index.schema.mdx @@ -2058,6 +2058,16 @@ "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "type": "object", "description": "Optional headers to use with the model.", @@ -3518,6 +3528,16 @@ "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "type": "object", "description": "Optional headers to use with the model.", diff --git a/docs/snippets/schemas/v3/languageModel.schema.mdx b/docs/snippets/schemas/v3/languageModel.schema.mdx index 7d3eff422..50250147d 100644 --- a/docs/snippets/schemas/v3/languageModel.schema.mdx +++ b/docs/snippets/schemas/v3/languageModel.schema.mdx @@ -372,6 +372,16 @@ "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "type": "object", "description": "Optional headers to use with the model.", @@ -1832,6 +1842,16 @@ "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "type": "object", "description": "Optional headers to use with the model.", diff --git a/packages/schemas/src/v3/index.schema.ts b/packages/schemas/src/v3/index.schema.ts index 6096b8814..3ab02b0ef 100644 --- a/packages/schemas/src/v3/index.schema.ts +++ b/packages/schemas/src/v3/index.schema.ts @@ -2057,6 +2057,16 @@ const schema = { "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "type": "object", "description": "Optional headers to use with the model.", @@ -3517,6 +3527,16 @@ const schema = { "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "type": "object", "description": "Optional headers to use with the model.", diff --git a/packages/schemas/src/v3/index.type.ts b/packages/schemas/src/v3/index.type.ts index 48ec4086b..caff06e62 100644 --- a/packages/schemas/src/v3/index.type.ts +++ b/packages/schemas/src/v3/index.type.ts @@ -868,6 +868,10 @@ export interface AzureLanguageModel { * Use a different URL prefix for API calls. Either this or `resourceName` can be used. */ 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; headers?: LanguageModelHeaders; } export interface DeepSeekLanguageModel { diff --git a/packages/schemas/src/v3/languageModel.schema.ts b/packages/schemas/src/v3/languageModel.schema.ts index 5832ddfcb..65c2e5df3 100644 --- a/packages/schemas/src/v3/languageModel.schema.ts +++ b/packages/schemas/src/v3/languageModel.schema.ts @@ -371,6 +371,16 @@ const schema = { "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "type": "object", "description": "Optional headers to use with the model.", @@ -1831,6 +1841,16 @@ const schema = { "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "type": "object", "description": "Optional headers to use with the model.", diff --git a/packages/schemas/src/v3/languageModel.type.ts b/packages/schemas/src/v3/languageModel.type.ts index fad8f6cc7..5741925be 100644 --- a/packages/schemas/src/v3/languageModel.type.ts +++ b/packages/schemas/src/v3/languageModel.type.ts @@ -202,6 +202,10 @@ export interface AzureLanguageModel { * Use a different URL prefix for API calls. Either this or `resourceName` can be used. */ 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; headers?: LanguageModelHeaders; } export interface DeepSeekLanguageModel { diff --git a/packages/web/src/features/chat/utils.server.ts b/packages/web/src/features/chat/utils.server.ts index 43faa4abe..21af2e99d 100644 --- a/packages/web/src/features/chat/utils.server.ts +++ b/packages/web/src/features/chat/utils.server.ts @@ -234,6 +234,11 @@ export const getAISDKLanguageModelAndOptions = async (config: LanguageModel): Pr return { model: azure(modelId), + providerOptions: { + openai: { + reasoningEffort: config.reasoningEffort ?? 'medium', + } satisfies OpenAIResponsesProviderOptions, + } }; } case 'deepseek': { diff --git a/schemas/v3/languageModel.json b/schemas/v3/languageModel.json index 7d2b261e7..f9557b556 100644 --- a/schemas/v3/languageModel.json +++ b/schemas/v3/languageModel.json @@ -126,6 +126,16 @@ "pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$", "description": "Use a different URL prefix for API calls. Either this or `resourceName` can be used." }, + "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" + ] + }, "headers": { "$ref": "./shared.json#/definitions/LanguageModelHeaders" }