use crate::error::Result;
use crate::framework::ChaoticSemanticFramework;
use crate::hyperdim::HVec10240;
use crate::retrieval::{GraphRagConfig, GraphRagResult, graph_rag_retrieve};
use tracing::instrument;
impl ChaoticSemanticFramework {
#[instrument(err, skip(self, query, config))]
pub async fn probe_with_graph(
&self,
query: HVec10240,
config: GraphRagConfig,
) -> Result<Vec<GraphRagResult>> {
self.validate_top_k(config.anchor_top_k)?;
self.validate_top_k(config.final_top_k)?;
let (concepts, associations) = {
let sing = self.singularity.read().await;
let ns = self.namespace.read().await;
(sing.all_concepts(&ns), sing.all_associations(&ns))
};
graph_rag_retrieve(&query, &concepts, &associations, &config)
}
#[instrument(err, skip(self, text, config))]
pub async fn probe_text_with_graph(
&self,
text: &str,
config: GraphRagConfig,
) -> Result<Vec<GraphRagResult>> {
let embedding = self.embedding_provider.embed(text).await?;
let query = self
.embedding_provider
.project(&embedding, &self.projection);
self.probe_with_graph(query, config).await
}
}