AnyOfSchema

org.llm4s.toolapi.AnyOfSchema
See theAnyOfSchema companion object
@Stable
final case class AnyOfSchema[T] extends SchemaDefinition[T]

A union: a value that matches at least one of alternatives (JSON Schema anyOf).

Emits {"description": ..., "anyOf": [...]}. There is always at least one alternative: an anyOf with none matches nothing.

Type parameters

T

The Scala type the union reads as (unused at runtime)

Value parameters

alternatives

The schemas a value may match, in order

description

Human-readable description shown to the LLM

Attributes

Companion
object
Source
SchemaDefinition.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait SchemaDefinition[T]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def toJsonSchema(strict: Boolean): Value

Serialise this schema to a JSON Schema ujson.Value.

Serialise this schema to a JSON Schema ujson.Value.

Value parameters

strict

When true, all object properties are listed as required and the optional ones accept null, matching OpenAI strict-mode tool definitions.

Attributes

Source
SchemaDefinition.scala
def withAlternative(alternative: SchemaDefinition[_]): AnyOfSchema[T]

Append one more alternative.

Append one more alternative.

Attributes

Source
SchemaDefinition.scala

Replace the alternatives; at least one.

Replace the alternatives; at least one.

Attributes

Source
SchemaDefinition.scala
def withDescription(description: String): AnyOfSchema[T]

Replace the description shown to the LLM.

Replace the description shown to the LLM.

Attributes

Source
SchemaDefinition.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product