Skip to content

Commit 5d6188d

Browse files
yjp20stainless-app[bot]
authored andcommitted
fix: change streaming helper imports to be relative
1 parent 53f6ecc commit 5d6188d

8 files changed

+36
-36
lines changed

src/lib/AbstractChatCompletionRunner.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import * as Core from 'openai/core';
2-
import { type CompletionUsage } from 'openai/resources/completions';
1+
import * as Core from '../core';
2+
import { type CompletionUsage } from '../resources/completions';
33
import {
44
type ChatCompletion,
55
type ChatCompletionMessage,
66
type ChatCompletionMessageParam,
77
type ChatCompletionCreateParams,
88
type ChatCompletionTool,
9-
} from 'openai/resources/chat/completions';
10-
import { OpenAIError } from 'openai/error';
9+
} from '../resources/chat/completions';
10+
import { OpenAIError } from '../error';
1111
import {
1212
type RunnableFunction,
1313
isRunnableFunctionWithParse,
@@ -23,7 +23,7 @@ import { isAssistantMessage, isFunctionMessage, isToolMessage } from './chatComp
2323
import { BaseEvents, EventStream } from './EventStream';
2424
import { ParsedChatCompletion } from '../resources/beta/chat/completions';
2525
import OpenAI from '../index';
26-
import { isAutoParsableTool, parseChatCompletion } from 'openai/lib/parser';
26+
import { isAutoParsableTool, parseChatCompletion } from '../lib/parser';
2727

2828
const DEFAULT_MAX_CHAT_COMPLETIONS = 10;
2929
export interface RunnerOptions extends Core.RequestOptions {

src/lib/AssistantStream.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ import {
88
TextDelta,
99
MessageDelta,
1010
MessageContent,
11-
} from 'openai/resources/beta/threads/messages';
12-
import * as Core from 'openai/core';
13-
import { RequestOptions } from 'openai/core';
11+
} from '../resources/beta/threads/messages';
12+
import * as Core from '../core';
13+
import { RequestOptions } from '../core';
1414
import {
1515
Run,
1616
RunCreateParamsBase,
1717
RunCreateParamsStreaming,
1818
Runs,
1919
RunSubmitToolOutputsParamsBase,
2020
RunSubmitToolOutputsParamsStreaming,
21-
} from 'openai/resources/beta/threads/runs/runs';
22-
import { type ReadableStream } from 'openai/_shims/index';
23-
import { Stream } from 'openai/streaming';
24-
import { APIUserAbortError, OpenAIError } from 'openai/error';
21+
} from '../resources/beta/threads/runs/runs';
22+
import { type ReadableStream } from '../_shims/index';
23+
import { Stream } from '../streaming';
24+
import { APIUserAbortError, OpenAIError } from '../error';
2525
import {
2626
AssistantStreamEvent,
2727
MessageStreamEvent,
2828
RunStepStreamEvent,
2929
RunStreamEvent,
30-
} from 'openai/resources/beta/assistants';
31-
import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from 'openai/resources/beta/threads/runs/steps';
32-
import { ThreadCreateAndRunParamsBase, Threads } from 'openai/resources/beta/threads/threads';
30+
} from '../resources/beta/assistants';
31+
import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from '../resources/beta/threads/runs/steps';
32+
import { ThreadCreateAndRunParamsBase, Threads } from '../resources/beta/threads/threads';
3333
import { BaseEvents, EventStream } from './EventStream';
3434

3535
export interface AssistantStreamEvents extends BaseEvents {
@@ -192,7 +192,7 @@ export class AssistantStream
192192
runs: Runs,
193193
params: RunSubmitToolOutputsParamsStream,
194194
options: RequestOptions | undefined,
195-
) {
195+
): AssistantStream {
196196
const runner = new AssistantStream();
197197
runner._run(() =>
198198
runner._runToolAssistantStream(threadId, runId, runs, params, {
@@ -238,7 +238,7 @@ export class AssistantStream
238238
params: ThreadCreateAndRunParamsBaseStream,
239239
thread: Threads,
240240
options?: RequestOptions,
241-
) {
241+
): AssistantStream {
242242
const runner = new AssistantStream();
243243
runner._run(() =>
244244
runner._threadAssistantStream(params, thread, {
@@ -254,7 +254,7 @@ export class AssistantStream
254254
runs: Runs,
255255
params: RunCreateParamsBaseStream,
256256
options?: RequestOptions,
257-
) {
257+
): AssistantStream {
258258
const runner = new AssistantStream();
259259
runner._run(() =>
260260
runner._runAssistantStream(threadId, runs, params, {

src/lib/ChatCompletionRunner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import {
22
type ChatCompletionMessageParam,
33
type ChatCompletionCreateParamsNonStreaming,
4-
} from 'openai/resources/chat/completions';
4+
} from '../resources/chat/completions';
55
import { type RunnableFunctions, type BaseFunctionsArgs, RunnableTools } from './RunnableFunction';
66
import {
77
AbstractChatCompletionRunner,
88
AbstractChatCompletionRunnerEvents,
99
RunnerOptions,
1010
} from './AbstractChatCompletionRunner';
1111
import { isAssistantMessage } from './chatCompletionUtils';
12-
import OpenAI from 'openai/index';
13-
import { AutoParseableTool } from 'openai/lib/parser';
12+
import OpenAI from '../index';
13+
import { AutoParseableTool } from '../lib/parser';
1414

1515
export interface ChatCompletionRunnerEvents extends AbstractChatCompletionRunnerEvents {
1616
content: (content: string) => void;

src/lib/ChatCompletionStream.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
import * as Core from 'openai/core';
1+
import * as Core from '../core';
22
import {
33
OpenAIError,
44
APIUserAbortError,
55
LengthFinishReasonError,
66
ContentFilterFinishReasonError,
7-
} from 'openai/error';
7+
} from '../error';
88
import {
99
ChatCompletionTokenLogprob,
1010
type ChatCompletion,
1111
type ChatCompletionChunk,
1212
type ChatCompletionCreateParams,
1313
type ChatCompletionCreateParamsStreaming,
1414
type ChatCompletionCreateParamsBase,
15-
} from 'openai/resources/chat/completions';
15+
} from '../resources/chat/completions';
1616
import {
1717
AbstractChatCompletionRunner,
1818
type AbstractChatCompletionRunnerEvents,
1919
} from './AbstractChatCompletionRunner';
20-
import { type ReadableStream } from 'openai/_shims/index';
21-
import { Stream } from 'openai/streaming';
22-
import OpenAI from 'openai/index';
23-
import { ParsedChatCompletion } from 'openai/resources/beta/chat/completions';
20+
import { type ReadableStream } from '../_shims/index';
21+
import { Stream } from '../streaming';
22+
import OpenAI from '../index';
23+
import { ParsedChatCompletion } from '../resources/beta/chat/completions';
2424
import {
2525
AutoParseableResponseFormat,
2626
hasAutoParseableInput,
2727
isAutoParsableResponseFormat,
2828
isAutoParsableTool,
2929
maybeParseChatCompletion,
3030
shouldParseToolCall,
31-
} from 'openai/lib/parser';
31+
} from '../lib/parser';
3232
import { partialParse } from '../_vendor/partial-json-parser/parser';
3333

3434
export interface ContentDeltaEvent {

src/lib/ChatCompletionStreamingRunner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {
22
type ChatCompletionChunk,
33
type ChatCompletionCreateParamsStreaming,
4-
} from 'openai/resources/chat/completions';
4+
} from '../resources/chat/completions';
55
import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from './AbstractChatCompletionRunner';
6-
import { type ReadableStream } from 'openai/_shims/index';
6+
import { type ReadableStream } from '../_shims/index';
77
import { RunnableTools, type BaseFunctionsArgs, type RunnableFunctions } from './RunnableFunction';
88
import { ChatCompletionSnapshot, ChatCompletionStream } from './ChatCompletionStream';
9-
import OpenAI from 'openai/index';
10-
import { AutoParseableTool } from 'openai/lib/parser';
9+
import OpenAI from '../index';
10+
import { AutoParseableTool } from '../lib/parser';
1111

1212
export interface ChatCompletionStreamEvents extends AbstractChatCompletionRunnerEvents {
1313
content: (contentDelta: string, contentSnapshot: string) => void;

src/lib/EventStream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { APIUserAbortError, OpenAIError } from 'openai/error';
1+
import { APIUserAbortError, OpenAIError } from '../error';
22

33
export class EventStream<EventTypes extends BaseEvents> {
44
controller: AbortController = new AbortController();

src/lib/chatCompletionUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
type ChatCompletionFunctionMessageParam,
44
type ChatCompletionMessageParam,
55
type ChatCompletionToolMessageParam,
6-
} from 'openai/resources';
6+
} from '../resources';
77

88
export const isAssistantMessage = (
99
message: ChatCompletionMessageParam | null | undefined,

src/lib/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
ParsedFunctionToolCall,
1414
} from '../resources/beta/chat/completions';
1515
import { ResponseFormatJSONSchema } from '../resources/shared';
16-
import { ContentFilterFinishReasonError, LengthFinishReasonError, OpenAIError } from 'openai/error';
16+
import { ContentFilterFinishReasonError, LengthFinishReasonError, OpenAIError } from '../error';
1717

1818
type AnyChatCompletionCreateParams =
1919
| ChatCompletionCreateParams

0 commit comments

Comments
 (0)