-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ai-help): log message metadata (#424)
For each AI Help request, we start recording the following metadata: - search duration - response duration - query length - context length - response length - model (e.g. gpt-4-0125-preview) - status (e.g. success) Co-authored-by: Claas Augner <[email protected]>
- Loading branch information
Showing
10 changed files
with
358 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP TABLE ai_help_message_meta; | ||
DROP TYPE ai_help_message_status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
CREATE TYPE ai_help_message_status AS ENUM ( | ||
'success', | ||
'search_error', | ||
'ai_api_error', | ||
'completion_error', | ||
'moderation_error', | ||
'no_user_prompt_error', | ||
'token_limit_error', | ||
'timeout', | ||
'finished_too_long', | ||
'finished_content_filter', | ||
'finished_no_reason', | ||
'user_stopped', | ||
'user_timeout', | ||
'unknown' | ||
); | ||
|
||
CREATE TABLE ai_help_message_meta ( | ||
id BIGSERIAL PRIMARY KEY, | ||
user_id BIGSERIAL REFERENCES users (id) ON DELETE CASCADE, | ||
chat_id UUID NOT NULL, | ||
message_id UUID NOT NULL, | ||
parent_id UUID DEFAULT NULL, | ||
created_at TIMESTAMP NOT NULL DEFAULT now(), | ||
search_duration BIGINT DEFAULT NULL, | ||
response_duration BIGINT DEFAULT NULL, | ||
query_len BIGINT DEFAULT NULL, | ||
context_len BIGINT DEFAULT NULL, | ||
response_len BIGINT DEFAULT NULL, | ||
model text NOT NULL, | ||
status ai_help_message_status NOT NULL DEFAULT 'unknown', | ||
sources JSONB NOT NULL DEFAULT '[]'::jsonb, | ||
UNIQUE(message_id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.