Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadImageFromFile ¶
func ReadImageFromFile(filepath string) (models.Base64Image, error)
Types ¶
type AICompanion ¶
type AICompanion interface {
// PrepareConversation initializes a new conversation with a default system message
PrepareConversation() []models.Message
// CreateMessage creates a new message with the given role and input string
CreateMessage(role models.Role, input string) models.Message
// CreateMessageWithImages creates a new message with the given role, input string, and images
CreateMessageWithImages(role models.Role, message string, images []models.Base64Image) models.Message
// AddMessage adds a new message to the conversation
AddMessage(message models.Message)
// GetConfig returns the current configuration for the AI companion
GetConfig() models.Configuration
// SetConfig sets a new configuration for the AI companion
SetConfig(config models.Configuration)
// GetSystemRole returns the current system role message
GetSystemRole() models.Message
// SetSystemRole sets a new system role message
SetSystemRole(prompt string)
// GetConversation returns the current conversation
GetConversation() []models.Message
// SetConversation sets the current conversation
SetConversation(conversation []models.Message)
// GetClient returns the current HTTP client used for requests
GetClient() *http.Client
// SetClient sets a new HTTP client for requests
SetClient(client *http.Client)
// interactions
// SendChatRequest sends a chat request to an AI model and returns a response message
SendChatRequest(message models.Message) (models.Message, error)
// SendCompletionRequest sends a completion request to an AI model and returns a response message
SendCompletionRequest(message models.Message) (models.Message, error)
// SendEmbeddingRequest sends an embedding request to an AI model and returns a response
SendEmbeddingRequest(embedding models.EmbeddingRequest) (models.EmbeddingResponse, error)
// SendModerationRequest sends a moderation request to an AI model and returns a response
SendModerationRequest(moderationRequest models.ModerationRequest) (models.ModerationResponse, error)
}
AICompanion defines the interface for interacting with AI models.
func NewCompanion ¶
func NewCompanion(config models.Configuration) AICompanion
NewCompanion creates a new Companion instance with the provided configuration.
Click to show internal directories.
Click to hide internal directories.