メインコンテンツまでスキップ

Class: OpenAI

OpenAI LLM implementation

Hierarchy

Constructors

constructor

new OpenAI(init?): OpenAI

Parameters

NameType
init?Partial<OpenAI> & { azure?: AzureOpenAIConfig }

Returns

OpenAI

Overrides

BaseLLM.constructor

Defined in

packages/core/src/llm/LLM.ts:95

Properties

additionalChatOptions

Optional additionalChatOptions: Omit<Partial<ChatCompletionCreateParams>, "stream" | "model" | "temperature" | "messages" | "max_tokens" | "top_p">

Defined in

packages/core/src/llm/LLM.ts:78


additionalSessionOptions

Optional additionalSessionOptions: Omit<Partial<ClientOptions>, "apiKey" | "timeout" | "maxRetries">

Defined in

packages/core/src/llm/LLM.ts:88


apiKey

Optional apiKey: string = undefined

Defined in

packages/core/src/llm/LLM.ts:84


callbackManager

Optional callbackManager: CallbackManager

Defined in

packages/core/src/llm/LLM.ts:93


maxRetries

maxRetries: number

Defined in

packages/core/src/llm/LLM.ts:85


maxTokens

Optional maxTokens: number

Defined in

packages/core/src/llm/LLM.ts:77


model

model: string

Defined in

packages/core/src/llm/LLM.ts:74


session

session: OpenAISession

Defined in

packages/core/src/llm/LLM.ts:87


temperature

temperature: number

Defined in

packages/core/src/llm/LLM.ts:75


timeout

Optional timeout: number

Defined in

packages/core/src/llm/LLM.ts:86


topP

topP: number

Defined in

packages/core/src/llm/LLM.ts:76

Accessors

metadata

get metadata(): Object

Returns

Object

NameType
contextWindownumber
maxTokensundefined | number
modelstring
temperaturenumber
tokenizerCL100K_BASE
topPnumber

Overrides

BaseLLM.metadata

Defined in

packages/core/src/llm/LLM.ts:150

Methods

chat

chat(params): Promise<AsyncIterable<ChatResponseChunk>>

Parameters

NameType
paramsLLMChatParamsStreaming

Returns

Promise<AsyncIterable<ChatResponseChunk>>

Overrides

BaseLLM.chat

Defined in

packages/core/src/llm/LLM.ts:197

chat(params): Promise<ChatResponse>

Parameters

NameType
paramsLLMChatParamsNonStreaming

Returns

Promise<ChatResponse>

Overrides

BaseLLM.chat

Defined in

packages/core/src/llm/LLM.ts:200


complete

complete(params): Promise<AsyncIterable<CompletionResponse>>

Parameters

NameType
paramsLLMCompletionParamsStreaming

Returns

Promise<AsyncIterable<CompletionResponse>>

Inherited from

BaseLLM.complete

Defined in

packages/core/src/llm/base.ts:18

complete(params): Promise<CompletionResponse>

Parameters

NameType
paramsLLMCompletionParamsNonStreaming

Returns

Promise<CompletionResponse>

Inherited from

BaseLLM.complete

Defined in

packages/core/src/llm/base.ts:21


mapMessageType

mapMessageType(messageType): "function" | "user" | "assistant" | "system"

Parameters

NameType
messageTypeMessageType

Returns

"function" | "user" | "assistant" | "system"

Defined in

packages/core/src/llm/LLM.ts:180


streamChat

streamChat(«destructured»): AsyncIterable<ChatResponseChunk>

Parameters

NameType
«destructured»LLMChatParamsStreaming

Returns

AsyncIterable<ChatResponseChunk>

Defined in

packages/core/src/llm/LLM.ts:235


tokens

tokens(messages): number

Parameters

NameType
messagesChatMessage[]

Returns

number

Overrides

BaseLLM.tokens

Defined in

packages/core/src/llm/LLM.ts:165