openai

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FamiliesCmd = &cobra.Command{
	Use:   "ls-families",
	Short: "list families",
	Run: func(cmd *cobra.Command, args []string) {
		models := SimpleModelsJSON{}
		err := json.Unmarshal([]byte(modelsJson), &models)
		cobra.CheckErr(err)

		ctx := cmd.Context()

		gp, _, err := cli.CreateGlazedProcessorFromCobra(cmd)
		cobra.CheckErr(err)

		for _, family := range models.Families {
			err = gp.AddRow(ctx, family)
			cobra.CheckErr(err)
		}

		err = gp.Close(ctx)
		cobra.CheckErr(err)
	},
}
View Source
var ModelsCmd = &cobra.Command{
	Use:   "ls-models",
	Short: "list models",
	Run: func(cmd *cobra.Command, args []string) {
		ctx := cmd.Context()

		models := SimpleModelsJSON{}
		err := json.Unmarshal([]byte(modelsJson), &models)
		cobra.CheckErr(err)

		gp, _, err := cli.CreateGlazedProcessorFromCobra(cmd)
		cobra.CheckErr(err)

		for _, completion := range models.Completion {
			err = gp.AddRow(ctx, completion)
			cobra.CheckErr(err)
		}

		err = gp.Close(ctx)
		cobra.CheckErr(err)
	},
}
View Source
var OpenaiCmd = &cobra.Command{
	Use:   "openai",
	Short: "OpenAI commands",
}

Functions

func LoadModelsHelpFiles

func LoadModelsHelpFiles() ([]*help.Section, error)

func NewInfoCommand added in v0.2.8

func NewInfoCommand() *cobra.Command

Types

type Completion

type Completion struct {
	Name                   string `json:"name"`
	Family                 string `json:"family"`
	Description            string `json:"description"`
	MaxTokens              int    `json:"max_tokens"`
	TrainingDataCutoffDate string `json:"training_data_cutoff_date"`
}

type EngineInfoCommand added in v0.1.7

type EngineInfoCommand struct {
	*cmds.CommandDescription
}

func NewEngineInfoCommand added in v0.1.7

func NewEngineInfoCommand() (*EngineInfoCommand, error)

func (*EngineInfoCommand) Run added in v0.1.7

func (c *EngineInfoCommand) Run(
	ctx context.Context,
	parsedLayers map[string]*layers.ParsedParameterLayer,
	ps map[string]interface{},
	gp middlewares.Processor,
) error

type Family

type Family struct {
	Name             string   `json:"name"`
	Description      string   `json:"description"`
	PricePer1kTokens float64  `json:"price_per_1k_tokens"`
	GoodAt           []string `json:"good_at"`
	KeyPoints        []string `json:"key_points"`
	Subtitle         string   `json:"subtitle"`
	Short            string   `json:"short"`
}

type ListEnginesCommand added in v0.1.7

type ListEnginesCommand struct {
	*cmds.CommandDescription
}

func NewListEngineCommand added in v0.1.7

func NewListEngineCommand() (*ListEnginesCommand, error)

func (*ListEnginesCommand) Run added in v0.1.7

func (c *ListEnginesCommand) Run(
	ctx context.Context,
	parsedLayers map[string]*layers.ParsedParameterLayer,
	ps map[string]interface{},
	gp middlewares.Processor,
) error

type ModelsJSON

type ModelsJSON struct {
	Completion []Completion `json:"completion"`
	Families   []Family     `json:"families"`
}

type SimpleModelsJSON

type SimpleModelsJSON struct {
	Completion []types.Row `json:"completion"`
	Families   []types.Row `json:"families"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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