Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SortedMap ¶
type SortedMap struct {
// contains filtered or unexported fields
}
SortedMap is a map[string]any that serialises its keys in alphabetical order. This guarantees deterministic JSON output for tool schema definitions, which is required for stable prompt-cache fingerprints on providers that hash tool definitions (Anthropic, Bedrock).
Construct with NewSortedMap. The zero value is valid and marshals as {}.
func NewSortedMap ¶
NewSortedMap converts a map[string]any into a SortedMap whose keys are sorted alphabetically at every level of nesting. Nested map[string]any values and []any arrays are recursed so that all object nodes in the tree are also sorted. A nil or empty map produces a SortedMap that marshals as {}.
func (*SortedMap) MarshalJSON ¶
MarshalJSON implements json.Marshaler. Keys are emitted in the order they were inserted (alphabetical, because NewSortedMap sorts them on construction).