pub struct ExtractorBuilder<T>{ /* private fields */ }Expand description
Builder for the Extractor
Implementations§
Source§impl<T> ExtractorBuilder<T>
impl<T> ExtractorBuilder<T>
Sourcepub fn new(model: impl Into<DynModel<Completion>>) -> Self
pub fn new(model: impl Into<DynModel<Completion>>) -> Self
An extractor of T over model.
Sourcepub fn from_agent_builder(builder: AgentBuilder) -> Self
pub fn from_agent_builder(builder: AgentBuilder) -> Self
Configure an agent builder for extraction of T, replacing its preamble,
output schema, tool choice, and output mode. The tool choice is always
ToolChoice::Required, since an extraction is one turn that must call
the submit tool.
Sourcepub fn append_preamble(self, preamble: &str) -> Self
pub fn append_preamble(self, preamble: &str) -> Self
Append instructions to the extractor’s preamble. The extraction
preamble itself is fixed (it tells the model to call the output
tool); this adds to it, as AgentBuilder::append_preamble does,
and never replaces it.
Sourcepub fn additional_params(self, params: Value) -> Self
pub fn additional_params(self, params: Value) -> Self
Set provider-specific parameters for every extraction attempt.
Sourcepub fn max_tokens(self, max_tokens: u64) -> Self
pub fn max_tokens(self, max_tokens: u64) -> Self
Set the maximum number of tokens for the completion
Sourcepub fn add_hook<H>(self, hook: H) -> Selfwhere
H: AgentHook + 'static,
pub fn add_hook<H>(self, hook: H) -> Selfwhere
H: AgentHook + 'static,
Add a provider-independent lifecycle hook to every extraction attempt.
Completion-response hooks receive canonical Rig content, usage, prompt, and identity fields, just like hooks attached directly to an agent.
Sourcepub fn dynamic_context<I, F>(self, samples: usize, index: I) -> Selfwhere
I: VectorStoreIndex<Filter = F> + 'static,
F: DynamicSearchFilter + WasmCompatSend + WasmCompatSync + 'static,
pub fn dynamic_context<I, F>(self, samples: usize, index: I) -> Selfwhere
I: VectorStoreIndex<Filter = F> + 'static,
F: DynamicSearchFilter + WasmCompatSend + WasmCompatSync + 'static,
Retrieve samples documents from index for every extraction.
This delegates to AgentBuilder::dynamic_context and therefore uses
the same completion-call hook lifecycle as an agent.