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.67.0 #1114

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.66.1"
".": "4.67.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.67.0 (2024-10-01)

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

### Features

* **api:** support storing chat completions, enabling evals and model distillation in the dashboard ([#1112](https://github.com/openai/openai-node/issues/1112)) ([6424924](https://github.com/openai/openai-node/commit/6424924b6361e54f07c04fce9075ab16fcb712fb))

## 4.66.1 (2024-09-30)

Full Changelog: [v4.66.0...v4.66.1](https://github.com/openai/openai-node/compare/v4.66.0...v4.66.1)
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.66.1/mod.ts';
import OpenAI from 'https://deno.land/x/openai@v4.67.0/mod.ts';
```

<!-- x-release-please-end -->
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.66.1",
"version": "4.67.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 scripts/build-deno
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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.66.1/mod.ts";
import OpenAI from "https://deno.land/x/openai@v4.67.0/mod.ts";

const client = new OpenAI();
\`\`\`
Expand Down
1 change: 1 addition & 0 deletions src/resources/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type ChatModel =
| 'gpt-4o'
| 'gpt-4o-2024-08-06'
| 'gpt-4o-2024-05-13'
| 'gpt-4o-realtime-preview-2024-10-01'
| 'chatgpt-4o-latest'
| 'gpt-4o-mini'
| 'gpt-4o-mini-2024-07-18'
Expand Down
20 changes: 18 additions & 2 deletions src/resources/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,12 @@ export type ChatCompletionCreateParams =

export interface ChatCompletionCreateParamsBase {
/**
* A list of messages comprising the conversation so far.
* [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models).
* A list of messages comprising the conversation so far. Depending on the
* [model](https://platform.openai.com/docs/models) you use, different message
* types (modalities) are supported, like
* [text](https://platform.openai.com/docs/guides/text-generation),
* [images](https://platform.openai.com/docs/guides/vision), and
* [audio](https://platform.openai.com/docs/guides/audio).
*/
messages: Array<ChatCompletionMessageParam>;

Expand Down Expand Up @@ -806,6 +810,12 @@ export interface ChatCompletionCreateParamsBase {
*/
max_tokens?: number | null;

/**
* Developer-defined tags and values used for filtering completions in the
* [dashboard](https://platform.openai.com/completions).
*/
metadata?: Record<string, string> | null;

/**
* How many chat completion choices to generate for each input message. Note that
* you will be charged based on the number of generated tokens across all of the
Expand Down Expand Up @@ -889,6 +899,12 @@ export interface ChatCompletionCreateParamsBase {
*/
stop?: string | null | Array<string>;

/**
* Whether or not to store the output of this completion request for traffic
* logging in the [dashboard](https://platform.openai.com/completions).
*/
store?: boolean | null;

/**
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
* sent as data-only
Expand Down
25 changes: 25 additions & 0 deletions src/resources/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,43 @@ export interface CompletionUsage {
* Breakdown of tokens used in a completion.
*/
completion_tokens_details?: CompletionUsage.CompletionTokensDetails;

/**
* Breakdown of tokens used in the prompt.
*/
prompt_tokens_details?: CompletionUsage.PromptTokensDetails;
}

export namespace CompletionUsage {
/**
* Breakdown of tokens used in a completion.
*/
export interface CompletionTokensDetails {
/**
* Audio input tokens generated by the model.
*/
audio_tokens?: number;

/**
* Tokens generated by the model for reasoning.
*/
reasoning_tokens?: number;
}

/**
* Breakdown of tokens used in the prompt.
*/
export interface PromptTokensDetails {
/**
* Audio input tokens present in the prompt.
*/
audio_tokens?: number;

/**
* Cached tokens present in the prompt.
*/
cached_tokens?: number;
}
}

export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
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.66.1'; // x-release-please-version
export const VERSION = '4.67.0'; // x-release-please-version
2 changes: 2 additions & 0 deletions tests/api-resources/chat/completions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ describe('resource completions', () => {
logprobs: true,
max_completion_tokens: 0,
max_tokens: 0,
metadata: { foo: 'string' },
n: 1,
parallel_tool_calls: true,
presence_penalty: -2,
response_format: { type: 'text' },
seed: -9007199254740991,
service_tier: 'auto',
stop: 'string',
store: true,
stream: false,
stream_options: { include_usage: true },
temperature: 1,
Expand Down