-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(catalog): add conversation and message api (#421)
- Loading branch information
Showing
3 changed files
with
746 additions
and
4 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,203 @@ | ||
syntax = "proto3"; | ||
|
||
package artifact.artifact.v1alpha; | ||
|
||
// Protocol Buffers Well-Known Types | ||
import "google/protobuf/timestamp.proto"; | ||
import "google/api/field_behavior.proto"; | ||
|
||
|
||
|
||
// Conversation represents a chat conversation | ||
message Conversation { | ||
// conversation id/name | ||
string uid = 1; | ||
// namespace id | ||
string namespace_id = 2; | ||
// catalog id | ||
string catalog_id = 3; | ||
// unique identifier of the conversation created by the system | ||
string id = 4; | ||
// creation time of the conversation | ||
google.protobuf.Timestamp create_time = 5; | ||
// update time of the conversation | ||
google.protobuf.Timestamp update_time = 6; | ||
} | ||
|
||
// Message represents a single message in a conversation | ||
message Message { | ||
// message type | ||
enum MessageType { | ||
// unspecified | ||
MESSAGE_TYPE_UNSPECIFIED = 0; | ||
// text | ||
MESSAGE_TYPE_TEXT = 1; | ||
} | ||
// message uid | ||
string uid = 1; | ||
// catalog uid | ||
string catalog_uid = 2; | ||
// conversation uid | ||
string conversation_uid = 3; | ||
// message content | ||
string content = 4; | ||
// message role e.g., "user" or "assistant" | ||
string role = 5; | ||
// message type | ||
MessageType type = 6; | ||
// creation time of the message | ||
google.protobuf.Timestamp create_time = 7; | ||
// update time of the message | ||
google.protobuf.Timestamp update_time = 8; | ||
} | ||
|
||
// CreateConversationRequest is used to create a new conversation | ||
message CreateConversationRequest { | ||
// namespace id | ||
string namespace_id = 1 [(google.api.field_behavior) = REQUIRED]; | ||
// catalog id | ||
string catalog_id = 2; | ||
// conversation id. only allow kabab case | ||
string conversation_id = 3 [(google.api.field_behavior) = REQUIRED]; | ||
} | ||
|
||
// CreateConversationResponse returns the created conversation | ||
message CreateConversationResponse { | ||
// conversation | ||
Conversation conversation = 1; | ||
} | ||
|
||
// ListConversationsRequest is used to list conversations | ||
message ListConversationsRequest { | ||
// namespace id | ||
string namespace_id = 1; | ||
// catalog id | ||
string catalog_id = 2; | ||
// page size | ||
int32 page_size = 3; | ||
// page token | ||
string page_token = 4; | ||
} | ||
|
||
// ListConversationsResponse returns a list of conversations | ||
message ListConversationsResponse { | ||
// conversations | ||
repeated Conversation conversations = 1; | ||
// next page token | ||
string next_page_token = 2; | ||
} | ||
|
||
// UpdateConversationRequest is used to update a conversation | ||
message UpdateConversationRequest { | ||
// namespace id | ||
string namespace_id = 1; | ||
// catalog id | ||
string catalog_id = 2; | ||
// conversation id | ||
string conversation_id = 3; | ||
// new conversation id | ||
string new_conversaion_id = 4; | ||
} | ||
|
||
// UpdateConversationResponse returns the updated conversation | ||
message UpdateConversationResponse { | ||
// conversation | ||
Conversation conversation = 1; | ||
} | ||
|
||
// DeleteConversationRequest is used to delete a conversation | ||
message DeleteConversationRequest { | ||
// namespace id | ||
string namespace_id = 1; | ||
// catalog id | ||
string catalog_id = 2; | ||
// conversation id | ||
string conversation_id = 3; | ||
} | ||
|
||
// DeleteConversationResponse is empty as no content needs to be returned | ||
message DeleteConversationResponse { | ||
} | ||
|
||
// CreateMessageRequest is used to create a new message | ||
message CreateMessageRequest { | ||
// namespace id | ||
string namespace_id = 1; | ||
// catalog id | ||
string catalog_id = 2; | ||
// conversation id | ||
string conversation_id = 3; | ||
// message content | ||
string content = 4; | ||
// message role | ||
string role = 5; | ||
// message type | ||
Message.MessageType type = 6; | ||
} | ||
|
||
// CreateMessageResponse returns the created message | ||
message CreateMessageResponse { | ||
// message | ||
Message message = 1; | ||
} | ||
|
||
// ListMessagesRequest is used to list messages in a conversation | ||
message ListMessagesRequest { | ||
// namespace id | ||
string namespace_id = 1; | ||
// catalog id | ||
string catalog_id = 2; | ||
// conversation id | ||
string conversation_id = 3; | ||
// latest k messages | ||
int32 latest_k = 4; | ||
// page size | ||
int32 page_size = 5; | ||
// page token | ||
string page_token = 6; | ||
// include system messages | ||
bool include_system_messages = 7; | ||
} | ||
|
||
// ListMessagesResponse returns a list of messages | ||
message ListMessagesResponse { | ||
// messages | ||
repeated Message messages = 1; | ||
// next page token | ||
string next_page_token = 2; | ||
} | ||
|
||
// UpdateMessageRequest is used to update a message | ||
message UpdateMessageRequest { | ||
// namespace id | ||
string namespace_id = 1; | ||
// catalog id | ||
string catalog_id = 2; | ||
// conversation id | ||
string conversation_id = 3; | ||
// message uid | ||
string message_uid = 4; | ||
// new message content | ||
string content = 5; | ||
} | ||
|
||
// UpdateMessageResponse returns the updated message | ||
message UpdateMessageResponse { | ||
// message | ||
Message message = 1; | ||
} | ||
|
||
// DeleteMessageRequest is used to delete a message | ||
message DeleteMessageRequest { | ||
// namespace id | ||
string namespace_id = 1; | ||
// catalog id | ||
string catalog_id = 2; | ||
// conversation id | ||
string conversation_id = 3; | ||
// message uid | ||
string message_uid = 4; | ||
} | ||
|
||
// DeleteMessageResponse is empty as no content needs to be returned | ||
message DeleteMessageResponse {} |
Oops, something went wrong.