pub struct ExplainedAnswer {
pub answer: String,
pub confidence: f32,
pub sources: Vec<SourceReference>,
pub reasoning_steps: Vec<ReasoningStep>,
pub key_entities: Vec<String>,
pub query_analysis: Option<QueryAnalysis>,
}Expand description
An answer with detailed explanation of the reasoning process
This struct provides transparency into how the GraphRAG system arrived at its answer, including confidence scores, source references, and step-by-step reasoning.
§Example
use graphrag_core::prelude::*;
let mut graphrag = GraphRAG::quick_start("Your document").await?;
let explained = graphrag.ask_explained("What is the main topic?").await?;
println!("Answer: {}", explained.answer);
println!("Confidence: {:.0}%", explained.confidence * 100.0);
for step in &explained.reasoning_steps {
println!("Step {}: {} (confidence: {:.0}%)",
step.step_number, step.description, step.confidence * 100.0);
}Fields§
§answer: StringThe answer text
confidence: f32Confidence score (0.0 to 1.0)
sources: Vec<SourceReference>Sources used to generate the answer
reasoning_steps: Vec<ReasoningStep>Step-by-step reasoning trace
key_entities: Vec<String>Entities that were key to the answer
query_analysis: Option<QueryAnalysis>Query analysis that guided retrieval
Implementations§
Source§impl ExplainedAnswer
impl ExplainedAnswer
Sourcepub fn from_results(
answer: String,
search_results: &[SearchResult],
query: &str,
) -> Self
pub fn from_results( answer: String, search_results: &[SearchResult], query: &str, ) -> Self
Create a new explained answer from search results
Sourcepub fn format_display(&self) -> String
pub fn format_display(&self) -> String
Format the explained answer for display
Trait Implementations§
Source§impl Clone for ExplainedAnswer
impl Clone for ExplainedAnswer
Source§fn clone(&self) -> ExplainedAnswer
fn clone(&self) -> ExplainedAnswer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExplainedAnswer
impl RefUnwindSafe for ExplainedAnswer
impl Send for ExplainedAnswer
impl Sync for ExplainedAnswer
impl Unpin for ExplainedAnswer
impl UnsafeUnpin for ExplainedAnswer
impl UnwindSafe for ExplainedAnswer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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