Skip to main content

Reflect

Generate personality-aware responses using retrieved memories.

Prerequisites

Make sure you've completed the Quick Start to install the client and start the server.

Basic Usage

from hindsight_client import Hindsight

client = Hindsight(base_url="http://localhost:8888")

client.reflect(bank_id="my-bank", query="What should I know about Alice?")

Parameters

ParameterTypeDefaultDescription
querystringrequiredQuestion or prompt
budgetstring"low"Budget level: "low", "mid", "high"
contextstringNoneAdditional context for the query
response = client.reflect(
bank_id="my-bank",
query="What do you think about remote work?",
budget="mid",
context="We're considering a hybrid work policy"
)
How Reflect Works

Learn about personality-driven reasoning and opinion formation in the Reflect Architecture guide.

Opinion Formation

Reflect can form new opinions based on evidence:

response = client.reflect(
bank_id="my-bank",
query="What do you think about Python vs JavaScript for data science?"
)

# Response might include:
# answer: "Based on what I know about data science workflows..."
# new_opinions: [
# {"text": "Python is better for data science", "id": "..."}
# ]

New opinions are automatically stored and influence future responses.

Personality Influence

The bank's personality affects reflect responses:

TraitEffect on Reflect
High OpennessMore willing to consider new ideas
High ConscientiousnessMore structured, methodical responses
High ExtraversionMore collaborative suggestions
High AgreeablenessMore diplomatic, harmony-seeking
High NeuroticismMore risk-aware, cautious
# Create a bank with specific personality
client.create_bank(
bank_id="cautious-advisor",
background="I am a risk-aware financial advisor",
personality={
"openness": 0.3,
"conscientiousness": 0.9,
"neuroticism": 0.8,
"bias_strength": 0.7
}
)

# Reflect responses will reflect this personality
response = client.reflect(
bank_id="cautious-advisor",
query="Should I invest in crypto?"
)
# Response will likely emphasize risks and caution

Using Sources

The facts_used field shows which memories informed the response:

response = client.reflect(bank_id="my-bank", query="Tell me about Alice")

print("Response:", response["answer"])
print("\nBased on:")
for fact in response.get("facts_used", []):
print(f" - {fact['text']} (relevance: {fact['weight']:.2f})")

This enables:

  • Transparency — users see why the bank said something
  • Verification — check if the response is grounded in facts
  • Debugging — understand retrieval quality