Class: OpenAI
OpenAI LLM implementation
Hierarchy
-
BaseLLM
↳
OpenAI
↳↳
FireworksLLM
↳↳
TogetherLLM
Constructors
constructor
• new OpenAI(init?
): OpenAI
Parameters
Name | Type |
---|---|
init? | Partial <OpenAI > & { azure? : AzureOpenAIConfig } |
Returns
Overrides
BaseLLM.constructor
Defined in
packages/core/src/llm/LLM.ts:108
Properties
additionalChatOptions
• Optional
additionalChatOptions: Omit
<Partial
<ChatCompletionCreateParams
>, "stream"
| "model"
| "temperature"
| "messages"
| "max_tokens"
| "top_p"
| "tools"
| "toolChoice"
>
Defined in
packages/core/src/llm/LLM.ts:84
additionalSessionOptions
• Optional
additionalSessionOptions: Omit
<Partial
<ClientOptions
>, "apiKey"
| "timeout"
| "maxRetries"
>
Defined in
packages/core/src/llm/LLM.ts:101
apiKey
• Optional
apiKey: string
= undefined
Defined in
packages/core/src/llm/LLM.ts:97
callbackManager
• Optional
callbackManager: CallbackManager
Defined in
packages/core/src/llm/LLM.ts:106
maxRetries
• maxRetries: number
Defined in
packages/core/src/llm/LLM.ts:98
maxTokens
• Optional
maxTokens: number
Defined in
packages/core/src/llm/LLM.ts:83
model
• model: string
Defined in
packages/core/src/llm/LLM.ts:80
session
• session: OpenAISession
Defined in
packages/core/src/llm/LLM.ts:100
temperature
• temperature: number
Defined in
packages/core/src/llm/LLM.ts:81
timeout
• Optional
timeout: number
Defined in
packages/core/src/llm/LLM.ts:99
topP
• topP: number
Defined in
packages/core/src/llm/LLM.ts:82
Accessors
metadata
• get
metadata(): Object
Returns
Object
Name | Type |
---|---|
contextWindow | number |
isFunctionCallingModel | boolean |
maxTokens | undefined | number |
model | string |
temperature | number |
tokenizer | CL100K_BASE |
topP | number |
Overrides
BaseLLM.metadata
Defined in
packages/core/src/llm/LLM.ts:163
Methods
chat
▸ chat(params
): Promise
<AsyncIterable
<ChatResponseChunk
>>
Parameters
Name | Type |
---|---|
params | LLMChatParamsStreaming |
Returns
Promise
<AsyncIterable
<ChatResponseChunk
>>
Overrides
BaseLLM.chat
Defined in
packages/core/src/llm/LLM.ts:230
▸ chat(params
): Promise
<ChatResponse
>
Parameters
Name | Type |
---|---|
params | LLMChatParamsNonStreaming |
Returns
Promise
<ChatResponse
>
Overrides
BaseLLM.chat
Defined in
packages/core/src/llm/LLM.ts:233
complete
▸ complete(params
): Promise
<AsyncIterable
<CompletionResponse
>>
Parameters
Name | Type |
---|---|
params | LLMCompletionParamsStreaming |
Returns
Promise
<AsyncIterable
<CompletionResponse
>>
Inherited from
BaseLLM.complete
Defined in
packages/core/src/llm/base.ts:18
▸ complete(params
): Promise
<CompletionResponse
>
Parameters
Name | Type |
---|---|
params | LLMCompletionParamsNonStreaming |
Returns
Promise
<CompletionResponse
>
Inherited from
BaseLLM.complete
Defined in
packages/core/src/llm/base.ts:21
mapMessageType
▸ mapMessageType(messageType
): "function"
| "user"
| "assistant"
| "system"
| "tool"
Parameters
Name | Type |
---|---|
messageType | MessageType |
Returns
"function"
| "user"
| "assistant"
| "system"
| "tool"
Defined in
packages/core/src/llm/LLM.ts:194
streamChat
▸ streamChat(«destructured»
): AsyncIterable
<ChatResponseChunk
>
Parameters
Name | Type |
---|---|
«destructured» | LLMChatParamsStreaming |
Returns
AsyncIterable
<ChatResponseChunk
>
Defined in
packages/core/src/llm/LLM.ts:277