AnyOf
Represents an anyOf type parameter.
Properties
Functions
Link copied to clipboard
fun hackRepresentAnyOfWithNullAsTypeUnionWithNull(getTypeDefinition: (ToolParameterType) -> JsonObject): JsonObject?
Our API doesn't support proper nullability yet via type unions, such as "type": ["string", "null"]. Instead, we rely on anyOf with "null" type. However, not all LLM providers support anyOf in their tool schemas, Anthropic being one of them. This is a hack that tries to detect such anyOf's and generate a proper JsonObject with type union on "null" instead.