Asset Reports & Follow-ups

Updated

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.

[@portabletext/react] Unknown block type "callout", specify a component for it in the `components.types` prop

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:

ParamTypeDescription
assetTypeAssetTypeThe asset category (see values below)
assetIdstringThe asset identifier (e.g. "ethereum", "AAPL")
params.pagenumberPage number (optional)
params.limitnumberResults 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.

by-asset-crypto.ts
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`);
}
by-asset-types.ts
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:

ParamTypeDescription
sessionIdstringThe report's id to follow up on
params.querystringThe follow-up question to ask

Returns: SessionData — a full session object containing the AI response, including sessionId, title, blocks (rendered content), and agentMessages.

follow-up.ts
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}`);
[@portabletext/react] Unknown block type "callout", specify a component for it in the `components.types` prop
follow-up-chain.ts
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}`);
Was this helpful?