SchemaOf

org.llm4s.schema.SchemaOf
See theSchemaOf companion trait
@Experimental
object SchemaOf

Attributes

Companion
trait
Source
SchemaOf.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
SchemaOf.type

Members list

Value members

Concrete methods

def apply[A](using schemaOf: SchemaOf[A]): SchemaOf[A]

The instance of A in scope.

The instance of A in scope.

Attributes

Source
SchemaOf.scala
inline def derived[A](using m: Of[A]): SchemaOf[A]

Derives the schema of a case class, an enum or a sealed hierarchy: derives SchemaOf. An enum or sealed trait whose cases are all singletons is a string; one with a case that has fields is an anyOf (see SchemaOf).

Derives the schema of a case class, an enum or a sealed hierarchy: derives SchemaOf. An enum or sealed trait whose cases are all singletons is a string; one with a case that has fields is an anyOf (see SchemaOf).

Attributes

Source
SchemaOf.scala
def string[A](description: String): SchemaOf[A]

A type that is written as a JSON string, such as a date or an identifier whose ReadWriter you define yourself: its schema is a plain string.

A type that is written as a JSON string, such as a date or an identifier whose ReadWriter you define yourself: its schema is a plain string.

Value parameters

description

what the model sees for a field of this type that has no description of its own, and for the type itself when it is the schema on its own

Attributes

Source
SchemaOf.scala
def stringEnum[A](description: String, values: Seq[String]): SchemaOf[A]

A type that is written as one of a fixed set of strings.

A type that is written as one of a fixed set of strings.

Value parameters

description

as for string

values

the strings the model may answer with

Attributes

Source
SchemaOf.scala

Givens

Givens

Attributes

Source
SchemaOf.scala

Attributes

Source
SchemaOf.scala
given list[A](using item: SchemaOf[A]): SchemaOf[List[A]]

Attributes

Source
SchemaOf.scala
inline given namedTuple[N <: Tuple, V <: Tuple]: SchemaOf[NamedTuple[N, V]]

The schema of a named tuple, (sentiment: Sentiment, confidence: Double): an object with one property per element, in order, exactly as for a case class with those fields. Each property is described by its element type's description, else by its name, since a named tuple's elements cannot carry annotations; an Option element may be absent or null, as an Option field may. Element types are checked as a case class's fields are: one nothing describes is refused at compile time, naming it, and so is a recursion through the tuple.

The schema of a named tuple, (sentiment: Sentiment, confidence: Double): an object with one property per element, in order, exactly as for a case class with those fields. Each property is described by its element type's description, else by its name, since a named tuple's elements cannot carry annotations; an Option element may be absent or null, as an Option field may. Element types are checked as a case class's fields are: one nothing describes is refused at compile time, naming it, and so is a recursion through the tuple.

The reply is read back with the ReadWriter in namedtuples (import org.llm4s.schema.namedtuples.given), since uPickle has none for named tuples.

Attributes

Source
SchemaOf.scala
given option[A](using inner: SchemaOf[A], notNested: NotGiven[A <:< Option[_]]): SchemaOf[Option[A]]

Attributes

Source
SchemaOf.scala
given seq[A](using item: SchemaOf[A]): SchemaOf[Seq[A]]

Attributes

Source
SchemaOf.scala
given set[A](using item: SchemaOf[A]): SchemaOf[Set[A]]

Attributes

Source
SchemaOf.scala
given vector[A](using item: SchemaOf[A]): SchemaOf[Vector[A]]

Attributes

Source
SchemaOf.scala