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
| Field | Type | Required | Description |
|---|---|---|---|
id | string | ✔️ | Unique database identifier for this chat completion record |
requestId | string | ✔️ | The chat completion request ID (chatcmpl-xxx) returned in the API response |
userId | string | ✔️ | The user ID who made this request, if provided in the original request |
model | string | ✔️ | The model that was used for this chat completion (e.g., 'gpt-4', 'claude-3-opus') |
promptTokens | number | ✔️ | Number of tokens used in the input/prompt |
completionTokens | number | ✔️ | Number of tokens generated in the output/completion |
totalTokens | number | ✔️ | Total number of tokens used (prompt + completion) |
finishReason | string | ✔️ | The reason the model stopped generating. Can be 'stop' (natural end), 'length' (max tokens), 'tool_calls' (function call), or 'content_filter' (filtered content). |
stream | boolean | ✔️ | Whether this was a streaming request (true) or non-streaming (false) |
messages | any | ➖ | The chat messages from the request stored as JSONB. Contains the conversation history sent to the model. |
feedbackRating | operations.ListUserChatCompletionsFeedbackRating | ✔️ | User feedback rating for this completion, if provided. Can be 'thumbs_up' or 'thumbs_down'. |
feedbackDescription | string | ✔️ | Detailed user feedback description for this completion, if provided |
createdAt | Date | ✔️ | Timestamp when this chat completion was created |
updatedAt | Date | ✔️ | Timestamp when this record was last updated (e.g., when feedback was added) |