OpenaiClient class

Available extensions

Constructors

OpenaiClient.new({required OpenaiConfig config, Client? httpClient})

Properties

client → Client
no setter
config OpenaiConfig
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addThreadMessage(ChatMessage message, String threadId, {CancellationToken? cancellationToken}) Future<ThreadMessage>

Available on OpenaiClient, provided by the ThreadCreate extension

createImage(ImageRequest request) Future<ImageResponse>

Available on OpenaiClient, provided by the ImageGeneration extension

Creates an image given a prompt.
createImageEdit(ImageEditRequest request) Future<ImageResponse>

Available on OpenaiClient, provided by the ImageEdit extension

Creates an edited or extended image given an original image and a prompt.
createImageEdit(ImageVariationRequest request) Future<ImageVariationResposne>

Available on OpenaiClient, provided by the ImageVariation extension

Creates an edited or extended image given an original image and a prompt.
createSpeech(SpeechRequest request, {CancellationToken? cancellationToken}) Future<List<int>>

Available on OpenaiClient, provided by the Speech extension

createThread({CancellationToken? cancellationToken}) Future<Thread>

Available on OpenaiClient, provided by the ThreadCreate extension

createThreadRun({required String threadId, required String assistantId, String? instructions, CancellationToken? cancellationToken}) Future<ThreadRun>

Available on OpenaiClient, provided by the ThreadCreate extension

createTranscription(TranscriptionRequest request, {CancellationToken? cancellationToken}) Future<TranscriptionResponse>

Available on OpenaiClient, provided by the Transcription extension

createTraslation(TranslationRequest request) Future<TraslationResponse>

Available on OpenaiClient, provided by the Translation extension

get(String endpoint, {bool isBeta = false, CancellationToken? cancellationToken}) Future
getModel(String modelId) Future<ModelResponse>

Available on OpenaiClient, provided by the ModelApi extension

Retrieves a model instance, providing basic information about the model such as the owner and permissioning. modelId The ID of the model to use for this request
getThreadMessages(String threadId, {CancellationToken? cancellationToken}) Future<ThreadMessagesResponse>

Available on OpenaiClient, provided by the ThreadCreate extension

getThreadRunStatus({required String threadId, required String runId, CancellationToken? cancellationToken}) Future<ThreadRun>

Available on OpenaiClient, provided by the ThreadCreate extension

getThreadRunSteps({required String threadId, required String runId, CancellationToken? cancellationToken}) Future<List<ThreadRunStep>>

Available on OpenaiClient, provided by the ThreadCreate extension

handleException(Response response) → void
listModels() Future<ModelListResponse>

Available on OpenaiClient, provided by the ModelApi extension

Lists the currently available models, and provides basic information about each one such as the owner and availability.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
proxyClient(String proxy) → IOClient
sendChatCompletion(ChatCompletionRequest request, {CancellationToken? cancellationToken}) Future<ChatCompletionResponse>

Available on OpenaiClient, provided by the ChatCompletion extension

sendChatCompletionStream(ChatCompletionRequest request, {dynamic onSuccess(ChatCompletionResponse)?, CancellationToken? cancellationToken}) Future

Available on OpenaiClient, provided by the ChatCompletion extension

sendFormRequest(MultipartRequest request, {bool isBeta = false, CancellationToken? cancellationToken}) Future
sendRequest(String endpoint, dynamic body, {bool isBeta = false, CancellationToken? cancellationToken}) Future
sendRequestRaw(String endpoint, dynamic body, {bool isBeta = false, CancellationToken? cancellationToken}) Future
sendStreamRequest(String endpoint, dynamic body, {bool isBeta = false, dynamic onSuccess(dynamic)?, CancellationToken? cancellationToken}) Future
toString() String
A string representation of this object.
inherited
updateConfig(OpenaiConfig config) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

kFormTypeHeader → const Map<String, String>
kJsonTypeHeader → const Map<String, String>