Chat History Search lets Zark look back through your previous conversations to find things you’ve discussed, asked about, or been told before.
Quick Start
import requests
response = requests.post(
"https://api.zarkai.xyz/v1/chat",
headers={
"x-api-key": "your_api_key",
"Content-Type": "application/json",
},
json={
"messages": [
{"role": "user", "content": "What did we talk about yesterday?"}
],
"workspace_id": "wks-xxxxx",
"tools": ["chat_search"],
"tool_choice": "auto",
},
)
data = response.json()
print(data["response"])
When Zark Uses Chat History Search
Zark automatically triggers this tool when your message references past conversations. Key signals:
- “Remember when we talked about…”
- “What did I ask you last time?”
- “Find that conversation about budgets”
- “Go back to that analysis you did”
- “Earlier you said…”
- “That thing we discussed”
- “What did we do yesterday?”
How It Works
Chat History Search uses semantic matching — it finds relevant past discussions even when you don’t use the exact same words. If you previously asked about “Q3 revenue trends” and now say “remember that revenue analysis?”, it connects the two.
Zark uses retrieved context to inform its current response. If you previously ran an analysis and now ask “do that again but for Q4,” Zark retrieves the original approach and adapts it.
Streaming
import requests
import json
response = requests.post(
"https://api.zarkai.xyz/v1/chat",
headers={"x-api-key": "your_api_key", "Content-Type": "application/json"},
json={
"messages": [{"role": "user", "content": "Find our conversation about the marketing budget"}],
"workspace_id": "wks-xxxxx",
"tools": ["chat_search"],
"stream": True,
},
stream=True,
)
for line in response.iter_lines():
if line:
event = json.loads(line.decode("utf-8").removeprefix("data: "))
if event["type"] == "ai_chunk":
print(event["content"], end="", flush=True)
elif event["type"] == "ai_complete":
print("\n\nDone.")
Streaming Events
| Event | Description |
|---|
ai_chunk | Incremental text with retrieved context and response |
ai_complete | Final response |
Examples
What did we talk about yesterday?
Remember that analysis you did on the sales data?
Find our conversation about the marketing budget
What did I ask you about competitor pricing?
Go back to that report we worked on last week
Chat History Search only retrieves past conversation context. It does not re-execute previous queries or reproduce previous results. If you need to re-run an analysis, Zark uses the retrieved context to understand what you want and runs it fresh with current data.