utils

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(slice []string, item string) bool

func Input

func Input(prompt string) (string, error)

func InputWithColor

func InputWithColor(prompt, cssColorCode string) (string, error)

func LoadFile

func LoadFile(filePath string) (string, error)

Loads a file and return an error if its not valid UTF-8

func PrintChatCompletionStream

func PrintChatCompletionStream(stream *openai.ChatCompletionStream) (string, error)

func PrintColoredText

func PrintColoredText(text, cssColorCode string)

PrintColoredText prints the given text in the specified CSS color code using fmt.Print.

func PrintColoredTextLn

func PrintColoredTextLn(text, cssColorCode string)

PrintColoredTextLn prints the given text in the specified CSS color code using fmt.Println.

func ReverseSlice

func ReverseSlice[T any](s []T)

ReverseSlice reverses the order of the elements in a slice of any type.

func SimpleTokenize

func SimpleTokenize(text string) []string

func SortByAverage

func SortByAverage(fragments []memory.MemoryFragment) []memory.MemoryFragment

func SortByScore

func SortByScore(fragments []memory.MemoryFragment) []memory.MemoryFragment

func WriteFile

func WriteFile(filePath string, contents string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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