Optional
fields: anyOptional
apiAPI key to use when making requests to OpenAI. Defaults to the value of
OPENAI_API_KEY
environment variable.
Batch size to use when passing multiple documents to generate
Optional
bestGenerates bestOf
completions server side and returns the "best"
Protected
clientProtected
clientOptional
frequencyPenalizes repeated tokens according to frequency
Optional
logitDictionary used to adjust the probability of specific tokens being generated
Optional
maxMaximum number of tokens to generate in the completion. -1 returns as many tokens as possible given the prompt and the model's maximum context size.
Model name to use
Optional
modelHolds any additional parameters that are valid to pass to openai.createCompletion
that are not explicitly specified on this class.
Number of completions to generate for each prompt
Optional
openAPI key to use when making requests to OpenAI. Defaults to the value of
OPENAI_API_KEY
environment variable.
Alias for apiKey
Optional
organizationOptional
presencePenalizes repeated tokens
Optional
stopList of stop words to use when generating
Alias for stopSequences
Optional
stopList of stop words to use when generating
Whether to stream the results or not. Enabling disables tokenUsage reporting
Optional
temperatureSampling temperature to use
Optional
timeoutTimeout to use when making requests to OpenAI.
Optional
topTotal probability mass of tokens to consider at each step
Optional
userUnique string identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
Call out to OpenAI's endpoint with k unique prompts
Optional
prompts: string[]The prompts to pass into the model.
Optional
options: unknownOptional list of stop words to use when generating.
Optional
runManager: anyOptional callback manager to use when generating.
The full LLM output.
Protected
_Calls the OpenAI API with retry logic in case of failures.
Optional configuration for the API call.
The response from the OpenAI API.
Calls the OpenAI API with retry logic in case of failures.
The request to send to the OpenAI API.
Optional
options: RequestOptionsOptional configuration for the API call.
The response from the OpenAI API.
Calls the OpenAI API with retry logic in case of failures.
The request to send to the OpenAI API.
Optional
options: RequestOptionsOptional configuration for the API call.
The response from the OpenAI API.
Get the parameters used to invoke the model
Optional
options: unknownStatic
lc_
Wrapper around OpenAI large language models.
To use you should have the
openai
package installed, with theOPENAI_API_KEY
environment variable set.To use with Azure, import the
AzureOpenAI
class.Remarks
Any parameters that are valid to be passed to
openai.createCompletion
can be passed through modelKwargs, even if not explicitly available on this class.Example