Documentation Index
Fetch the complete documentation index at: https://docs.ivory.finance/llms.txt
Use this file to discover all available pages before exploring further.
Overview
BothPOST /v1/rag/answer/agent and POST /v1/rag/orchestrate support two visualization tools:
| Tool | Purpose |
|---|---|
analyze_filing_risks | Extract risk keyword signals from any SEC filing using the Loughran-McDonald lexicon |
generate_chart | Produce an interactive Plotly JSON chart, emitted as a chart SSE event |
chart SSE event — no frontend preprocessing required beyond calling Plotly.newPlot().
analyze_filing_risks
Runs the Loughran-McDonald financial risk lexicon across all indexed text chunks for a specific filing. Returns keyword frequencies, per-thousand-word density, top trigger terms, a composite risk score, and the highest-risk category.Input
| Parameter | Type | Required | Description |
|---|---|---|---|
accession_number | string | Yes | Filing accession number from search_filings or research_sec_filing |
section | string | No | Isolate a specific section before counting: "risk factors", "legal proceedings", "liquidity". Omit to analyse the full filing. |
Output
Risk score formula
The composite score (0–10) is a weighted sum of keyword counts per category, normalised by total word count and scaled:Risk lexicon categories
Litigation
Litigation
lawsuit, litigation, proceeding, arbitration, damages, class action, settlement, subpoena, plaintiff, defendant, injunction, verdict, indemnification, judgment, appeal
Liquidity
Liquidity
liquidity, insolvency, cash flow, working capital, default, covenant, going concern, indebtedness, refinancing, credit rating, downgrade, maturity, solvency, liquidity risk, cash position
Regulatory
Regulatory
compliance, fine, penalty, sanction, investigation, enforcement, violation, remediation, examination, corrective action, regulatory action, non-compliance, audit finding, regulatory change, regulatory risk
Market
Market
volatility, inflation, recession, interest rate, currency, tariff, macroeconomic, downturn, competitive pressure, pricing pressure, foreign exchange, market risk, demand risk, commodity price, geopolitical
Operational
Operational
supply chain, disruption, outage, cybersecurity, breach, recall, shortage, single source, concentration risk, dependency, operational failure, system failure, key personnel, natural disaster, pandemic
Governance
Governance
restatement, material weakness, internal control, whistleblower, fraud, misconduct, departure, related party, going concern, material error, audit committee, corporate governance, conflict of interest, ethical violation, executive compensation
generate_chart
Generates an interactive Plotly chart and appends it to the SSE stream as achart event. The agent references the chart in its final answer as [Chart 1], [Chart 2], etc.
Chart SSE event
plotly.data and plotly.layout directly to Plotly.newPlot().
Chart types
dual_axis — Risk vs financial metric correlation
The primary chart for financial risk analysis. Bars show risk keyword counts on the right Y-axis; lines show financial metrics (revenue, earnings) on the left Y-axis — both on a shared time axis with unified hover tooltips. Best for: Showing that risk keyword spikes precede or coincide with revenue drops.| Field | Type | Description |
|---|---|---|
x | list[str] | Shared X-axis labels (years, quarters, or dates) |
bar_series | [{name, data, color?}] | Bar traces — plotted on the right axis |
line_series | [{name, data, color?}] | Line traces — plotted on the left axis |
y1_label | str | Left axis label |
y2_label | str | Right axis label |
ticker | str? | Appended to title as — $TICKER |
bar — Risk category breakdown
Horizontal grouped bar chart. Use to show relative risk exposure across the six Loughran-McDonald categories.| Field | Type | Description |
|---|---|---|
categories | list[str] | Category labels (Y-axis) |
counts | list[number] | Keyword counts per category |
x_label | str? | X-axis label |
subtitle | str? | Small annotation below the chart |
line — Time series trends
Multi-line time series chart. Use for tracking a single metric (or multiple metrics) over time.| Field | Type | Description |
|---|---|---|
series | [{name, x, y, color?, dash?}] | Line traces. dash: "solid" (default), "dash", "dot" |
x_label | str? | X-axis label |
y_label | str? | Y-axis label |
heatmap — Risk intensity matrix
2D heatmap of risk intensity (rows = risk categories, columns = years/quarters). Use for a quick cross-year risk overview.| Field | Type | Description |
|---|---|---|
x_labels | list[str] | Column labels (e.g. years) |
y_labels | list[str] | Row labels (e.g. risk categories) |
z_matrix | list[list[number]] | 2D value matrix — rows align with y_labels, columns with x_labels |
color_scale | str? | Plotly colorscale: "Reds" (default), "YlOrRd", "RdBu_r" |
Frontend rendering (React + Plotly.js)
npm install react-plotly.js plotly.js
Boilerplate score
When callinganalyze_filing_risks across multiple filings for the same company, the underlying extraction engine also computes a boilerplate score — the Jaccard similarity of character 3-gram sets between the current and previous filing’s risk text.
A score > 0.85 indicates the company copied its risk factor language word-for-word between filings — a common pattern when risks haven’t actually changed. A score < 0.50 indicates significantly new or revised risk language worth reading carefully.
This metric is surfaced in advanced risk comparisons and is used internally to weight YoY delta calculations.
Recommended workflow
dual_axis or heatmap chart.
