mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
Decouple API contract from internal models by introducing dedicated DTOs for requests and responses. - Add Response DTOs for all resources (API Keys, Bindings, Models, Namespaces, etc.) - Update Swagger annotations to use DTOs with field examples instead of internal models - Refactor handlers to bind and return DTO structures - Consolidate request/response definitions in the dto package
35 lines
1.6 KiB
Go
35 lines
1.6 KiB
Go
package dto
|
|
|
|
import "time"
|
|
|
|
// ModelResponse represents a model in API responses.
|
|
// @Description Model response
|
|
type ModelResponse struct {
|
|
ID uint `json:"id" example:"1"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Name string `json:"name" example:"gpt-4"`
|
|
Kind string `json:"kind" example:"chat"`
|
|
ContextWindow int `json:"context_window" example:"128000"`
|
|
CostPerToken float64 `json:"cost_per_token" example:"0.00003"`
|
|
SupportsVision bool `json:"supports_vision" example:"true"`
|
|
SupportsFunctions bool `json:"supports_functions" example:"true"`
|
|
SupportsToolChoice bool `json:"supports_tool_choice" example:"true"`
|
|
SupportsFIM bool `json:"supports_fim" example:"false"`
|
|
MaxOutputTokens int `json:"max_output_tokens" example:"4096"`
|
|
}
|
|
|
|
// ModelDTO is used for create/update of model capabilities.
|
|
// @Description Model create/update request
|
|
type ModelDTO struct {
|
|
Name string `json:"name" example:"gpt-4"`
|
|
Kind string `json:"kind" example:"chat"`
|
|
ContextWindow int `json:"context_window" example:"128000"`
|
|
CostPerToken float64 `json:"cost_per_token" example:"0.00003"`
|
|
SupportsVision bool `json:"supports_vision" example:"true"`
|
|
SupportsFunctions bool `json:"supports_functions" example:"true"`
|
|
SupportsToolChoice bool `json:"supports_tool_choice" example:"true"`
|
|
SupportsFIM bool `json:"supports_fim" example:"false"`
|
|
MaxOutputTokens int `json:"max_output_tokens" example:"4096"`
|
|
}
|