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
- Bail out with the given error.
Structs§
- AnyOf
Schema - A schema that matches any of the composite schemas
- ArcParser
- A boxed parser.
- Array
Schema - A schema for an array
- Boolean
Schema - A schema for a boolean
- Choice
Parser - A parser for a choice of two parsers.
- Choice
Parser State - State of a choice parser.
- Const
Schema - A schema for a constant
- Empty
Number - An error that can occur while parsing a float literal when trying to parse a number with no characters.
- Enum
Schema - A schema for an enum
- Float
Parser - A parser for a float.
- Float
Parser State - The state of an integer parser.
- I8Parser
- A parser for
i8. - I16Parser
- A parser for
i16. - I32Parser
- A parser for
i32. - I64Parser
- A parser for
i64. - IfThen
Schema - A schema for an conditional schema
- Index
Parser - A parser that parses a sequence of parsers and returns the index of the first parser that succeeds
- Index
Parser State - The state of the
IndexParserparser - Integer
Parser - A parser for an integer.
- Integer
Parser State - The state of an integer parser.
- Integer
Schema - A schema for an integer
- Invalid
Decimal Location - An error that can occur while parsing a float literal when the number contains a decimal point in the wrong place.
- Invalid
Sign Location - An error that can occur while parsing a float literal when the number contains a sign in the wrong place.
- Json
Object Schema - A schema for an object
- Json
Property Schema - A schema for a property of an object
- Lazy
Parser - A parser that is lazily initialized.
- Leading
Zero Error - An error that can occur while parsing a float literal when the number starts with a leading zero.
- Literal
Mismatch Error - The error type for a literal parser.
- Literal
Parser - A parser for a literal.
- Literal
Parser Offset - The state of a literal parser.
- MapOutput
Parser - A parser that maps the output of another parser.
- Number
Schema - A schema for a number (floating point or integer)
- OneLine
- One line of text with some non-whitespace characters
- OneLine
Error - An error that can occur when parsing a
OneLine - OneLine
State - The state of the
OneLineparser - OneOf
Schema - A schema that matches one of the composite schemas
- OutOf
Range Error - An error that can occur while parsing a float literal when the number is out of range.
- Parser
Error - An error that occurred while parsing.
- Regex
Parser - A parser that uses a regex pattern to parse input.
- Regex
Parser State - The state of a regex parser.
- Repeat
Parser - A parser for a repeat of two parsers.
- Repeat
Parser State - State of a repeat parser.
- Sentence
- A single word.
- Sentence
Parser - A parser for a word.
- Separated
Parser - A parser for a repeat of two parsers.
- Separated
Parser State - State of a repeat parser.
- Sequence
Parser - A parser for a sequence of two parsers.
- StopOn
- A parser that parses until a literal is found.
- Stop
OnOffset - The state of a stop on literal parser.
- Stop
OnParse Error - An error that can occur while parsing a string literal.
- String
Parse Error - An error that can occur while parsing a string literal.
- String
Parser - A parser for an ascii string.
- String
Parser State - The state of a literal parser.
- String
Schema - A schema for a string
- Then
Lazy - A parser that is initialized lazily based on the state of the previous parser.
- U8Parser
- A parser for
u8. - U16Parser
- A parser for
u16. - U32Parser
- A parser for
u32. - U64Parser
- A parser for
u64. - With
Initial State - A parser with lazy initial state
- Word
- A single word.
- Word
Parser - A parser for a word.
Enums§
- Either
- A value that can be one of two types.
- Owned
Parse Result - A parser for a choice between two parsers.
- Parse
Status - The state of a parser.
- Schema
Literal - A literal value in a schema
- Schema
Type - The type of a schema
- Separated
Item State - The state of the item in the separated parser.
- Sequence
Parser State - State of a sequence parser.
- Structure
Parser - A validator for a string
- Structure
Parser State - The state of a structure parser.
- Then
Lazy Parser State - State of a then lazy parser.
Traits§
- Create
Parser State - A trait for a parser with a default state.
- Parse
- Data that can be parsed incrementally.
- Parser
- An incremental parser for a structured input.
- Parser
Ext - An extension trait for parsers.
- Schema
- A description of the format of a type
- Send
Create Parser State - An auto trait for a Send parser with a default state.
Type Aliases§
- Parse
Result - A result type for parsers.