Skip to content

Completions

A chat completion record containing the request details, token usage, and associated feedback.

Example Usage

typescript
import { Completions } from "@meetkai/mka1/models/operations";

let value: Completions = {
  id: "<id>",
  requestId: "<id>",
  userId: "<id>",
  model: "A8",
  promptTokens: 692.47,
  completionTokens: 4776.14,
  totalTokens: 1947.25,
  finishReason: "<value>",
  stream: true,
  feedbackRating: "thumbs_up",
  feedbackDescription: "<value>",
  createdAt: new Date("2024-09-07T20:55:03.524Z"),
  updatedAt: new Date("2023-04-28T06:44:18.092Z"),
};

Fields

FieldTypeRequiredDescription
idstring✔️Unique database identifier for this chat completion record
requestIdstring✔️The chat completion request ID (chatcmpl-xxx) returned in the API response
userIdstring✔️The user ID who made this request, if provided in the original request
modelstring✔️The model that was used for this chat completion (e.g., 'gpt-4', 'claude-3-opus')
promptTokensnumber✔️Number of tokens used in the input/prompt
completionTokensnumber✔️Number of tokens generated in the output/completion
totalTokensnumber✔️Total number of tokens used (prompt + completion)
finishReasonstring✔️The reason the model stopped generating. Can be 'stop' (natural end), 'length' (max tokens), 'tool_calls' (function call), or 'content_filter' (filtered content).
streamboolean✔️Whether this was a streaming request (true) or non-streaming (false)
messagesanyThe chat messages from the request stored as JSONB. Contains the conversation history sent to the model.
feedbackRatingoperations.ListUserChatCompletionsFeedbackRating✔️User feedback rating for this completion, if provided. Can be 'thumbs_up' or 'thumbs_down'.
feedbackDescriptionstring✔️Detailed user feedback description for this completion, if provided
createdAtDate✔️Timestamp when this chat completion was created
updatedAtDate✔️Timestamp when this record was last updated (e.g., when feedback was added)