chat

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClosestVector

func ClosestVector(a []float64, bs [][]float64) (max float64, pos int, err error)

finds the clostes in bs to a, returning the max similarity and position

func CosineSimilarity

func CosineSimilarity(a []float64, b []float64) (cosine float64, err error)

https://en.wikipedia.org/wiki/Cosine_similarity 1 is similare 0 is orthogonal -1 is opposite

func GoogleChat

func GoogleChat(model string, messages []Message, examples []Example, params map[string]any) (string, error)

func GoogleExtractContent

func GoogleExtractContent(body string) (string, error)

func OpenaiChat

func OpenaiChat(model string, messages []Message, params map[string]any) (string, error)

func OpenaiEmbedding

func OpenaiEmbedding(inputs []string) (string, error)

func OpenaiExtractContent

func OpenaiExtractContent(body string) (string, error)

Types

type Chat

type Chat struct {
	*hof.Node[any]

	Name        string
	HumanName   string
	MachineName string

	Description        string
	HumanDescription   string
	MachineDescription string

	// user inputs
	Args     []string
	Files    map[string]string
	Question string

	Model string

	System     string
	Examples   []Example
	Messages   []Message
	Parameters map[string]any
}

type Example

type Example struct {
	Input  string
	Output string
}

type Message

type Message struct {
	Role    string
	Content string
}

type Session

type Session struct {
	System   string
	Examples []Example
	Messages []Message
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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