Skip to content

Commit

Permalink
fix: change streaming helper imports to be relative
Browse files Browse the repository at this point in the history
  • Loading branch information
yjp20 authored and stainless-app[bot] committed Nov 4, 2024
1 parent 53f6ecc commit 5d6188d
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
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

0 comments on commit 5d6188d

Please sign in to comment.