Skip to content

@ralphschuler.ai function caller.index.<internal>.ChatCompletionStreamingRunner

github-actions edited this page Nov 26, 2023 · 1 revision

Class: ChatCompletionStreamingRunner

index.<internal>.ChatCompletionStreamingRunner

Hierarchy

Implements

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new ChatCompletionStreamingRunner(): ChatCompletionStreamingRunner

Returns

ChatCompletionStreamingRunner

Inherited from

ChatCompletionStream.constructor

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:18

Properties

#private

Private #private: any

Inherited from

ChatCompletionStream.#private

Defined in

node_modules/openai/lib/ChatCompletionStream.d.ts:13


#private

Private #private: any

Inherited from

ChatCompletionStream.#private

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:14


_chatCompletions

Protected _chatCompletions: ChatCompletion[]

Inherited from

ChatCompletionStream._chatCompletions

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:16


controller

controller: AbortController

Inherited from

ChatCompletionStream.controller

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:15


messages

messages: ChatCompletionMessageParam[]

Inherited from

ChatCompletionStream.messages

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:17

Accessors

aborted

get aborted(): boolean

Returns

boolean

Inherited from

ChatCompletionStream.aborted

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:25


currentChatCompletionSnapshot

get currentChatCompletionSnapshot(): undefined | ChatCompletionSnapshot

Returns

undefined | ChatCompletionSnapshot

Inherited from

ChatCompletionStream.currentChatCompletionSnapshot

Defined in

node_modules/openai/lib/ChatCompletionStream.d.ts:14


ended

get ended(): boolean

Returns

boolean

Inherited from

ChatCompletionStream.ended

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:23


errored

get errored(): boolean

Returns

boolean

Inherited from

ChatCompletionStream.errored

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:24

Methods

[asyncIterator]

[asyncIterator](): AsyncIterator<ChatCompletionChunk, any, undefined>

Returns

AsyncIterator<ChatCompletionChunk, any, undefined>

Implementation of

AsyncIterable.[asyncIterator]

Inherited from

ChatCompletionStream.[asyncIterator]

Defined in

node_modules/openai/lib/ChatCompletionStream.d.ts:26


_addChatCompletion

_addChatCompletion(chatCompletion): ChatCompletion

Parameters

Name Type
chatCompletion ChatCompletion

Returns

ChatCompletion

Inherited from

ChatCompletionStream._addChatCompletion

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:20


_addMessage

_addMessage(message, emit?): void

Parameters

Name Type
message ChatCompletionMessageParam
emit? boolean

Returns

void

Inherited from

ChatCompletionStream._addMessage

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:21


_connected

_connected(): void

Returns

void

Inherited from

ChatCompletionStream._connected

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:22


_createChatCompletion

_createChatCompletion(completions, params, options?): Promise<ChatCompletion>

Parameters

Name Type
completions Completions
params ChatCompletionCreateParams
options? RequestOptions<Readable | Record<string, unknown>>

Returns

Promise<ChatCompletion>

Inherited from

ChatCompletionStream._createChatCompletion

Defined in

node_modules/openai/lib/ChatCompletionStream.d.ts:24


_emit

_emit<Event>(event, ...args): void

Type parameters

Name Type
Event extends keyof ChatCompletionStreamEvents

Parameters

Name Type
event Event
...args Parameters<ListenerForEvent<ChatCompletionStreamEvents, Event>>

Returns

void

Inherited from

ChatCompletionStream._emit

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:85


_emitFinal

_emitFinal(): void

Returns

void

Inherited from

ChatCompletionStream._emitFinal

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:86


_fromReadableStream

_fromReadableStream(readableStream, options?): Promise<ChatCompletion>

Parameters

Name Type
readableStream ReadableStream<any>
options? RequestOptions<Readable | Record<string, unknown>>

Returns

Promise<ChatCompletion>

Inherited from

ChatCompletionStream._fromReadableStream

Defined in

node_modules/openai/lib/ChatCompletionStream.d.ts:25


_run

_run(executor): void

Parameters

Name Type
executor () => Promise<any>

Returns

void

Inherited from

ChatCompletionStream._run

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:19


_runChatCompletion

_runChatCompletion(completions, params, options?): Promise<ChatCompletion>

Parameters

Name Type
completions Completions
params ChatCompletionCreateParams
options? RequestOptions<Readable | Record<string, unknown>>

Returns

Promise<ChatCompletion>

Inherited from

ChatCompletionStream._runChatCompletion

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:88


_runFunctions

_runFunctions<FunctionsArgs>(completions, params, options?): Promise<void>

Type parameters

Name Type
FunctionsArgs extends BaseFunctionsArgs

Parameters

Name Type
completions Completions
params ChatCompletionFunctionRunnerParams<FunctionsArgs> | ChatCompletionStreamingFunctionRunnerParams<FunctionsArgs>
options? RunnerOptions

Returns

Promise<void>

Inherited from

ChatCompletionStream._runFunctions

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:89


_runTools

_runTools<FunctionsArgs>(completions, params, options?): Promise<void>

Type parameters

Name Type
FunctionsArgs extends BaseFunctionsArgs

Parameters

Name Type
completions Completions
params ChatCompletionToolRunnerParams<FunctionsArgs> | ChatCompletionStreamingToolRunnerParams<FunctionsArgs>
options? RunnerOptions

Returns

Promise<void>

Inherited from

ChatCompletionStream._runTools

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:90


abort

abort(): void

Returns

void

Inherited from

ChatCompletionStream.abort

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:26


allChatCompletions

allChatCompletions(): ChatCompletion[]

Returns

ChatCompletion[]

Inherited from

ChatCompletionStream.allChatCompletions

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:84


done

done(): Promise<void>

Returns

Promise<void>

Inherited from

ChatCompletionStream.done

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:61


emitted

emitted<Event>(event): Promise<Parameters<ListenerForEvent<ChatCompletionStreamEvents, Event>> extends [Param] ? Param : Parameters<ListenerForEvent<ChatCompletionStreamEvents, Event>> extends [] ? void : Parameters<ListenerForEvent<ChatCompletionStreamEvents, Event>>>

This is similar to .once(), but returns a Promise that resolves the next time the event is triggered, instead of calling a listener callback.

Type parameters

Name Type
Event extends keyof ChatCompletionStreamEvents

Parameters

Name Type
event Event

Returns

Promise<Parameters<ListenerForEvent<ChatCompletionStreamEvents, Event>> extends [Param] ? Param : Parameters<ListenerForEvent<ChatCompletionStreamEvents, Event>> extends [] ? void : Parameters<ListenerForEvent<ChatCompletionStreamEvents, Event>>>

a Promise that resolves the next time given event is triggered, or rejects if an error is emitted. (If you request the 'error' event, returns a promise that resolves with the error).

Example:

const message = await stream.emitted('message') // rejects if the stream errors

Inherited from

ChatCompletionStream.emitted

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:60


finalChatCompletion

finalChatCompletion(): Promise<ChatCompletion>

Returns

Promise<ChatCompletion>

a promise that resolves with the final ChatCompletion, or rejects if an error occurred or the stream ended prematurely without producing a ChatCompletion.

Inherited from

ChatCompletionStream.finalChatCompletion

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:66


finalContent

finalContent(): Promise<null | string>

Returns

Promise<null | string>

a promise that resolves with the content of the final ChatCompletionMessage, or rejects if an error occurred or the stream ended prematurely without producing a ChatCompletionMessage.

Inherited from

ChatCompletionStream.finalContent

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:71


finalFunctionCall

finalFunctionCall(): Promise<undefined | FunctionCall>

Returns

Promise<undefined | FunctionCall>

a promise that resolves with the content of the final FunctionCall, or rejects if an error occurred or the stream ended prematurely without producing a ChatCompletionMessage.

Inherited from

ChatCompletionStream.finalFunctionCall

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:81


finalFunctionCallResult

finalFunctionCallResult(): Promise<undefined | string>

Returns

Promise<undefined | string>

Inherited from

ChatCompletionStream.finalFunctionCallResult

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:82


finalMessage

finalMessage(): Promise<ChatCompletionMessage>

Returns

Promise<ChatCompletionMessage>

a promise that resolves with the the final assistant ChatCompletionMessage response, or rejects if an error occurred or the stream ended prematurely without producing a ChatCompletionMessage.

Inherited from

ChatCompletionStream.finalMessage

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:76


off

off<Event>(event, listener): ChatCompletionStreamingRunner

Removes the specified listener from the listener array for the event. off() will remove, at most, one instance of a listener from the listener array. If any single listener has been added multiple times to the listener array for the specified event, then off() must be called multiple times to remove each instance.

Type parameters

Name Type
Event extends keyof ChatCompletionStreamEvents

Parameters

Name Type
event Event
listener ListenerForEvent<ChatCompletionStreamEvents, Event>

Returns

ChatCompletionStreamingRunner

this ChatCompletionStream, so that calls can be chained

Inherited from

ChatCompletionStream.off

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:42


on

on<Event>(event, listener): ChatCompletionStreamingRunner

Adds the listener function to the end of the listeners array for the event. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of event and listener will result in the listener being added, and called, multiple times.

Type parameters

Name Type
Event extends keyof ChatCompletionStreamEvents

Parameters

Name Type
event Event
listener ListenerForEvent<ChatCompletionStreamEvents, Event>

Returns

ChatCompletionStreamingRunner

this ChatCompletionStream, so that calls can be chained

Inherited from

ChatCompletionStream.on

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:34


once

once<Event>(event, listener): ChatCompletionStreamingRunner

Adds a one-time listener function for the event. The next time the event is triggered, this listener is removed and then invoked.

Type parameters

Name Type
Event extends keyof ChatCompletionStreamEvents

Parameters

Name Type
event Event
listener ListenerForEvent<ChatCompletionStreamEvents, Event>

Returns

ChatCompletionStreamingRunner

this ChatCompletionStream, so that calls can be chained

Inherited from

ChatCompletionStream.once

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:48


toReadableStream

toReadableStream(): ReadableStream<any>

Returns

ReadableStream<any>

Inherited from

ChatCompletionStream.toReadableStream

Defined in

node_modules/openai/lib/ChatCompletionStream.d.ts:27


totalUsage

totalUsage(): Promise<CompletionUsage>

Returns

Promise<CompletionUsage>

Inherited from

ChatCompletionStream.totalUsage

Defined in

node_modules/openai/lib/AbstractChatCompletionRunner.d.ts:83


createChatCompletion

createChatCompletion(completions, params, options?): ChatCompletionStream

Parameters

Name Type
completions Completions
params ChatCompletionStreamParams
options? RequestOptions<Readable | Record<string, unknown>>

Returns

ChatCompletionStream

Inherited from

ChatCompletionStream.createChatCompletion

Defined in

node_modules/openai/lib/ChatCompletionStream.d.ts:23


fromReadableStream

fromReadableStream(stream): ChatCompletionStreamingRunner

Intended for use on the frontend, consuming a stream produced with .toReadableStream() on the backend.

Note that messages sent to the model do not appear in .on('message') in this context.

Parameters

Name Type
stream ReadableStream<any>

Returns

ChatCompletionStreamingRunner

Overrides

ChatCompletionStream.fromReadableStream

Defined in

node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts:17


runFunctions

runFunctions<T>(completions, params, options?): ChatCompletionStreamingRunner

Type parameters

Name Type
T extends (string | object)[]

Parameters

Name Type
completions Completions
params ChatCompletionStreamingFunctionRunnerParams<T>
options? RunnerOptions

Returns

ChatCompletionStreamingRunner

Defined in

node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts:18


runTools

runTools<T>(completions, params, options?): ChatCompletionStreamingRunner

Type parameters

Name Type
T extends (string | object)[]

Parameters

Name Type
completions Completions
params ChatCompletionStreamingToolRunnerParams<T>
options? RunnerOptions

Returns

ChatCompletionStreamingRunner

Defined in

node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts:19

Typescript Libraries

Modules

Namespaces

Clone this wiki locally