Files
langchaingo/memory/cloudsql/chat_message_history_options.go
T
Averi Kitsch 77b2d7bf3a memory: add interfaces for Google AlloyDB and Cloud SQL (#1205)
* memory: add interfaces for Google AlloyDB and Cloud SQL
2025-04-17 14:01:24 -07:00

29 lines
797 B
Go

package cloudsql
const (
defaultSchemaName = "public"
)
// ChatMessageHistoryStoresOption is a function for creating chat message
// history with other than the default values.
type ChatMessageHistoryStoresOption func(c *ChatMessageHistory)
// WithSchemaName sets the schemaName field for the ChatMessageHistory.
func WithSchemaName(schemaName string) ChatMessageHistoryStoresOption {
return func(c *ChatMessageHistory) {
c.schemaName = schemaName
}
}
// applyChatMessageHistoryOptions applies the given options to the
// ChatMessageHistory.
func applyChatMessageHistoryOptions(cmh ChatMessageHistory, opts ...ChatMessageHistoryStoresOption) ChatMessageHistory {
cmh.schemaName = defaultSchemaName
// Check for optional values.
for _, opt := range opts {
opt(&cmh)
}
return cmh
}