Quick Start
FreshGet up and running with Hindsight in under 5 minutes.
1. Install the SDK
bash
pip install hindsight-clientbash
npm install @vectorize-io/hindsight-client2. Initialize the Client
python
from hindsight_client import Hindsight
client = Hindsight(
base_url="https://api.hindsight.vectorize.io",
api_key="your-api-key"
)typescript
import { HindsightClient } from '@vectorize-io/hindsight-client';
const client = new HindsightClient({
baseUrl: 'https://api.hindsight.vectorize.io',
apiKey: 'your-api-key'
});3. Store a Memory (Retain)
python
client.retain(
bank_id="my-assistant",
content="The user prefers dark mode and concise responses."
)typescript
await client.retain(
'my-assistant',
'The user prefers dark mode and concise responses.'
);bash
curl -X POST https://api.hindsight.vectorize.io/v1/default/banks/my-assistant/memories \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{"items": [{"content": "The user prefers dark mode and concise responses."}]}'4. Search Memories (Recall)
python
result = client.recall(
bank_id="my-assistant",
query="What are the user's preferences?"
)
for memory in result.results:
print(memory.text)typescript
const result = await client.recall(
'my-assistant',
"What are the user's preferences?"
);
result.results.forEach(memory => {
console.log(memory.text);
});bash
curl -X POST https://api.hindsight.vectorize.io/v1/default/banks/my-assistant/memories/recall \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{"query": "What are the user'\''s preferences?"}'5. Reason Over Memories (Reflect)
python
response = client.reflect(
bank_id="my-assistant",
query="How should I format responses for this user?"
)
print(response.text)typescript
const response = await client.reflect(
'my-assistant',
'How should I format responses for this user?'
);
console.log(response.text);bash
curl -X POST https://api.hindsight.vectorize.io/v1/default/banks/my-assistant/reflect \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{"query": "How should I format responses for this user?"}'