Financial report parser
This flow demonstrates how to parse LLM responses into a structured format.
In this example, the Chat Input component is pre-loaded with a sample financial report to demonstrate extracting Gross Profit
, EBITDA
, and Net Income
.
The Structured output component is used to extract the financial data from the report, and the Parser component is used to convert the extracted data into a structured format.
Prerequisites
Create the financial report parser flow
- From the Langflow dashboard, click New Flow.
- Select Financial Report Parser.
The Financial Report Parser flow is created.
Run the financial report parser flow
-
Add your OpenAI API key to the Language model model component. Optionally, create a global variable for the OpenAI API key.
- In the OpenAI API Key field, click Globe, and then click Add New Variable.
- In the Variable Name field, enter
openai_api_key
. - In the Value field, paste your OpenAI API Key (
sk-...
). - Click Save Variable.
-
To run the flow, click Playground, and then click Send. The Chat Input component is pre-loaded with a sample financial report for demonstration purposes. The Playground returns a structured response:
_10EBITDA: $900 million , Net Income: $500 million , GROSS_PROFIT: $1.2 billion
Inspect the flow to understand how this information was extracted.
- To inspect the output schema table, in the Structured Output component, click Open table. The Structured Output component uses the attached OpenAI model component as its "brain" to extract financial data into a DataFrame with this defined schema.
_10| Name | Description | Type | Multiple |_10|--------------|-----------------------|------|----------|_10| EBITDA | description of field | text | False |_10| NET_INCOME | description of field | text | False |_10| GROSS_PROFIT | description of field | text | False |
- To inspect the template that contains the extracted data, in the Parser component, click Scan in the Template field. The Parser component converts the extracted data into formatted messages for chat consumption. Each variable receives its value from the structured outputs.
_10EBITDA: {EBITDA} , Net Income: {NET_INCOME} , GROSS_PROFIT: {GROSS_PROFIT}