pub struct MetadataQAText { /* private fields */ }Expand description
This module defines the MetadataQAText struct and its associated methods,
which are used for generating metadata in the form of questions and answers
from a given text. It interacts with a client (e.g., OpenAI) to generate
these questions and answers based on the text chunk in an Node.
MetadataQAText is responsible for generating questions and answers
from a given text chunk. It uses a templated prompt to interact with a client
that implements the SimplePrompt trait.
Implementations§
source§impl MetadataQAText
impl MetadataQAText
sourcepub fn builder() -> MetadataQATextBuilder
pub fn builder() -> MetadataQATextBuilder
Creates a new builder for the transformer
sourcepub fn from_client(client: impl SimplePrompt + 'static) -> MetadataQATextBuilder
pub fn from_client(client: impl SimplePrompt + 'static) -> MetadataQATextBuilder
Build a new transformer from a client
sourcepub fn new(client: impl SimplePrompt + 'static) -> Self
pub fn new(client: impl SimplePrompt + 'static) -> Self
Create a new transformer from a client
sourcepub fn with_concurrency(self, concurrency: usize) -> Self
pub fn with_concurrency(self, concurrency: usize) -> Self
Set the concurrency level for the transformer
Trait Implementations§
source§impl Clone for MetadataQAText
impl Clone for MetadataQAText
source§fn clone(&self) -> MetadataQAText
fn clone(&self) -> MetadataQAText
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for MetadataQAText
impl Debug for MetadataQAText
source§impl Default for MetadataQAText
impl Default for MetadataQAText
source§impl Transformer for MetadataQAText
impl Transformer for MetadataQAText
source§fn transform_node<'life0, 'async_trait>(
&'life0 self,
node: Node,
) -> Pin<Box<dyn Future<Output = Result<Node>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transform_node<'life0, 'async_trait>(
&'life0 self,
node: Node,
) -> Pin<Box<dyn Future<Output = Result<Node>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Transforms an Node by generating questions and answers
based on the text chunk within the node.
§Arguments
node- TheNodecontaining the text chunk to process.
§Returns
A Result containing the transformed Node with added metadata,
or an error if the transformation fails.
§Errors
This function will return an error if the client fails to generate questions and answers from the provided prompt.
source§fn concurrency(&self) -> Option<usize>
fn concurrency(&self) -> Option<usize>
fn name(&self) -> &'static str
source§impl WithIndexingDefaults for MetadataQAText
impl WithIndexingDefaults for MetadataQAText
fn with_indexing_defaults(&mut self, defaults: IndexingDefaults)
Auto Trait Implementations§
impl Freeze for MetadataQAText
impl !RefUnwindSafe for MetadataQAText
impl Send for MetadataQAText
impl Sync for MetadataQAText
impl Unpin for MetadataQAText
impl !UnwindSafe for MetadataQAText
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more