chatCompletions method

  1. @override
Stream<HttpBody> chatCompletions(
  1. ChatCompletionsRequest request
)
override

Exposes an OpenAI-compatible endpoint for chat completions.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

@override
Stream<HttpBody> chatCompletions(ChatCompletionsRequest request) {
  if (isClosed) throw StateError('Service is closed');
  if (_chatCompletions case final chatCompletions?) {
    return chatCompletions(request);
  }
  throw UnsupportedError('chatCompletions');
}