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.31.0 #743

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.30.0"
".": "4.31.0"
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 4.31.0 (2024-03-30)

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

### Features

* **api:** adding temperature parameter ([#742](https://github.com/openai/openai-node/issues/742)) ([b173b05](https://github.com/openai/openai-node/commit/b173b05eb52266d8f2c835ec4ed71cba8cdc609b))


### Bug Fixes

* **streaming:** trigger all event handlers with fromReadableStream ([#741](https://github.com/openai/openai-node/issues/741)) ([7b1e593](https://github.com/openai/openai-node/commit/7b1e5937d97b309ed51928b4388dcde74abda8dc))

## 4.30.0 (2024-03-28)

Full Changelog: [v4.29.2...v4.30.0](https://github.com/openai/openai-node/compare/v4.29.2...v4.30.0)
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.30.0/mod.ts';
import OpenAI from 'https://deno.land/x/openai@v4.31.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.30.0/mod.ts";
import OpenAI from "https://deno.land/x/openai@v4.31.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.30.0",
"version": "4.31.0",
"description": "The official TypeScript library for the OpenAI API",
"author": "OpenAI <support@openai.com>",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/AssistantStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class AssistantStream
this._connected();
const stream = Stream.fromReadableStream<AssistantStreamEvent>(readableStream, this.controller);
for await (const event of stream) {
this.#handleEvent(event);
this.#addEvent(event);
}
if (stream.controller.signal?.aborted) {
throw new APIUserAbortError();
Expand Down
16 changes: 10 additions & 6 deletions src/resources/beta/threads/messages/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ export interface Message {
role: 'user' | 'assistant';

/**
* If applicable, the ID of the
* [run](https://platform.openai.com/docs/api-reference/runs) associated with the
* authoring of this message.
* The ID of the [run](https://platform.openai.com/docs/api-reference/runs)
* associated with the creation of this message. Value is `null` when messages are
* created manually using the create message or create thread endpoints.
*/
run_id: string | null;

Expand Down Expand Up @@ -501,10 +501,14 @@ export interface MessageCreateParams {
content: string;

/**
* The role of the entity that is creating the message. Currently only `user` is
* supported.
* 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';
role: 'user' | 'assistant';

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
Expand Down
19 changes: 19 additions & 0 deletions src/resources/beta/threads/runs/runs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ export interface Run {
* in a terminal state (i.e. `in_progress`, `queued`, etc.).
*/
usage: Run.Usage | null;

/**
* The sampling temperature used for this run. If not set, defaults to 1.
*/
temperature?: number | null;
}

export namespace Run {
Expand Down Expand Up @@ -461,6 +466,13 @@ export interface RunCreateParamsBase {
*/
stream?: boolean | null;

/**
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
* make the output more random, while lower values like 0.2 will make it more
* focused and deterministic.
*/
temperature?: number | null;

/**
* Override the tools the assistant can use for this run. This is useful for
* modifying the behavior on a per-run basis.
Expand Down Expand Up @@ -555,6 +567,13 @@ export interface RunCreateAndStreamParams {
*/
model?: string | null;

/**
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
* make the output more random, while lower values like 0.2 will make it more
* focused and deterministic.
*/
temperature?: number | null;

/**
* Override the tools the assistant can use for this run. This is useful for
* modifying the behavior on a per-run basis.
Expand Down
44 changes: 35 additions & 9 deletions src/resources/beta/threads/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,14 @@ export namespace ThreadCreateParams {
content: string;

/**
* The role of the entity that is creating the message. Currently only `user` is
* supported.
* 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';
role: 'user' | 'assistant';

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
Expand Down Expand Up @@ -238,6 +242,13 @@ export interface ThreadCreateAndRunParamsBase {
*/
stream?: boolean | null;

/**
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
* make the output more random, while lower values like 0.2 will make it more
* focused and deterministic.
*/
temperature?: number | null;

/**
* If no thread is provided, an empty thread will be created.
*/
Expand Down Expand Up @@ -280,10 +291,14 @@ export namespace ThreadCreateAndRunParams {
content: string;

/**
* The role of the entity that is creating the message. Currently only `user` is
* supported.
* 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';
role: 'user' | 'assistant';

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
Expand Down Expand Up @@ -355,6 +370,13 @@ export interface ThreadCreateAndRunStreamParams {
*/
model?: string | null;

/**
* What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
* make the output more random, while lower values like 0.2 will make it more
* focused and deterministic.
*/
temperature?: number | null;

/**
* If no thread is provided, an empty thread will be created.
*/
Expand Down Expand Up @@ -397,10 +419,14 @@ export namespace ThreadCreateAndRunStreamParams {
content: string;

/**
* The role of the entity that is creating the message. Currently only `user` is
* supported.
* 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';
role: 'user' | 'assistant';

/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
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.30.0'; // x-release-please-version
export const VERSION = '4.31.0'; // x-release-please-version
1 change: 1 addition & 0 deletions tests/api-resources/beta/threads/runs/runs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('resource runs', () => {
metadata: {},
model: 'string',
stream: false,
temperature: 1,
tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }],
});
});
Expand Down
1 change: 1 addition & 0 deletions tests/api-resources/beta/threads/threads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ describe('resource threads', () => {
metadata: {},
model: 'string',
stream: false,
temperature: 1,
thread: {
messages: [
{ role: 'user', content: 'x', file_ids: ['string'], metadata: {} },
Expand Down