duohub offers three primary retrieval modes when querying your knowledge graph or vector store: Raw, Assisted, and Facts. These can be used to suit your use case.
Raw mode returns unprocessed matches from your memory store without AI assistance.
Copy
from duohub import Duohubclient = Duohub()response = client.retrieve(memory_id="your-memory-id",query="What is the capital of France?",assisted=False)
Output Example (Vector Store):
Copy
{ "payload": [ { "content": "Paris is the capital and largest city of France, serving as the country's major economic, cultural, and political center. With a population of over 2 million in the city proper...", "metadata": { "source": "https://example.com/geography/france", "sourceTitle": "France Geography Guide" } }, { "content": "As the capital of France since 987 CE, Paris has been home to numerous French monarchs. The city's rich history includes the construction of iconic landmarks like the Eiffel Tower and the Louvre...", "metadata": { "source": "https://example.com/history/paris", "sourceTitle": "Paris Historical Overview" } }, { "content": "The Paris metropolitan area is one of the largest in Europe, with over 12 million inhabitants. The city is a global hub for fashion, gastronomy, art, and tourism, attracting millions of visitors annually...", "metadata": { "source": "https://example.com/cities/paris-stats", "sourceTitle": "Paris Demographics & Tourism" } } ], "token_count": 156}
If you are using graph memory, the output will be a human readable string representing a subgraph collection of nodes and edges along with their descriptions.When to use:
When you need direct access to the raw memory chunks
For implementing custom post-processing logic
When transparency in the retrieval process is crucial
Assisted mode uses AI to process the retrieved information and provide a coherent response. This is our suggested mode for most use cases as it will keep your context window clean.
Copy
from duohub import Duohubclient = Duohub()response = client.retrieve(memory_id="your-memory-id",query="What is the capital of France?",assisted=True)
Output Example:
Copy
{ "payload": "The capital of France is Paris. It is both the capital city and largest metropolitan area in the country.", "token_count": 42}
When to use:
When you need a natural language response
For chatbots and user-facing applications
When you want to synthesize information from multiple sources
Facts mode provides three supporting facts along with the response. It can be combined with either Raw or Assisted mode.
Copy
# Combined with Assisted moderesponse = client.retrieve( memory_id="your-memory-id", query="What is the capital of France?", assisted=True, facts=True)
Output Example:
Copy
{ "payload": "The capital of France is Paris.", "facts": [ { "content": "Paris is the capital of France" }, { "content": "Paris has been France's capital since 987 CE" }, { "content": "Paris is located in northern France" } ], "token_count": 42}
When to use:
When you need to provide evidence for the response
For applications requiring transparency in decision-making
When building educational tools or fact-checking systems