settings

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 10 Imported by: 7

Documentation

Index

Constants

View Source
const AiChatSlug = "ai-chat"
View Source
const AiClientSlug = "ai-client"

Variables

View Source
var ErrMissingYAMLAPIKey = &yaml.TypeError{Errors: []string{"missing api key"}}

Functions

This section is empty.

Types

type APISettings added in v0.4.4

type APISettings struct {
	APIKeys  map[ApiType]string `yaml:"api_keys,omitempty" glazed.parameter:"*-api-key"`
	BaseUrls map[ApiType]string `yaml:"base_urls,omitempty" glazed.parameter:"*-base-url"`
}

func NewAPISettings added in v0.4.4

func NewAPISettings() *APISettings

func (*APISettings) Clone added in v0.4.4

func (s *APISettings) Clone() *APISettings

type ApiType added in v0.4.4

type ApiType string
const (
	ApiTypeOpenAI    ApiType = "openai"
	ApiTypeAnyScale  ApiType = "anyscale"
	ApiTypeFireworks ApiType = "fireworks"
	ApiTypeClaude    ApiType = "claude"
	// not implemented from here on down
	ApiTypeOllama     ApiType = "ollama"
	ApiTypeMistral    ApiType = "mistral"
	ApiTypePerplexity ApiType = "perplexity"
	// Cohere has connectors
	ApiTypeCohere ApiType = "cohere"
)

type ChatParameterLayer

type ChatParameterLayer struct {
	*layers.ParameterLayerImpl `yaml:",inline"`
}

func NewChatParameterLayer

func NewChatParameterLayer(options ...layers.ParameterLayerOptions) (*ChatParameterLayer, error)

type ChatSettings

type ChatSettings struct {
	Engine            *string           `yaml:"engine,omitempty" glazed.parameter:"ai-engine"`
	ApiType           *ApiType          `yaml:"api_type,omitempty" glazed.parameter:"ai-api-type"`
	MaxResponseTokens *int              `yaml:"max_response_tokens,omitempty" glazed.parameter:"ai-max-response-tokens"`
	TopP              *float64          `yaml:"top_p,omitempty" glazed.parameter:"ai-top-p"`
	Temperature       *float64          `yaml:"temperature,omitempty" glazed.parameter:"ai-temperature"`
	Stop              []string          `yaml:"stop,omitempty" glazed.parameter:"ai-stop"`
	Stream            bool              `yaml:"stream,omitempty" glazed.parameter:"ai-stream"`
	APIKeys           map[string]string `yaml:"api_keys,omitempty" glazed.parameter:"*-api-key"`
}

func NewChatSettings

func NewChatSettings() (*ChatSettings, error)

func (*ChatSettings) Clone

func (s *ChatSettings) Clone() *ChatSettings

type ClientParameterLayer

type ClientParameterLayer struct {
	*layers.ParameterLayerImpl `yaml:",inline"`
}

func NewClientParameterLayer

func NewClientParameterLayer(options ...layers.ParameterLayerOptions) (*ClientParameterLayer, error)

type ClientSettings

type ClientSettings struct {
	Timeout        *time.Duration `yaml:"timeout,omitempty"`
	TimeoutSeconds *int           `yaml:"timeout_second,omitempty" glazed.parameter:"timeout"`
	Organization   *string        `yaml:"organization,omitempty" glazed.parameter:"organization"`
	UserAgent      *string        `yaml:"user_agent,omitempty" glazed.parameter:"user-agent"`
	HTTPClient     *http.Client   `yaml:"omitempty"`
}

func NewClientSettings

func NewClientSettings() *ClientSettings

func (*ClientSettings) Clone

func (cs *ClientSettings) Clone() *ClientSettings

func (*ClientSettings) UnmarshalYAML

func (cs *ClientSettings) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML overrides YAML parsing to convert time.duration from int

func (*ClientSettings) UpdateFromParameters

func (cs *ClientSettings) UpdateFromParameters(parsedLayers *layers.ParsedLayer) error

func (*ClientSettings) UpdateFromParsedLayer

func (cs *ClientSettings) UpdateFromParsedLayer(layer *layers.ParsedLayer) error

type StepSettings

type StepSettings struct {
	API *APISettings `yaml:"api_keys,omitempty"`
	// TODO(manuel, 2024-02-21) glazed.layer is not yet implemented
	Chat   *ChatSettings    `yaml:"chat,omitempty" glazed.layer:"ai-chat"`
	OpenAI *openai.Settings `yaml:"openai,omitempty" glazed.layer:"openai-chat"`
	Client *ClientSettings  `yaml:"client,omitempty" glazed.layer:"ai-client"`
	Claude *claude.Settings `yaml:"claude,omitempty" glazed.layer:"claude-chat"`
	Ollama *ollama.Settings `yaml:"ollama,omitempty" glazed.layer:"ollama-chat"`
}

func NewStepSettings added in v0.2.24

func NewStepSettings() (*StepSettings, error)

func NewStepSettingsFromYAML

func NewStepSettingsFromYAML(s io.Reader) (*StepSettings, error)

func (*StepSettings) Clone

func (s *StepSettings) Clone() *StepSettings

func (*StepSettings) GetMetadata added in v0.4.1

func (ss *StepSettings) GetMetadata() map[string]interface{}

func (*StepSettings) UpdateFromParsedLayers

func (s *StepSettings) UpdateFromParsedLayers(parsedLayers *layers.ParsedLayers) error

UpdateFromParsedLayers updates the settings of a chat step from the parsedLayers of a glazed command.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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