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

release: 4.33.0 #760

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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.32.2"
".": "4.33.0"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 4.33.0 (2024-04-05)

Full Changelog: [v4.32.2...v4.33.0](https://github.com/openai/openai-node/compare/v4.32.2...v4.33.0)

### Features

* **api:** add additional messages when creating thread run ([#759](https://github.com/openai/openai-node/issues/759)) ([f1fdb41](https://github.com/openai/openai-node/commit/f1fdb410e087f9b94faeda0558de573ec1118601))

## 4.32.2 (2024-04-04)

Full Changelog: [v4.32.1...v4.32.2](https://github.com/openai/openai-node/compare/v4.32.1...v4.32.2)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can import in Deno via:
<!-- x-release-please-start-version -->

```ts
import OpenAI from 'https://deno.land/x/openai@v4.32.2/mod.ts';
import OpenAI from 'https://deno.land/x/openai@v4.33.0/mod.ts';
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion build-deno
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This is a build produced from https://github.com/openai/openai-node – please g
Usage:

\`\`\`ts
import OpenAI from "https://deno.land/x/openai@v4.32.2/mod.ts";
import OpenAI from "https://deno.land/x/openai@v4.33.0/mod.ts";

const client = new OpenAI();
\`\`\`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openai",
"version": "4.32.2",
"version": "4.33.0",
"description": "The official TypeScript library for the OpenAI API",
"author": "OpenAI <support@openai.com>",
"types": "dist/index.d.ts",
Expand Down
158 changes: 158 additions & 0 deletions src/resources/beta/threads/runs/runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ export interface RunCreateParamsBase {
*/
additional_instructions?: string | null;

/**
* Adds additional messages to the thread before creating the run.
*/
additional_messages?: Array<RunCreateParams.AdditionalMessage> | null;

/**
* Overrides the
* [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
Expand Down Expand Up @@ -574,6 +579,39 @@ export interface RunCreateParamsBase {
}

export namespace RunCreateParams {
export interface AdditionalMessage {
/**
* The content of the message.
*/
content: string;

/**
* The role of the entity that is creating the message. Allowed values include:
*
* - `user`: Indicates the message is sent by an actual user and should be used in
* most cases to represent user-generated messages.
* - `assistant`: Indicates the message is generated by the assistant. Use this
* value to insert messages from the assistant into the conversation.
*/
role: 'user' | 'assistant';

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
* the message should use. There can be a maximum of 10 files attached to a
* message. Useful for tools like `retrieval` and `code_interpreter` that can
* access and use files.
*/
file_ids?: Array<string>;

/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format. Keys
* can be a maximum of 64 characters long and values can be a maxium of 512
* characters long.
*/
metadata?: unknown | null;
}

export type RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming;
export type RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming;
}
Expand Down Expand Up @@ -637,6 +675,11 @@ export interface RunCreateAndPollParams {
*/
additional_instructions?: string | null;

/**
* Adds additional messages to the thread before creating the run.
*/
additional_messages?: Array<RunCreateAndPollParams.AdditionalMessage> | null;

/**
* Overrides the
* [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
Expand Down Expand Up @@ -674,6 +717,41 @@ export interface RunCreateAndPollParams {
tools?: Array<AssistantsAPI.AssistantTool> | null;
}

export namespace RunCreateAndPollParams {
export interface AdditionalMessage {
/**
* The content of the message.
*/
content: string;

/**
* The role of the entity that is creating the message. Allowed values include:
*
* - `user`: Indicates the message is sent by an actual user and should be used in
* most cases to represent user-generated messages.
* - `assistant`: Indicates the message is generated by the assistant. Use this
* value to insert messages from the assistant into the conversation.
*/
role: 'user' | 'assistant';

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
* the message should use. There can be a maximum of 10 files attached to a
* message. Useful for tools like `retrieval` and `code_interpreter` that can
* access and use files.
*/
file_ids?: Array<string>;

/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format. Keys
* can be a maximum of 64 characters long and values can be a maxium of 512
* characters long.
*/
metadata?: unknown | null;
}
}

export interface RunCreateAndStreamParams {
/**
* The ID of the
Expand All @@ -689,6 +767,11 @@ export interface RunCreateAndStreamParams {
*/
additional_instructions?: string | null;

/**
* Adds additional messages to the thread before creating the run.
*/
additional_messages?: Array<RunCreateAndStreamParams.AdditionalMessage> | null;

/**
* Overrides the
* [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
Expand Down Expand Up @@ -726,6 +809,41 @@ export interface RunCreateAndStreamParams {
tools?: Array<AssistantsAPI.AssistantTool> | null;
}

export namespace RunCreateAndStreamParams {
export interface AdditionalMessage {
/**
* The content of the message.
*/
content: string;

/**
* The role of the entity that is creating the message. Allowed values include:
*
* - `user`: Indicates the message is sent by an actual user and should be used in
* most cases to represent user-generated messages.
* - `assistant`: Indicates the message is generated by the assistant. Use this
* value to insert messages from the assistant into the conversation.
*/
role: 'user' | 'assistant';

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
* the message should use. There can be a maximum of 10 files attached to a
* message. Useful for tools like `retrieval` and `code_interpreter` that can
* access and use files.
*/
file_ids?: Array<string>;

/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format. Keys
* can be a maximum of 64 characters long and values can be a maxium of 512
* characters long.
*/
metadata?: unknown | null;
}
}

export interface RunStreamParams {
/**
* The ID of the
Expand All @@ -741,6 +859,11 @@ export interface RunStreamParams {
*/
additional_instructions?: string | null;

/**
* Adds additional messages to the thread before creating the run.
*/
additional_messages?: Array<RunStreamParams.AdditionalMessage> | null;

/**
* Overrides the
* [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
Expand Down Expand Up @@ -778,6 +901,41 @@ export interface RunStreamParams {
tools?: Array<AssistantsAPI.AssistantTool> | null;
}

export namespace RunStreamParams {
export interface AdditionalMessage {
/**
* The content of the message.
*/
content: string;

/**
* The role of the entity that is creating the message. Allowed values include:
*
* - `user`: Indicates the message is sent by an actual user and should be used in
* most cases to represent user-generated messages.
* - `assistant`: Indicates the message is generated by the assistant. Use this
* value to insert messages from the assistant into the conversation.
*/
role: 'user' | 'assistant';

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
* the message should use. There can be a maximum of 10 files attached to a
* message. Useful for tools like `retrieval` and `code_interpreter` that can
* access and use files.
*/
file_ids?: Array<string>;

/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format. Keys
* can be a maximum of 64 characters long and values can be a maxium of 512
* characters long.
*/
metadata?: unknown | null;
}
}

export type RunSubmitToolOutputsParams =
| RunSubmitToolOutputsParamsNonStreaming
| RunSubmitToolOutputsParamsStreaming;
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '4.32.2'; // x-release-please-version
export const VERSION = '4.33.0'; // x-release-please-version
5 changes: 5 additions & 0 deletions tests/api-resources/beta/threads/runs/runs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ describe('resource runs', () => {
const response = await openai.beta.threads.runs.create('string', {
assistant_id: 'string',
additional_instructions: 'string',
additional_messages: [
{ role: 'user', content: 'x', file_ids: ['string'], metadata: {} },
{ role: 'user', content: 'x', file_ids: ['string'], metadata: {} },
{ role: 'user', content: 'x', file_ids: ['string'], metadata: {} },
],
instructions: 'string',
metadata: {},
model: 'string',
Expand Down