Skip to content
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.70.2"
".": "4.70.3"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 4.70.3 (2024-11-04)

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

### Bug Fixes

* change streaming helper imports to be relative ([e73b7cf](https://github.com/openai/openai-node/commit/e73b7cf84272bd02a39a67795d49db23db2d970f))

## 4.70.2 (2024-11-01)

Full Changelog: [v4.70.1...v4.70.2](https://github.com/openai/openai-node/compare/v4.70.1...v4.70.2)
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.70.2",
"version": "4.70.3",
"description": "The official TypeScript library for the OpenAI API",
"author": "OpenAI <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions src/lib/AbstractChatCompletionRunner.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as Core from 'openai/core';
import { type CompletionUsage } from 'openai/resources/completions';
import * as Core from '../core';
import { type CompletionUsage } from '../resources/completions';
import {
type ChatCompletion,
type ChatCompletionMessage,
type ChatCompletionMessageParam,
type ChatCompletionCreateParams,
type ChatCompletionTool,
} from 'openai/resources/chat/completions';
import { OpenAIError } from 'openai/error';
} from '../resources/chat/completions';
import { OpenAIError } from '../error';
import {
type RunnableFunction,
isRunnableFunctionWithParse,
Expand All @@ -23,7 +23,7 @@ import { isAssistantMessage, isFunctionMessage, isToolMessage } from './chatComp
import { BaseEvents, EventStream } from './EventStream';
import { ParsedChatCompletion } from '../resources/beta/chat/completions';
import OpenAI from '../index';
import { isAutoParsableTool, parseChatCompletion } from 'openai/lib/parser';
import { isAutoParsableTool, parseChatCompletion } from '../lib/parser';

const DEFAULT_MAX_CHAT_COMPLETIONS = 10;
export interface RunnerOptions extends Core.RequestOptions {
Expand Down
26 changes: 13 additions & 13 deletions src/lib/AssistantStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ import {
TextDelta,
MessageDelta,
MessageContent,
} from 'openai/resources/beta/threads/messages';
import * as Core from 'openai/core';
import { RequestOptions } from 'openai/core';
} from '../resources/beta/threads/messages';
import * as Core from '../core';
import { RequestOptions } from '../core';
import {
Run,
RunCreateParamsBase,
RunCreateParamsStreaming,
Runs,
RunSubmitToolOutputsParamsBase,
RunSubmitToolOutputsParamsStreaming,
} from 'openai/resources/beta/threads/runs/runs';
import { type ReadableStream } from 'openai/_shims/index';
import { Stream } from 'openai/streaming';
import { APIUserAbortError, OpenAIError } from 'openai/error';
} from '../resources/beta/threads/runs/runs';
import { type ReadableStream } from '../_shims/index';
import { Stream } from '../streaming';
import { APIUserAbortError, OpenAIError } from '../error';
import {
AssistantStreamEvent,
MessageStreamEvent,
RunStepStreamEvent,
RunStreamEvent,
} from 'openai/resources/beta/assistants';
import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from 'openai/resources/beta/threads/runs/steps';
import { ThreadCreateAndRunParamsBase, Threads } from 'openai/resources/beta/threads/threads';
} from '../resources/beta/assistants';
import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from '../resources/beta/threads/runs/steps';
import { ThreadCreateAndRunParamsBase, Threads } from '../resources/beta/threads/threads';
import { BaseEvents, EventStream } from './EventStream';

export interface AssistantStreamEvents extends BaseEvents {
Expand Down Expand Up @@ -192,7 +192,7 @@ export class AssistantStream
runs: Runs,
params: RunSubmitToolOutputsParamsStream,
options: RequestOptions | undefined,
) {
): AssistantStream {
const runner = new AssistantStream();
runner._run(() =>
runner._runToolAssistantStream(threadId, runId, runs, params, {
Expand Down Expand Up @@ -238,7 +238,7 @@ export class AssistantStream
params: ThreadCreateAndRunParamsBaseStream,
thread: Threads,
options?: RequestOptions,
) {
): AssistantStream {
const runner = new AssistantStream();
runner._run(() =>
runner._threadAssistantStream(params, thread, {
Expand All @@ -254,7 +254,7 @@ export class AssistantStream
runs: Runs,
params: RunCreateParamsBaseStream,
options?: RequestOptions,
) {
): AssistantStream {
const runner = new AssistantStream();
runner._run(() =>
runner._runAssistantStream(threadId, runs, params, {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/ChatCompletionRunner.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
type ChatCompletionMessageParam,
type ChatCompletionCreateParamsNonStreaming,
} from 'openai/resources/chat/completions';
} from '../resources/chat/completions';
import { type RunnableFunctions, type BaseFunctionsArgs, RunnableTools } from './RunnableFunction';
import {
AbstractChatCompletionRunner,
AbstractChatCompletionRunnerEvents,
RunnerOptions,
} from './AbstractChatCompletionRunner';
import { isAssistantMessage } from './chatCompletionUtils';
import OpenAI from 'openai/index';
import { AutoParseableTool } from 'openai/lib/parser';
import OpenAI from '../index';
import { AutoParseableTool } from '../lib/parser';

export interface ChatCompletionRunnerEvents extends AbstractChatCompletionRunnerEvents {
content: (content: string) => void;
Expand Down
16 changes: 8 additions & 8 deletions src/lib/ChatCompletionStream.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
import * as Core from 'openai/core';
import * as Core from '../core';
import {
OpenAIError,
APIUserAbortError,
LengthFinishReasonError,
ContentFilterFinishReasonError,
} from 'openai/error';
} from '../error';
import {
ChatCompletionTokenLogprob,
type ChatCompletion,
type ChatCompletionChunk,
type ChatCompletionCreateParams,
type ChatCompletionCreateParamsStreaming,
type ChatCompletionCreateParamsBase,
} from 'openai/resources/chat/completions';
} from '../resources/chat/completions';
import {
AbstractChatCompletionRunner,
type AbstractChatCompletionRunnerEvents,
} from './AbstractChatCompletionRunner';
import { type ReadableStream } from 'openai/_shims/index';
import { Stream } from 'openai/streaming';
import OpenAI from 'openai/index';
import { ParsedChatCompletion } from 'openai/resources/beta/chat/completions';
import { type ReadableStream } from '../_shims/index';
import { Stream } from '../streaming';
import OpenAI from '../index';
import { ParsedChatCompletion } from '../resources/beta/chat/completions';
import {
AutoParseableResponseFormat,
hasAutoParseableInput,
isAutoParsableResponseFormat,
isAutoParsableTool,
maybeParseChatCompletion,
shouldParseToolCall,
} from 'openai/lib/parser';
} from '../lib/parser';
import { partialParse } from '../_vendor/partial-json-parser/parser';

export interface ContentDeltaEvent {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/ChatCompletionStreamingRunner.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
type ChatCompletionChunk,
type ChatCompletionCreateParamsStreaming,
} from 'openai/resources/chat/completions';
} from '../resources/chat/completions';
import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from './AbstractChatCompletionRunner';
import { type ReadableStream } from 'openai/_shims/index';
import { type ReadableStream } from '../_shims/index';
import { RunnableTools, type BaseFunctionsArgs, type RunnableFunctions } from './RunnableFunction';
import { ChatCompletionSnapshot, ChatCompletionStream } from './ChatCompletionStream';
import OpenAI from 'openai/index';
import { AutoParseableTool } from 'openai/lib/parser';
import OpenAI from '../index';
import { AutoParseableTool } from '../lib/parser';

export interface ChatCompletionStreamEvents extends AbstractChatCompletionRunnerEvents {
content: (contentDelta: string, contentSnapshot: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/EventStream.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { APIUserAbortError, OpenAIError } from 'openai/error';
import { APIUserAbortError, OpenAIError } from '../error';

export class EventStream<EventTypes extends BaseEvents> {
controller: AbortController = new AbortController();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/chatCompletionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
type ChatCompletionFunctionMessageParam,
type ChatCompletionMessageParam,
type ChatCompletionToolMessageParam,
} from 'openai/resources';
} from '../resources';

export const isAssistantMessage = (
message: ChatCompletionMessageParam | null | undefined,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
ParsedFunctionToolCall,
} from '../resources/beta/chat/completions';
import { ResponseFormatJSONSchema } from '../resources/shared';
import { ContentFilterFinishReasonError, LengthFinishReasonError, OpenAIError } from 'openai/error';
import { ContentFilterFinishReasonError, LengthFinishReasonError, OpenAIError } from '../error';

type AnyChatCompletionCreateParams =
| ChatCompletionCreateParams
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.70.2'; // x-release-please-version
export const VERSION = '4.70.3'; // x-release-please-version