Skip to content

sgns::neoswarm::knowledge::KnowledgeRetrieval

Retrieves top-k structured facts from a Grokipedia index. More...

#include <knowledge_retrieval.hpp>

Public Classes

Name
struct Config
struct Impl

Public Functions

Name
KnowledgeRetrieval()
KnowledgeRetrieval(Config cfg)
~KnowledgeRetrieval()
outcome::result< void > Load()
Load the knowledge index from disk.
bool IsLoaded() const
outcome::result< std::vector< KnowledgeFact > > Retrieve(const std::string & query) const
Retrieve top-k facts relevant to the query.

Detailed Description

class sgns::neoswarm::knowledge::KnowledgeRetrieval;

Retrieves top-k structured facts from a Grokipedia index.

Uses a simple TF-IDF bag-of-words embedding with cosine similarity. Degrades gracefully when the index is unavailable.

Public Functions Documentation

function KnowledgeRetrieval

KnowledgeRetrieval()

function KnowledgeRetrieval

explicit KnowledgeRetrieval(
    Config cfg
)

function ~KnowledgeRetrieval

~KnowledgeRetrieval()

function Load

outcome::result< void > Load()

Load the knowledge index from disk.

Return: outcome::success or KnowledgeUnavailable.

function IsLoaded

inline bool IsLoaded() const

Return: True if the index has been loaded.

function Retrieve

outcome::result< std::vector< KnowledgeFact > > Retrieve(
    const std::string & query
) const

Retrieve top-k facts relevant to the query.

Parameters:

  • query User prompt or search string.

Return: Vector of KnowledgeFact or KnowledgeUnavailable.


Updated on 2026-07-25 at 22:56:56 +0000