StringSchema

org.llm4s.toolapi.StringSchema
case class StringSchema(description: String, enumValues: Option[Seq[String]], minLength: Option[Int], maxLength: Option[Int]) extends SchemaDefinition[String]

String schema with validation options.

Value parameters

description

Human-readable description shown to the LLM

enumValues

Restricts valid values to this closed set

maxLength

Maximum allowed string length

minLength

Minimum allowed string length

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait SchemaDefinition[String]
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 withEnum(values: Seq[String]): StringSchema

Restrict valid values to the given closed enumeration.

Restrict valid values to the given closed enumeration.

Value parameters

values

Allowed string values

Attributes

def withLengthConstraints(min: Option[Int], max: Option[Int]): StringSchema

Add minimum and/or maximum length constraints.

Add minimum and/or maximum length constraints.

Value parameters

max

Optional maximum length (inclusive)

min

Optional minimum length (inclusive)

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product