pub struct StructuredOutputFactory { /* private fields */ }Expand description
Shared, immutable tokenizer and grammar compilation state.
Implementations§
Source§impl StructuredOutputFactory
impl StructuredOutputFactory
Sourcepub fn new(tokenizer: Arc<dyn Tokenizer + Send + Sync>) -> Result<Self>
pub fn new(tokenizer: Arc<dyn Tokenizer + Send + Sync>) -> Result<Self>
Build the tokenizer trie once for this engine.
Sourcepub fn new_with_model_vocab_size(
tokenizer: Arc<dyn Tokenizer + Send + Sync>,
model_vocab_size: Option<usize>,
) -> Result<Self>
pub fn new_with_model_vocab_size( tokenizer: Arc<dyn Tokenizer + Send + Sync>, model_vocab_size: Option<usize>, ) -> Result<Self>
Build against the executor’s logits width when it is larger than the tokenizer base vocabulary (for example added EOS/control tokens).
Sourcepub fn create_processor(
&self,
response_format: &ResponseFormat,
start: &StructuredOutputStart,
max_output_tokens: usize,
stop_token_ids: &HashSet<u32>,
stop_text_sequences: &[String],
) -> Result<Option<StructuredOutputProcessor>>
pub fn create_processor( &self, response_format: &ResponseFormat, start: &StructuredOutputStart, max_output_tokens: usize, stop_token_ids: &HashSet<u32>, stop_text_sequences: &[String], ) -> Result<Option<StructuredOutputProcessor>>
Compile one request’s grammar while reusing the tokenizer trie.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for StructuredOutputFactory
impl !RefUnwindSafe for StructuredOutputFactory
impl !UnwindSafe for StructuredOutputFactory
impl Send for StructuredOutputFactory
impl Sync for StructuredOutputFactory
impl Unpin for StructuredOutputFactory
impl UnsafeUnpin for StructuredOutputFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more