ObjectSchema

org.llm4s.toolapi.ObjectSchema
case class ObjectSchema[T](description: String, properties: Seq[PropertyDefinition[_]], additionalProperties: Boolean) extends SchemaDefinition[T]

Object schema with a fixed set of typed properties.

In strict mode all properties are emitted as required regardless of the individual PropertyDefinition.required flag, matching the behaviour expected by OpenAI strict-mode tool definitions.

Value parameters

additionalProperties

Whether to allow extra keys beyond those listed

description

Human-readable description shown to the LLM

properties

Ordered sequence of property definitions

Attributes

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 treated as required, matching OpenAI strict-mode tool definitions.

Attributes

def withOptionalField[P](name: String, schema: SchemaDefinition[P]): ObjectSchema[T]

Add an optional field to the object schema

Add an optional field to the object schema

Value parameters

name

The name of the property

schema

The schema definition for the property

Attributes

Returns

A new ObjectSchema with the optional property added

def withProperty[P](property: PropertyDefinition[P]): ObjectSchema[T]

Return a copy of this schema with property appended to the properties list.

Return a copy of this schema with property appended to the properties list.

Value parameters

property

The property definition to add

Attributes

def withRequiredField[P](name: String, schema: SchemaDefinition[P]): ObjectSchema[T]

Add a required field to the object schema

Add a required field to the object schema

Value parameters

name

The name of the property

schema

The schema definition for the property

Attributes

Returns

A new ObjectSchema with the required property added

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product