summarize

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OllamaChatRequest

type OllamaChatRequest struct {
	Model    string `json:"model"`
	Messages []struct {
		Role    string `json:"role"`
		Content string `json:"content"`
	} `json:"messages"`
	Stream  bool           `json:"stream"`
	Options map[string]any `json:"options"`
}

OllamaChatRequest HTTP body to send for the Summarize method.

type OllamaChatResponse

type OllamaChatResponse struct {
	Model   string `json:"model"`
	Message struct {
		Role    string `json:"role"`
		Content string `json:"content"`
	} `json:"message"`
	Done bool `json:"done"`
}

OllamaChatResponse HTTP body returned by Ollama

type OllamaClient

type OllamaClient struct {
	// Address is the combination of host:port for the Ollama endpoint.
	Address string
	// Model of AI to use.
	Model string
	// HttpClient to use when making requests.
	HttpClient *http.Client
}

OllamaClient to use when addressing the Ollama API.

func NewOllamaClient

func NewOllamaClient(address, model string) *OllamaClient

NewOllamaClient creates a new OllamaClient using the http.DefaultClient

func (*OllamaClient) Summarize

func (c *OllamaClient) Summarize(lines []transcribe.Line) (string, error)

Summarize the given lines of text using a special system prompt.

func (*OllamaClient) UpdateModel

func (c *OllamaClient) UpdateModel() error

UpdateModel updates the Ollama model by pulling it.

type OllamaPullRequest

type OllamaPullRequest struct {
	Name     string `json:"name"`
	Insecure bool   `json:"insecure"`
	Stream   bool   `json:"stream"`
}

OllamaPullRequest HTTP body to send for the UpdateModel method.

type OpenAIClient

type OpenAIClient struct {
	// Client to use.
	Client *openai.Client
	// Model of AI to use.
	Model string
}

OpenAIClient to use when addressing the OpenAI API.

func NewOpenAIClient

func NewOpenAIClient(baseUrl, model, orgId string, apiType openai.APIType, apiVersion string) *OpenAIClient

NewOpenAIClient creates a new OpenAIClient using the http.DefaultClient

func (*OpenAIClient) Summarize

func (c *OpenAIClient) Summarize(lines []transcribe.Line) (string, error)

Summarize the given lines of text using a special system prompt.

Jump to

Keyboard shortcuts

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