| 1 | package provider |
| 2 | |
| 3 | import "slices" |
| 4 | |
| 5 | // ModelModality identifies an input modality accepted by a model. Keep this |
| 6 | // type open for future audio/video/file capabilities; the first implementation |
| 7 | // only routes text and image inputs. |
| 8 | type ModelModality string |
| 9 | |
| 10 | const ( |
| 11 | ModalityText ModelModality = "text" |
| 12 | ModalityImage ModelModality = "image" |
| 13 | ) |
| 14 | |
| 15 | // ModelInfo is the adapter-owned, model-level capability metadata. A nil |
| 16 | // InputModalities means that the adapter could not determine the capability; |
| 17 | // an explicit []{"text"} is a deliberate negative declaration. |
| 18 | type ModelInfo struct { |
| 19 | ID string `json:"id"` |
| 20 | Name string `json:"name,omitempty"` |
| 21 | API string `json:"api,omitempty"` |
| 22 | BaseURL string `json:"base_url,omitempty"` |
| 23 | InputModalities []ModelModality `json:"input_modalities,omitempty"` |
| 24 | ContextWindow int `json:"context_window,omitempty"` |
| 25 | MaxOutputTokens int `json:"max_output_tokens,omitempty"` |
| 26 | Reasoning bool `json:"reasoning,omitempty"` |
| 27 | Pricing *Pricing `json:"pricing,omitempty"` |
| 28 | } |
| 29 | |
| 30 | // ModelInfoProvider is implemented by providers that can expose metadata for |
| 31 | // the exact model instance they were constructed for. It is optional so older |
| 32 | // third-party providers remain source-compatible. |
| 33 | type ModelInfoProvider interface { |
| 34 | ModelInfo() ModelInfo |
| 35 | } |
| 36 | |
| 37 | // SupportsInput reports whether the model explicitly accepts the modality. |
| 38 | func (m ModelInfo) SupportsInput(modality ModelModality) bool { |
| 39 | return slices.Contains(m.InputModalities, modality) |
| 40 | } |
| 41 |