sidekick

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolution

type Resolution int

Resolution represents different image resolutions.

const (
	Res4K     Resolution = 3840
	Res2K     Resolution = 2048
	Res1080p  Resolution = 1920
	Res720p   Resolution = 1280
	Res480p   Resolution = 640
	Res360p   Resolution = 480
	Res320p   Resolution = 320
	Res240p   Resolution = 320
	Res144p   Resolution = 256
	Pixel1024 Resolution = 1024
	Pixel512  Resolution = 512
)

type SideKick

type SideKick struct {
}

func (*SideKick) CalculateNewDimensions

func (utility *SideKick) CalculateNewDimensions(bounds image.Rectangle, maxSize int) (int, int)

CalculateNewDimensions calculates the new width and height while maintaining the aspect ratio.

func (*SideKick) ClearLine

func (utility *SideKick) ClearLine(termconfig models.Terminal)

ClearLine clears the current line if output is enabled in the configuration

func (*SideKick) CreateAssistantMessage

func (utility *SideKick) CreateAssistantMessage(input string) models.Message

CreateAssistantMessage creates a new assistant message with the given input string

func (*SideKick) CreateEmbeddingRequest

func (utility *SideKick) CreateEmbeddingRequest(model models.Model, input []string) models.EmbeddingRequest

func (*SideKick) CreateMessage

func (utility *SideKick) CreateMessage(role models.Role, input string) models.Message

createMessage creates a new message with the given role and content.

func (*SideKick) CreateMessageWithImages

func (utility *SideKick) CreateMessageWithImages(role models.Role, input string, images *[]models.Base64Image) models.Message

CreateMessageWithImages creates a new message with the given role, content and images

func (*SideKick) CreateModerationRequest

func (utility *SideKick) CreateModerationRequest(input string) models.ModerationRequest

func (*SideKick) CreateUserMessage

func (utility *SideKick) CreateUserMessage(input string, images *[]models.Base64Image) models.Message

CreateUserMessage creates a new user message with the given input string

func (*SideKick) Debug

func (utility *SideKick) Debug(payload string, termconfig models.Terminal)

func (*SideKick) DecodeImage

func (utility *SideKick) DecodeImage(imageBytes []byte) (image.Image, string, error)

DecodeImage decodes image bytes into an image.Image and detects the format.

func (*SideKick) EncodeImage

func (utility *SideKick) EncodeImage(img image.Image, format string) ([]byte, error)

EncodeImage encodes an image into a specific format (JPEG, PNG, etc.).

func (*SideKick) Error

func (utility *SideKick) Error(err error)

PrintError prints an error message to the console in red.

func (*SideKick) PrepareArray

func (utility *SideKick) PrepareArray(messages []models.Message, includeStrategy models.IncludeStrategy, maxMessages int) []models.Message

PrepareArray prepares an array of messages based on the includeStrategy.

func (*SideKick) Print

func (utility *SideKick) Print(content string, termconfig models.Terminal)

Print prints the given content to the console with color and reset.

func (*SideKick) Println

func (utility *SideKick) Println(content string, termconfig models.Terminal)

Println prints the given content to the console with color and a newline character, then resets the color.

func (*SideKick) ReadFile

func (utility *SideKick) ReadFile(filepath string) ([]byte, error)

ReadFile reads a file and returns its base64 encoded content.

func (*SideKick) Resize

func (utility *SideKick) Resize(img image.Image, newWidth, newHeight int) image.Image

Resize resizes an image to the specified width and height using high-quality scaling.

func (*SideKick) ResizeImage

func (utility *SideKick) ResizeImage(imageBytes []byte, maxSize int) ([]byte, error)

ResizeImage resizes an image to the specified maximum dimension while maintaining its aspect ratio. Larger dimension (width or height) will be resized to maxSize. Input: imageBytes []byte (image data), maxSize int (max dimension). Output: Resized image as []byte, error if any issue occurs.

func (*SideKick) RunFunction

func (utility *SideKick) RunFunction(httpClient *http.Client, tool models.Tool, payload models.FunctionPayload, debug, trace bool) (models.FunctionResponse, error)

func (*SideKick) Trace

func (utility *SideKick) Trace(payload string, termconfig models.Terminal)

func (*SideKick) VerifyStatus added in v0.3.3

func (utility *SideKick) VerifyStatus(resp *http.Response) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL