diff --git a/.changeset/clever-jobs-hammer.md b/.changeset/clever-jobs-hammer.md new file mode 100644 index 000000000..7338a9f33 --- /dev/null +++ b/.changeset/clever-jobs-hammer.md @@ -0,0 +1,5 @@ +--- +"inngest": patch +--- + +Fix OpenAI `tools` types - not properly scoped diff --git a/packages/inngest/src/components/ai/adapters/openai.ts b/packages/inngest/src/components/ai/adapters/openai.ts index f8f17c308..cdb081a35 100644 --- a/packages/inngest/src/components/ai/adapters/openai.ts +++ b/packages/inngest/src/components/ai/adapters/openai.ts @@ -270,40 +270,47 @@ export interface OpenAiAiAdapter extends AiAdapter { */ tools?: { /** - * The name of the function to be called. Must be a-z, A-Z, 0-9, or - * contain underscores and dashes, with a maximum length of 64. + * The type of the tool. */ - name: string; + type: "function"; - /** - * A description of what the function does, used by the model to choose - * when and how to call the function. - */ - description?: string; + function: { + /** + * The name of the function to be called. Must be a-z, A-Z, 0-9, or + * contain underscores and dashes, with a maximum length of 64. + */ + name: string; - /** - * The parameters the functions accepts, described as a JSON Schema - * object. See the - * [guide](https://platform.openai.com/docs/guides/function-calling) for - * examples, and the [JSON Schema - * reference](https://json-schema.org/understanding-json-schema/) for - * documentation about the format. - * - * Omitting `parameters` defines a function with an empty parameter - * list. - */ - parameters?: Record; + /** + * A description of what the function does, used by the model to choose + * when and how to call the function. + */ + description?: string; - /** - * Whether to enable strict schema adherence when generating the - * function call. If set to true, the model will follow the exact schema - * defined in the `parameters field`. Only a subset of JSON Schema is - * supported when `strict` is `true`. Learn more about Structured - * Outputs in the function calling guide. - * - * @default false - */ - strict?: boolean; + /** + * The parameters the functions accepts, described as a JSON Schema + * object. See the + * [guide](https://platform.openai.com/docs/guides/function-calling) for + * examples, and the [JSON Schema + * reference](https://json-schema.org/understanding-json-schema/) for + * documentation about the format. + * + * Omitting `parameters` defines a function with an empty parameter + * list. + */ + parameters?: Record; + + /** + * Whether to enable strict schema adherence when generating the + * function call. If set to true, the model will follow the exact schema + * defined in the `parameters field`. Only a subset of JSON Schema is + * supported when `strict` is `true`. Learn more about Structured + * Outputs in the function calling guide. + * + * @default false + */ + strict?: boolean; + }; }[]; /**