ollama

package
v0.0.0-...-fa30edc Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoChatCompletion

func DoChatCompletion(model string, endpoint string, prompt Prompt) (string, error)

func GetEmbedding

func GetEmbedding(model string, endpoint string, prompt Prompt) ([]float64, error)

func ParseChatCompletionResponse

func ParseChatCompletionResponse(resp *http.Response) (string, error)

Types

type ChatCompletion

type ChatCompletion struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
	Images   []string  `json:"images,omitempty"`
	Stream   bool      `json:"stream"`
	Raw      bool      `json:"raw"`
}

func NewChatCompletionRequest

func NewChatCompletionRequest(model string, prompt Prompt) ChatCompletion

type Message

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

type Messages

type Messages []Message

func PromptToMessages

func PromptToMessages(prompt Prompt) Messages

func (*Messages) Add

func (m *Messages) Add(role string, content string)

type Prompt

type Prompt interface {
	GetPurpose() string
	GetHistory() ([]string, []string)
	GetQuestion() string
	GetReferences() [][]byte
}

Jump to

Keyboard shortcuts

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