Documentation
¶
Index ¶
- Variables
- func Init(bc base.Component) *component
- func NewClient(setup *structpb.Struct) (*goredis.Client, error)
- func WriteNonSystemMessage(client *goredis.Client, sessionID string, message MultiModalMessageWithTime) error
- func WriteSystemMessage(client *goredis.Client, sessionID string, message MultiModalMessageWithTime) error
- type ChatHistoryRetrieveInput
- type ChatHistoryRetrieveOutput
- type ChatMessageWriteInput
- type ChatMessageWriteOutput
- type ChatMultiModalMessageWriteInput
- type Message
- type MessageWithTime
- type MultiModalContent
- type MultiModalMessage
- type MultiModalMessageWithTime
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// DefaultLatestK is the default number of latest conversation turns to retrieve
DefaultLatestK = 5
)
Functions ¶
func WriteNonSystemMessage ¶
func WriteNonSystemMessage(client *goredis.Client, sessionID string, message MultiModalMessageWithTime) error
func WriteSystemMessage ¶
func WriteSystemMessage(client *goredis.Client, sessionID string, message MultiModalMessageWithTime) error
WriteSystemMessage writes system message for a given session ID
Types ¶
type ChatHistoryRetrieveOutput ¶
type ChatHistoryRetrieveOutput struct {
Messages []*MultiModalMessage `json:"messages"`
Status bool `json:"status"`
}
ChatHistoryReadOutput is a wrapper struct for the messages associated with a session ID
func RetrieveSessionMessages ¶
func RetrieveSessionMessages(client *goredis.Client, input ChatHistoryRetrieveInput) ChatHistoryRetrieveOutput
RetrieveSessionMessages retrieves the latest K conversation turns from the Redis list for the given session ID
type ChatMessageWriteInput ¶
type ChatMessageWriteOutput ¶
type ChatMessageWriteOutput struct {
Status bool `json:"status"`
}
func WriteMessage ¶
func WriteMessage(client *goredis.Client, input ChatMessageWriteInput) ChatMessageWriteOutput
func WriteMultiModelMessage ¶
func WriteMultiModelMessage(client *goredis.Client, input ChatMultiModalMessageWriteInput) ChatMessageWriteOutput
type ChatMultiModalMessageWriteInput ¶
type ChatMultiModalMessageWriteInput struct {
SessionID string `json:"session-id"`
MultiModalMessage
}
type MessageWithTime ¶
type MultiModalContent ¶
type MultiModalMessage ¶
type MultiModalMessage struct {
Role string `json:"role"`
Content []MultiModalContent `json:"content"`
Metadata *map[string]interface{} `json:"metadata,omitempty"`
}
type MultiModalMessageWithTime ¶
type MultiModalMessageWithTime struct {
MultiModalMessage
Timestamp int64 `json:"timestamp"`
}
func RetrieveSystemMessage ¶
func RetrieveSystemMessage(client *goredis.Client, sessionID string) (bool, *MultiModalMessageWithTime, error)
RetrieveSystemMessage gets system message based on a given session ID
Click to show internal directories.
Click to hide internal directories.