Documentation
¶
Index ¶
- func CollectRequiredFields(properties map[string]*gollem.Parameter) []string
- func ConvertParameterToJSONSchema(param *gollem.Parameter) map[string]any
- func ConvertParameterToJSONString(param *gollem.Parameter) (string, error)
- func FindAdditionalProperties(param *gollem.Parameter) (path string, found bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectRequiredFields ¶
CollectRequiredFields returns a list of required property names in ascending name order. The order must not depend on Go map iteration: the result is emitted verbatim as the JSON Schema "required" array, and Anthropic matches the prompt cache on an exact byte prefix that starts with the tool definitions, so a reordered array invalidates every cache breakpoint.
func ConvertParameterToJSONSchema ¶
ConvertParameterToJSONSchema converts gollem.Parameter to JSON Schema map This is the base conversion without provider-specific modifications
func ConvertParameterToJSONString ¶
ConvertParameterToJSONString converts Parameter to a JSON Schema string This is used by Claude for embedding schema in system prompt
func FindAdditionalProperties ¶ added in v0.30.0
FindAdditionalProperties returns the path of the first object that has AdditionalProperties (a map), visiting properties in ascending name order so that the result does not depend on map iteration. The path joins property names with "." and marks array items with "[]", e.g. "items[].attrs"; the root itself is reported as "(root)".
Providers use it to decide how to send a schema: Claude structured outputs and OpenAI strict mode reject a schema that contains a map, and Gemini sends such a schema as JSON Schema because genai.Schema cannot express a map.
Types ¶
This section is empty.