Skip to content

Commit

Permalink
refactor, Move the model's meta information structures from the provi…
Browse files Browse the repository at this point in the history
…der to the model package, since it is model related

Part of #296
  • Loading branch information
ruiAzevedo19 committed Aug 1, 2024
1 parent 7bf5359 commit 2d04793
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
23 changes: 23 additions & 0 deletions model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ type Model interface {
ID() (id string)
}

// MetaInformation holds a model.
type MetaInformation 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"`
}

// Pricing holds the pricing information of a model.
type Pricing struct {
// Prompt holds the price for a prompt in dollars per token.
Prompt float64 `json:"prompt,string"`
// Completion holds the price for a completion in dollars per token.
Completion float64 `json:"completion,string"`
// Request holds the price for a request in dollars per request.
Request float64 `json:"request,string"`
// Image holds the price for an image in dollars per token.
Image float64 `json:"image,string"`
}

// Context holds the data needed by a model for running a task.
type Context struct {
// Language holds the language for which the task should be evaluated.
Expand Down
25 changes: 1 addition & 24 deletions provider/openrouter/openrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,7 @@ func (p *Provider) ID() (id string) {

// ModelsList holds a list of models.
type ModelsList struct {
Models []Model `json:"data"`
}

// Model holds a model.
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"`
}

// Pricing holds the pricing information of a model.
type Pricing struct {
// Prompt holds the price for a prompt in dollars per token.
Prompt float64 `json:"prompt,string"`
// Completion holds the price for a completion in dollars per token.
Completion float64 `json:"completion,string"`
// Request holds the price for a request in dollars per request.
Request float64 `json:"request,string"`
// Image holds the price for an image in dollars per token.
Image float64 `json:"image,string"`
Models []model.MetaInformation `json:"data"`
}

// Models returns which models are available to be queried via this provider.
Expand Down

0 comments on commit 2d04793

Please sign in to comment.