diff --git a/x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap b/x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap index e876d601bf7cb..c4e3e77eab4f1 100644 --- a/x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap +++ b/x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap @@ -10706,6 +10706,27 @@ Object { ], "type": "number", }, + "defaultModel": Object { + "flags": Object { + "default": [Function], + "error": [Function], + "presence": "optional", + }, + "metas": Array [ + Object { + "x-oas-optional": true, + }, + ], + "rules": Array [ + Object { + "args": Object { + "method": [Function], + }, + "name": "custom", + }, + ], + "type": "string", + }, "headers": Object { "flags": Object { "default": [Function], diff --git a/x-pack/platform/plugins/shared/stack_connectors/common/openai/schema.ts b/x-pack/platform/plugins/shared/stack_connectors/common/openai/schema.ts index db64b1f10ad2b..e54c09c66aa15 100644 --- a/x-pack/platform/plugins/shared/stack_connectors/common/openai/schema.ts +++ b/x-pack/platform/plugins/shared/stack_connectors/common/openai/schema.ts @@ -20,6 +20,7 @@ export const ConfigSchema = schema.oneOf([ apiUrl: schema.string(), headers: schema.maybe(schema.recordOf(schema.string(), schema.string())), contextWindowLength: schema.maybe(schema.number({})), + defaultModel: schema.maybe(schema.string()), }), schema.object({ apiProvider: schema.oneOf([schema.literal(OpenAiProviderType.OpenAi)]), diff --git a/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/openai/openai.ts b/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/openai/openai.ts index 6f3abebc57eef..af6602f28b280 100644 --- a/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/openai/openai.ts +++ b/x-pack/platform/plugins/shared/stack_connectors/server/connector_types/openai/openai.ts @@ -424,7 +424,9 @@ export class OpenAIConnector extends SubActionConnector { messages, model: rest.model ?? - ('defaultModel' in this.config ? this.config.defaultModel : DEFAULT_OPENAI_MODEL), + ('defaultModel' in this.config + ? this.config.defaultModel ?? DEFAULT_OPENAI_MODEL + : DEFAULT_OPENAI_MODEL), }; connectorUsageCollector.addRequestBodyBytes(undefined, requestBody);