Asset Reports & Follow-ups
This page covers two methods for targeted research: finding discovery reports related to a specific asset, and sending follow-up questions to continue an existing research session.
Reports by Asset
byAsset(assetType, assetId, params?) returns a paginated list of discovery reports related to a specific asset. This is useful for building asset detail pages or showing related research alongside portfolio holdings.
Parameters:
| Param | Type | Description |
|---|---|---|
assetType | AssetType | The asset category (see values below) |
assetId | string | The asset identifier (e.g. "ethereum", "AAPL") |
params.page | number | Page number (optional) |
params.limit | number | Results per page (optional) |
AssetType values: 'crypto' | 'stock' | 'equity' | 'bond' | 'commodity' | 'forex' | 'derivative' | 'etf' | 'index'
Returns: DiscoveryListResponse — the same paginated structure as list(), with total and data.
import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// Get reports about Ethereum
const { data: ethReports, total } = await chaos.discovery.byAsset('crypto', 'ethereum', {
page: 1,
limit: 10,
});
console.log(`${total} reports about Ethereum\n`);
for (const report of ethReports) {
console.log(`${report.title}`);
console.log(` Tags: ${report.tags.join(', ')}`);
console.log(` Updated: ${report.updated_at}\n`);
}import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// Reports about different asset types
const btcReports = await chaos.discovery.byAsset('crypto', 'bitcoin');
const aaveReports = await chaos.discovery.byAsset('crypto', 'aave');
const stockReports = await chaos.discovery.byAsset('stock', 'AAPL');
const etfReports = await chaos.discovery.byAsset('etf', 'SPY');
console.log(`Bitcoin: ${btcReports.total} reports`);
console.log(`Aave: ${aaveReports.total} reports`);
console.log(`AAPL: ${stockReports.total} reports`);
console.log(`SPY: ${etfReports.total} reports`);Follow-up Questions
followUp(sessionId, params) sends a follow-up question on an existing discovery report. The AI uses the original report as context and returns a new conversational session with the response.
Parameters:
| Param | Type | Description |
|---|---|---|
sessionId | string | The report's id to follow up on |
params.query | string | The follow-up question to ask |
Returns: SessionData — a full session object containing the AI response, including sessionId, title, blocks (rendered content), and agentMessages.
import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// Step 1: Get a report
const { data: reports } = await chaos.discovery.list({ limit: 1 });
const reportId = reports[0].id;
// Step 2: Ask a follow-up question
const session = await chaos.discovery.followUp(reportId, {
query: 'What are the main risks mentioned in this report?',
});
console.log(`New session: ${session.sessionId}`);
console.log(`Title: ${session.title}`);
console.log(`Workflow: ${session.workflowName}`);
console.log(`Blocks: ${session.blocks.length}`);import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// Get a report's details to see its suggested follow-ups
const detail = await chaos.discovery.get('session-abc123');
console.log('Suggested follow-up questions:');
for (const q of detail.followup_questions) {
console.log(` ${q}`);
}
// Use a suggested follow-up
const session = await chaos.discovery.followUp(detail.id, {
query: detail.followup_questions[0],
});
console.log(`\nFollow-up response: ${session.title}`);