Index

public.chatbot_conversation_message_messages

Description

Contains text messages made in a chatbot conversation.

Columns

Name Type Default Nullable Children Parents Comment
chatbot_conversation_message_id uuid false public.chatbot_conversation_messages The chatbot_conversation_message that this row belongs to.
citation_ids uuid[] true IDs of any citations (annotations) that are associated with this message. A role assistant message can cite course material.
created_at timestamp with time zone now() false Timestamp when the record was created.
deleted_at timestamp with time zone true Timestamp when the record was deleted. If null, the record is not deleted.
id uuid uuid_generate_v4() false A unique, stable identifier for the record.
message_is_complete boolean false false Always true for messages from the user. The chatbot messages are streamed to the client, and this field is used to indicate whether that the stream is complete.
message_role message_role false The role of the message: is it from the user or the chatbot.
response_id text true The ID assigned by Azure per response, is the same for every message generated in one conversation turn of the LLM (one response). Used to fetch and delete a response from the Azure API.
text varchar(131072) false The message content.
updated_at timestamp with time zone now() false Timestamp when the record was last updated. The field is updated automatically by the set_timestamp trigger.
used_tokens integer 0 false The number of tokens used to send or receive this message. Is non-zero only for role user messages, which track all the tokens used for input, reasoning, and output.

Constraints

Name Type Definition
chatbot_conversation_messag_chatbot_conversation_messa_not_null n NOT NULL chatbot_conversation_message_id
chatbot_conversation_message__chatbot_conversation_message_fkey FOREIGN KEY FOREIGN KEY (chatbot_conversation_message_id) REFERENCES chatbot_conversation_messages(id) ON DELETE CASCADE
chatbot_conversation_message_messa_message_is_complete_not_null n NOT NULL message_is_complete
chatbot_conversation_message_messages_created_at_not_null n NOT NULL created_at
chatbot_conversation_message_messages_id_not_null n NOT NULL id
chatbot_conversation_message_messages_message_role_not_null n NOT NULL message_role
chatbot_conversation_message_messages_pkey PRIMARY KEY PRIMARY KEY (id)
chatbot_conversation_message_messages_text_not_null n NOT NULL text
chatbot_conversation_message_messages_updated_at_not_null n NOT NULL updated_at
chatbot_conversation_message_messages_used_tokens_not_null n NOT NULL used_tokens
not_null_for_llm_generated_messages CHECK CHECK ((((response_id IS NULL) AND (message_role = ‘user’::message_role)) OR ((response_id IS NOT NULL) AND (message_role <> ‘user’::message_role))))

Indexes

Name Definition
chatbot_conversation_message_messages_pkey CREATE UNIQUE INDEX chatbot_conversation_message_messages_pkey ON public.chatbot_conversation_message_messages USING btree (id)

Triggers

Name Definition
set_timestamp CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.chatbot_conversation_message_messages FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()

Relations

er

Generated by tbls