Optionalfields: anyOptionalapiAPI key to use when making requests to OpenAI. Defaults to the value of
OPENAI_API_KEY environment variable.
OptionalazureOptionalazureOptionalazureOptionalazureOptionalazureOptionalazureOptionalazureBatch size to use when passing multiple documents to generate
OptionalbestGenerates bestOf completions server side and returns the "best"
ProtectedclientProtectedclientOptionalfrequencyPenalizes repeated tokens according to frequency
OptionallogitDictionary used to adjust the probability of specific tokens being generated
OptionalmaxMaximum 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
OptionalmodelHolds 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
OptionalopenAPI key to use when making requests to OpenAI. Defaults to the value of
OPENAI_API_KEY environment variable.
Alias for apiKey
OptionalorganizationOptionalpresencePenalizes repeated tokens
OptionalstopList of stop words to use when generating
Alias for stopSequences
OptionalstopList of stop words to use when generating
Whether to stream the results or not. Enabling disables tokenUsage reporting
OptionaltemperatureSampling temperature to use
OptionaltimeoutTimeout to use when making requests to OpenAI.
OptionaltopTotal probability mass of tokens to consider at each step
OptionaluserUnique 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
Optionalprompts: string[]The prompts to pass into the model.
Optionaloptions: unknownOptional list of stop words to use when generating.
OptionalrunManager: 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.
Optionaloptions: 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.
Optionaloptions: RequestOptionsOptional configuration for the API call.
The response from the OpenAI API.
Get the parameters used to invoke the model
Optionaloptions: unknownStaticlc_
Wrapper around OpenAI large language models.
To use you should have the
openaipackage installed, with theOPENAI_API_KEYenvironment variable set.To use with Azure, import the
AzureOpenAIclass.Remarks
Any parameters that are valid to be passed to
openai.createCompletioncan be passed through modelKwargs, even if not explicitly available on this class.Example