Class: OpenAI
OpenAI LLM implementation
Implements
Constructors
constructor
• new OpenAI(init?
)
Parameters
Name | Type |
---|---|
init? | Partial <OpenAI > |
Defined in
llm/LLM.ts:80
Properties
apiKey
• Optional
apiKey: string
= undefined
Defined in
llm/LLM.ts:73
callbackManager
• Optional
callbackManager: CallbackManager
Defined in
llm/LLM.ts:78
maxRetries
• maxRetries: number
Defined in
llm/LLM.ts:74
maxTokens
• Optional
maxTokens: number
Defined in
llm/LLM.ts:70
model
• model: "gpt-3.5-turbo"
| "gpt-3.5-turbo-16k"
| "gpt-4"
| "gpt-4-32k"
Defined in
llm/LLM.ts:68
session
• session: OpenAISession
Defined in
llm/LLM.ts:76
temperature
• temperature: number
Defined in
llm/LLM.ts:69
timeout
• Optional
timeout: number
Defined in
llm/LLM.ts:75
Methods
chat
▸ chat(messages
, parentEvent?
): Promise
<ChatResponse
>
Get a chat response from the LLM
Parameters
Name | Type |
---|---|
messages | ChatMessage [] |
parentEvent? | Event |
Returns
Promise
<ChatResponse
>
Implementation of
Defined in
llm/LLM.ts:116
complete
▸ complete(prompt
, parentEvent?
): Promise
<ChatResponse
>
Get a prompt completion from the LLM
Parameters
Name | Type | Description |
---|---|---|
prompt | string | the prompt to complete |
parentEvent? | Event | - |
Returns
Promise
<ChatResponse
>
Implementation of
Defined in
llm/LLM.ts:154
mapMessageType
▸ mapMessageType(messageType
): "function"
| "user"
| "assistant"
| "system"
Parameters
Name | Type |
---|---|
messageType | MessageType |
Returns
"function"
| "user"
| "assistant"
| "system"
Defined in
llm/LLM.ts:99