openai

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 19 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)

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

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

		s, err := of.Output()
		if err != nil {
			_, _ = fmt.Fprintf(os.Stderr, "Error rendering output: %s\n", err)
			os.Exit(1)
		}
		fmt.Print(s)
		cobra.CheckErr(err)
	},
}
View Source
var ModelsCmd = &cobra.Command{
	Use:   "ls-models",
	Short: "list models",
	Run: func(cmd *cobra.Command, args []string) {

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

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

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

		s, err := of.Output()
		if err != nil {
			_, _ = fmt.Fprintf(os.Stderr, "Error rendering output: %s\n", err)
			os.Exit(1)
		}
		fmt.Print(s)
		cobra.CheckErr(err)
	},
}
View Source
var OpenaiCmd = &cobra.Command{
	Use:   "openai",
	Short: "OpenAI commands",
}

Functions

func LoadModelsHelpFiles

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

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 CompletionCommand added in v0.1.4

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

func NewCompletionCommand added in v0.1.4

func NewCompletionCommand() (*CompletionCommand, error)

func (*CompletionCommand) Description added in v0.1.4

func (j *CompletionCommand) Description() *cmds.CommandDescription

func (*CompletionCommand) Run added in v0.1.4

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

type EmbeddingsCommand added in v0.1.7

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

func NewEmbeddingsCommand added in v0.1.7

func NewEmbeddingsCommand() (*EmbeddingsCommand, error)

func (*EmbeddingsCommand) Description added in v0.1.7

func (c *EmbeddingsCommand) Description() *cmds.CommandDescription

func (*EmbeddingsCommand) Run added in v0.1.7

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

type EngineInfoCommand added in v0.1.7

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

func NewEngineInfoCommand added in v0.1.7

func NewEngineInfoCommand() (*EngineInfoCommand, error)

func (*EngineInfoCommand) Description added in v0.1.7

func (c *EngineInfoCommand) Description() *cmds.CommandDescription

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 cmds.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 {
	// contains filtered or unexported fields
}

func NewListEngineCommand added in v0.1.7

func NewListEngineCommand() (*ListEnginesCommand, error)

func (*ListEnginesCommand) Description added in v0.1.7

func (c *ListEnginesCommand) Description() *cmds.CommandDescription

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 cmds.Processor,
) error

type ModelsJSON

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

type SimpleModelsJSON

type SimpleModelsJSON struct {
	Completion []map[string]interface{} `json:"completion"`
	Families   []map[string]interface{} `json:"families"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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