Documentation
¶
Index ¶
- func NewProvider() (provider provider.Provider)
- type Model
- type ModelsList
- type Pricing
- type Provider
- func (p *Provider) Available(logger *log.Logger) (err error)
- func (p *Provider) ID() (id string)
- func (p *Provider) Models() (models []model.Model, err error)
- func (p *Provider) Query(ctx context.Context, modelIdentifier string, promptText string) (response string, err error)
- func (p *Provider) SetToken(token string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProvider ¶
NewProvider returns an "openrouter.ai" provider.
Types ¶
type Model ¶ added in v0.6.0
type Model struct {
// ID holds the model id.
ID string `json:"id"`
// Name holds the model name.
Name string `json:"name"`
// Pricing holds the pricing information of a model.
Pricing Pricing `json:"pricing"`
}
Model holds a model.
type ModelsList ¶ added in v0.6.0
type ModelsList struct {
Models []Model `json:"data"`
}
ModelsList holds a list of models.
type Pricing ¶ added in v0.6.0
type Pricing struct {
// Prompt holds the price for a prompt in dollars per token.
Prompt string `json:"prompt"`
// Completion holds the price for a completion in dollars per token.
Completion string `json:"completion"`
// Request holds the price for a request in dollars per request.
Request string `json:"request"`
// Image holds the price for an image in dollars per token.
Image string `json:"image"`
}
Pricing holds the pricing information of a model.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider holds an "openrouter.ai" provider using its public REST API.
func (*Provider) Available ¶
Available checks if the provider is ready to be used. This might include checking for an installation or making sure an API access token is valid.
func (*Provider) Models ¶
Models returns which models are available to be queried via this provider.
Click to show internal directories.
Click to hide internal directories.