Crate kalosm_sample
source ·Expand description
§kalosm-sample
This is a sampling library for Kalosm.
It handles choosing a token from a probability distribution. Samplers can be used to constrain the generation of text for example you can use a sampler to prevent the model from generating the same word twice in a row. Or you could only allow the model to generate a list of single digit numbers.
Macros§
- Bail out with the given error.
Structs§
- A schema that matches any of the composite schemas
- A boxed parser.
- A schema for an array
- A schema for a boolean
- A parser for a choice of two parsers.
- State of a choice parser.
- A schema for a constant
- An error that can occur while parsing a float literal when trying to parse a number with no characters.
- A schema for an enum
- A parser for a float.
- The state of an integer parser.
- A parser for
i8
. - A parser for
i16
. - A parser for
i32
. - A parser for
i64
. - A schema for an conditional schema
- A parser for an integer.
- The state of an integer parser.
- A schema for an integer
- An error that can occur while parsing a float literal when the number contains a decimal point in the wrong place.
- An error that can occur while parsing a float literal when the number contains a sign in the wrong place.
- A schema for an object
- A schema for a property of an object
- A parser that is lazily initialized.
- An error that can occur while parsing a float literal when the number starts with a leading zero.
- The error type for a literal parser.
- A parser for a literal.
- The state of a literal parser.
- A parser that maps the output of another parser.
- A schema for a number (floating point or integer)
- A schema that matches one of the composite schemas
- An error that can occur while parsing a float literal when the number is out of range.
- An error that occurred while parsing.
- A parser that uses a regex pattern to parse input.
- The state of a regex parser.
- A parser for a repeat of two parsers.
- State of a repeat parser.
- A single word.
- A parser for a word.
- A parser for a repeat of two parsers.
- State of a repeat parser.
- A parser for a sequence of two parsers.
- A parser that parses until a literal is found.
- The state of a stop on literal parser.
- An error that can occur while parsing a string literal.
- An error that can occur while parsing a string literal.
- A parser for an ascii string.
- The state of a literal parser.
- A schema for a string
- A parser that is initialized lazily based on the state of the previous parser.
- A parser for
u8
. - A parser for
u16
. - A parser for
u32
. - A parser for
u64
. - A parser with lazy initial state
- A single word.
- A parser for a word.
Enums§
- A value that can be one of two types.
- A parser for a choice between two parsers.
- The state of a parser.
- A literal value in a schema
- The type of a schema
- The state of the item in the separated parser.
- State of a sequence parser.
- A validator for a string
- The state of a structure parser.
- State of a then lazy parser.
Traits§
- A trait for a parser with a default state.
- Data that can be parsed incrementally.
- An incremental parser for a structured input.
- An extension trait for parsers.
- A description of the format of a type
- An auto trait for a Send parser with a default state.
Type Aliases§
- A result type for parsers.
Derive Macros§
- Derive a default JSON parser for a unit value, struct or enum.