ai

package
v1.20.15 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(conf *lgc.Config)

Types

type ChatHistory

type ChatHistory []*ChatHistoryItem

type ChatHistoryItem

type ChatHistoryItem struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type OllamaChat

type OllamaChat struct {
	Url   string
	Model string
}

func NewOllamaChat

func NewOllamaChat(url string) (*OllamaChat, error)

func (*OllamaChat) Prompt

func (ollama *OllamaChat) Prompt(history ChatHistory, onSentence func(string), onToken func(string)) (*ChatHistoryItem, error)

type RequestBody

type RequestBody struct {
	Model    string      `json:"model"`
	Messages ChatHistory `json:"messages"`
	Stream   bool        `json:"stream"`
}

type ResponseBody

type ResponseBody struct {
	Model   string          `json:"model"`
	Message ChatHistoryItem `json:"message"`
	Done    bool            `json:"done"`
}

Jump to

Keyboard shortcuts

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