Documentation
¶
Overview ¶
Package internal contains code that is common to all models
Index ¶
- Variables
- func ApplySchemaOverrides(schema map[string]any, o SchemaOverrides)
- func LookupOverride[T any](overrides map[string]T, provider, id string) (T, bool)
- func ProviderLabel(provider, name string) string
- func SchemaAt(schema map[string]any, path string) any
- func TrimProvider(provider, id string) string
- type SchemaOverrides
Constants ¶
This section is empty.
Variables ¶
var ( // BasicText describes model capabilities for text-only models. BasicText = ai.ModelSupports{ Multiturn: true, Tools: true, ToolChoice: true, SystemRole: true, Media: false, } // Multimodal describes model capabilities for multimodal models. Multimodal = ai.ModelSupports{ Multiturn: true, Tools: true, ToolChoice: true, SystemRole: true, Media: true, Constrained: ai.ConstrainedSupportNoTools, } // MultimodalNoConstrained describes model capabilities for multimodal models without native constrained generation. MultimodalNoConstrained = ai.ModelSupports{ Multiturn: true, Tools: true, ToolChoice: true, SystemRole: true, Media: true, Constrained: ai.ConstrainedSupportNone, } )
Functions ¶
func ApplySchemaOverrides ¶ added in v1.12.0
func ApplySchemaOverrides(schema map[string]any, o SchemaOverrides)
ApplySchemaOverrides applies o to schema in place.
A hidden property is replaced by the permissive `true` schema rather than deleted. Both keep it out of the dev UI, which renders only properties whose type it recognizes, but the config schema is also enforced on every request: a hidden field must still reach the plugin's own check, which names the Genkit option to use instead. Deleting it would fail validation as an unknown property, and forcing additionalProperties open to let it back through would give up rejecting real typos anywhere in that object.
A path that does not resolve is a no-op, so an entry left stale by a renamed SDK field is not fatal. Plugins assert SchemaOverrides.UnresolvedPaths is empty in a test to catch those.
func LookupOverride ¶ added in v1.12.0
LookupOverride returns the caller's entry for id in a plugin's override map, accepting the key bare or provider-prefixed since both name the same model everywhere else. id may itself carry the prefix.
func ProviderLabel ¶ added in v1.12.0
ProviderLabel joins a provider's display name and a model's into the label the dev UI lists a model under, e.g. "Anthropic - Claude Opus 5".
func SchemaAt ¶ added in v1.12.0
SchemaAt returns what path addresses in schema: a subschema, the `true` of a hidden property, or nil when a step does not resolve. Paths use the notation in SchemaOverrides.
func TrimProvider ¶ added in v1.12.0
TrimProvider returns id without its leading "provider/" prefix, inverting api.NewName and leaving an id that does not carry the prefix unchanged. Prefer it to api.ParseName when the provider is already known: only the prefix is removed, so an ID with slashes of its own (a tuned Vertex endpoint, say) survives intact.
Types ¶
type SchemaOverrides ¶ added in v1.12.0
type SchemaOverrides struct {
// Descriptions maps a path to the field's dev UI help text.
Descriptions map[string]string
// Hidden lists paths to keep out of the dev UI.
Hidden []string
}
SchemaOverrides is the presentation a plugin layers onto a reflected config schema: help text for the fields a caller may set, and hiding for the ones a Genkit option owns.
Paths are property names, dotted for nesting, with "[]" to enter an array's items: "temperature", "thinking.budget_tokens", "tools[].name".
func (SchemaOverrides) UnresolvedPaths ¶ added in v1.12.0
func (o SchemaOverrides) UnresolvedPaths(schema map[string]any) []string
UnresolvedPaths returns the paths in o that schema has no property for, sorted. Applying one is a silent no-op, so it is dead weight that stopped describing anything when the SDK it was written against changed.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package jsonschema contains JSON Schema helpers shared by Genkit provider plugins.
|
Package jsonschema contains JSON Schema helpers shared by Genkit provider plugins. |
|
Package uri extracts the content-type and data from a media part.
|
Package uri extracts the content-type and data from a media part. |