StringSchema

org.llm4s.toolapi.StringSchema
See theStringSchema companion object
@Stable
final case class StringSchema 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

Companion
object
Source
SchemaDefinition.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
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

Source
SchemaDefinition.scala
def withDescription(description: String): StringSchema

Replace the description shown to the LLM.

Replace the description shown to the LLM.

Attributes

Source
SchemaDefinition.scala
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

Source
SchemaDefinition.scala

Set or clear the closed enumeration; None lifts the restriction. Duplicates are dropped.

Set or clear the closed enumeration; None lifts the restriction. Duplicates are dropped.

Attributes

Source
SchemaDefinition.scala

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

Source
SchemaDefinition.scala

Set the maximum allowed string length (inclusive).

Set the maximum allowed string length (inclusive).

Attributes

Source
SchemaDefinition.scala

Set or clear the maximum allowed string length (inclusive).

Set or clear the maximum allowed string length (inclusive).

Attributes

Source
SchemaDefinition.scala

Set the minimum allowed string length (inclusive).

Set the minimum allowed string length (inclusive).

Attributes

Source
SchemaDefinition.scala

Set or clear the minimum allowed string length (inclusive).

Set or clear the minimum allowed string length (inclusive).

Attributes

Source
SchemaDefinition.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product