pub async fn create_chat_completion(
client: &OpenAIClient,
request: &CreateChatCompletionRequest,
) -> Result<CreateChatCompletionResponse, OpenAIError>Expand description
Creates a chat-based completion using the OpenAI Chat Completions API.
§Parameters
client- TheOpenAIClientto use for the request.request- ACreateChatCompletionRequestspecifying the messages, model, and other parameters.
§Returns
A CreateChatCompletionResponse containing one or more ChatCompletionChoice items.
§Errors
OpenAIError::HTTPError: if the request fails at the network layer.OpenAIError::DeserializeError: if the response fails to parse.OpenAIError::APIError: if OpenAI returns an error (e.g., invalid request).