assistant

package
v0.0.0-...-3d9f7a2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ChainUnitTestInputKeys  = []string{"code"}
	ChainUnitTestOutputKeys = []string{"unit_tests"}
)

Functions

func NewChainUnitTest

func NewChainUnitTest(config ModelConfig, llm ComposedLLM) chains.Chain

Types

type Assistant

type Assistant struct {
	// contains filtered or unexported fields
}

Assistant is a wrapper around the assistant api

func New

func New(cfg *Config) *Assistant

New creates a new assistant

func (*Assistant) ChatConfig

func (assistant *Assistant) ChatConfig() ModelConfig

Config returns the config for assistant

func (*Assistant) CompletionConfig

func (assistant *Assistant) CompletionConfig() ModelConfig

func (*Assistant) ForChat

func (assistant *Assistant) ForChat() ComposedLLM

func (*Assistant) ForUnitTests

func (assistant *Assistant) ForUnitTests() chains.Chain

type ChatUnitTest

type ChatUnitTest struct {
	// contains filtered or unexported fields
}

func (*ChatUnitTest) Call

func (c *ChatUnitTest) Call(ctx context.Context, values map[string]any, options ...chains.ChainCallOption) (map[string]any, error)

func (*ChatUnitTest) GetInputKeys

func (c *ChatUnitTest) GetInputKeys() []string

implements chains.Chain for ChainUnitTest

func (*ChatUnitTest) GetMemory

func (c *ChatUnitTest) GetMemory() schema.Memory

implements chains.Chain for ChainUnitTest

func (*ChatUnitTest) GetOutputKeys

func (c *ChatUnitTest) GetOutputKeys() []string

implements chains.Chain for ChainUnitTest

type ComposedLLM

type ComposedLLM interface {
	llms.LLM
	llms.ChatLLM
}

type Config

type Config struct {
	// APIKey to access assistant api
	APIKey   string      `json:"api_key"`
	Chat     ModelConfig `json:"chat"`
	UnitTest ModelConfig `json:"unit_test"`
}

func DefaultConfig

func DefaultConfig() Config

type Model

type Model string
const (
	GPT3    Model = "gpt-3.5-turbo"
	Davinci Model = "text-davinci-003"
)

func (Model) String

func (m Model) String() string

type ModelConfig

type ModelConfig struct {
	// Model to use for assistant
	// Use gpt-3.5-turbo by default
	Model `json:"model"`
	// Temperature for assistant by default
	Temperature float64 `json:"temperature"`
	// MaxTokens for assistant by default
	MaxTokens int `json:"max_tokens"`
}

Config for assistant

Jump to

Keyboard shortcuts

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