Calls the OpenAI APIs text completion endpoint to generate text based on the given prompt.
Default values for the optional parameters are selected based on the model.
The prompt to use for text completion.
Optional
model: stringThe OpenAI API model to use for text completion.
Optional
max_tokens: numberThe maximum number of tokens (words and punctuation) to generate in the completion.
Optional
temperature: numberControls the "creativity" of the completion. A higher value means the model will take more risks.
Optional
top_p: numberControls the "confidence" of the completion. A lower value means the model will be more confident in its words.
Optional
frequency_penalty: numberControls the "diversity" of the completion. A higher value means the model will avoid repetition of words.
Optional
presence_penalty: numberControls the "relevance" of the completion. A higher value means the model will try to match the prompt more closely.
Calls the OpenAI APIs text edit endpoint to generate text based on the given input and instruction.
Default values for the optional parameters are selected based on the model.
The instruction to use for text editing.
Optional
input: stringThe input to use for text editing.
Optional
model: stringThe OpenAI API model to use for text completion.
Optional
n: numberOptional
temperature: numberControls the "creativity" of the completion. A higher value means the model will take more risks.
Optional
top_p: numberControls the "confidence" of the completion. A lower value means the model will be more confident in its words.
Generated using TypeDoc
A client for interacting with the OpenAI API.
See
https://beta.openai.com/docs/quickstart
Remarks
This client provides methods for calling the OpenAI API's endpoints for text completion, language generation, and other tasks.
To create an
OpenAiClient
, use theHttpOpenAiClient.create
method.The
OpenAiClient
's methods return Promises that resolve to the JSON response returned by the OpenAI API. If the OpenAI API returns an error, the Promise will be rejected with an instance of anHttpError
that includes the error message and HTTP status code.