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.79.4 #1276

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

## 4.79.4 (2025-01-21)

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

### Bug Fixes

* **jsr:** correct zod config ([e45fa5f](https://github.com/openai/openai-node/commit/e45fa5f535ca74789636001e60e33edcad4db83c))


### Chores

* **internal:** minor restructuring ([#1278](https://github.com/openai/openai-node/issues/1278)) ([58ea92a](https://github.com/openai/openai-node/commit/58ea92a7464a04223f24ba31dbc0f7d0cf99cc19))


### Documentation

* update deprecation messages ([#1275](https://github.com/openai/openai-node/issues/1275)) ([1c6599e](https://github.com/openai/openai-node/commit/1c6599e47ef75a71cb309a1e14d97bc97bd036d0))

## 4.79.3 (2025-01-21)

Full Changelog: [v4.79.2...v4.79.3](https://github.com/openai/openai-node/compare/v4.79.2...v4.79.3)
Expand Down
5 changes: 4 additions & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"name": "@openai/openai",
"version": "4.79.3",
"version": "4.79.4",
"exports": {
".": "./index.ts",
"./helpers/zod": "./helpers/zod.ts",
"./beta/realtime/websocket": "./beta/realtime/websocket.ts"
},
"imports": {
"zod": "npm:zod@3"
},
"publish": {
"exclude": [
"!."
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.79.3",
"version": "4.79.4",
"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/internal/decoders/line.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OpenAIError } from '../../error';

type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
export type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;

/**
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
Expand Down
32 changes: 32 additions & 0 deletions src/internal/stream-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Most browsers don't yet have async iterable support for ReadableStream,
* and Node has a very different way of reading bytes from its "ReadableStream".
*
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
*/
export function ReadableStreamToAsyncIterable<T>(stream: any): AsyncIterableIterator<T> {
if (stream[Symbol.asyncIterator]) return stream;

const reader = stream.getReader();
return {
async next() {
try {
const result = await reader.read();
if (result?.done) reader.releaseLock(); // release lock when stream becomes closed
return result;
} catch (e) {
reader.releaseLock(); // release lock when stream becomes errored
throw e;
}
},
async return() {
const cancelPromise = reader.cancel();
reader.releaseLock();
await cancelPromise;
return { done: true, value: undefined };
},
[Symbol.asyncIterator]() {
return this;
},
};
}
24 changes: 12 additions & 12 deletions src/resources/chat/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ export interface ChatCompletionAssistantMessageParam {
content?: string | Array<ChatCompletionContentPartText | ChatCompletionContentPartRefusal> | null;

/**
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
* a function that should be called, as generated by the model.
* @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a
* function that should be called, as generated by the model.
*/
function_call?: ChatCompletionAssistantMessageParam.FunctionCall | null;

Expand Down Expand Up @@ -198,8 +198,8 @@ export namespace ChatCompletionAssistantMessageParam {
}

/**
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
* a function that should be called, as generated by the model.
* @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a
* function that should be called, as generated by the model.
*/
export interface FunctionCall {
/**
Expand Down Expand Up @@ -360,8 +360,8 @@ export namespace ChatCompletionChunk {
content?: string | null;

/**
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
* a function that should be called, as generated by the model.
* @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a
* function that should be called, as generated by the model.
*/
function_call?: Delta.FunctionCall;

Expand All @@ -380,8 +380,8 @@ export namespace ChatCompletionChunk {

export namespace Delta {
/**
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
* a function that should be called, as generated by the model.
* @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a
* function that should be called, as generated by the model.
*/
export interface FunctionCall {
/**
Expand Down Expand Up @@ -620,8 +620,8 @@ export interface ChatCompletionMessage {
audio?: ChatCompletionAudio | null;

/**
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
* a function that should be called, as generated by the model.
* @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a
* function that should be called, as generated by the model.
*/
function_call?: ChatCompletionMessage.FunctionCall | null;

Expand All @@ -633,8 +633,8 @@ export interface ChatCompletionMessage {

export namespace ChatCompletionMessage {
/**
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
* a function that should be called, as generated by the model.
* @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a
* function that should be called, as generated by the model.
*/
export interface FunctionCall {
/**
Expand Down
4 changes: 2 additions & 2 deletions src/resources/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ export interface FileObject {
| 'vision';

/**
* @deprecated: Deprecated. The current status of the file, which can be either
* @deprecated Deprecated. The current status of the file, which can be either
* `uploaded`, `processed`, or `error`.
*/
status: 'uploaded' | 'processed' | 'error';

/**
* @deprecated: Deprecated. For details on why a fine-tuning training file failed
* @deprecated Deprecated. For details on why a fine-tuning training file failed
* validation, see the `error` field on `fine_tuning.job`.
*/
status_details?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/resources/fine-tuning/jobs/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export interface JobCreateParams {

export namespace JobCreateParams {
/**
* @deprecated: The hyperparameters used for the fine-tuning job. This value is now
* @deprecated The hyperparameters used for the fine-tuning job. This value is now
* deprecated in favor of `method`, and should be passed in under the `method`
* parameter.
*/
Expand Down
38 changes: 3 additions & 35 deletions src/streaming.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ReadableStream, type Response } from './_shims/index';
import { OpenAIError } from './error';
import { LineDecoder } from './internal/decoders/line';
import { ReadableStreamToAsyncIterable } from './internal/stream-utils';

import { APIError } from './error';

Expand Down Expand Up @@ -96,7 +97,7 @@ export class Stream<Item> implements AsyncIterable<Item> {
async function* iterLines(): AsyncGenerator<string, void, unknown> {
const lineDecoder = new LineDecoder();

const iter = readableStreamAsyncIterable<Bytes>(readableStream);
const iter = ReadableStreamToAsyncIterable<Bytes>(readableStream);
for await (const chunk of iter) {
for (const line of lineDecoder.decode(chunk)) {
yield line;
Expand Down Expand Up @@ -210,7 +211,7 @@ export async function* _iterSSEMessages(
const sseDecoder = new SSEDecoder();
const lineDecoder = new LineDecoder();

const iter = readableStreamAsyncIterable<Bytes>(response.body);
const iter = ReadableStreamToAsyncIterable<Bytes>(response.body);
for await (const sseChunk of iterSSEChunks(iter)) {
for (const line of lineDecoder.decode(sseChunk)) {
const sse = sseDecoder.decode(line);
Expand Down Expand Up @@ -363,36 +364,3 @@ function partition(str: string, delimiter: string): [string, string, string] {

return [str, '', ''];
}

/**
* Most browsers don't yet have async iterable support for ReadableStream,
* and Node has a very different way of reading bytes from its "ReadableStream".
*
* This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490
*/
export function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T> {
if (stream[Symbol.asyncIterator]) return stream;

const reader = stream.getReader();
return {
async next() {
try {
const result = await reader.read();
if (result?.done) reader.releaseLock(); // release lock when stream becomes closed
return result;
} catch (e) {
reader.releaseLock(); // release lock when stream becomes errored
throw e;
}
},
async return() {
const cancelPromise = reader.cancel();
reader.releaseLock();
await cancelPromise;
return { done: true, value: undefined };
},
[Symbol.asyncIterator]() {
return this;
},
};
}
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.79.3'; // x-release-please-version
export const VERSION = '4.79.4'; // x-release-please-version
Loading