Skip to content
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

Fix OpenAI tools types #758

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clever-jobs-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"inngest": patch
---

Fix OpenAI `tools` types - not properly scoped
67 changes: 37 additions & 30 deletions packages/inngest/src/components/ai/adapters/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, unknown>;
/**
* 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<string, unknown>;

/**
* 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;
};
}[];

/**
Expand Down
Loading