llm

package
v0.0.0-...-335761d Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const OPEN_API_URL = "https://api.openai.com/v1/chat/completions"

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

type Choice struct {
	Message Message `json:"message"`
}

type JSONUsage

type JSONUsage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

type LLMResponse

type LLMResponse struct {
	Id      string    `json:"id"`
	Model   string    `json:"model"`
	Usage   JSONUsage `json:"usage"`
	Choices []Choice  `json:"choices"`
}

type Message

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

type MockService

type MockService struct {
}

func (*MockService) Query

func (s *MockService) Query(prompts []core.LLMPrompt) ([]byte, error)

func (*MockService) ResponseToLLMPrompt

func (s *MockService) ResponseToLLMPrompt(response []byte) (core.LLMPrompt, error)

type Service

type Service struct {
}

func (*Service) Query

func (s *Service) Query(prompts []core.LLMPrompt) ([]byte, error)

func (*Service) ResponseToLLMPrompt

func (s *Service) ResponseToLLMPrompt(response []byte) (core.LLMPrompt, error)

Jump to

Keyboard shortcuts

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