Financial operations of a FIDC

Conversational intelligence for financial analysis

Applying artificial intelligence to financial queries, indicators and projections in natural language.

Context
Financial operations of a FIDC
Period
2024
My role
Concept, solution design, development and technical experimentation
Technologies
Python, SQL, OpenAI API, language models and WhatsApp integration
Status
Working proof of concept, not deployed to production
01

The challenge

“How can users query financial indicators and get analyses without depending on manually prepared reports or on using Business Intelligence tools directly?”

In the financial operations of a FIDC (a Brazilian receivables investment fund), the volume of transactional data can be high, and information relevant to decision-making depends on applying specific business rules and calculations.

The idea was to try out a conversational interface that could turn questions asked over WhatsApp into financial queries, indicators, reports and projections.

The challenge was not only connecting an AI model to the database, but defining how the data would be retrieved, processed and presented in a consistent way.

02

My contribution

I conceived and developed a prototype in Python, integrating a language model through the OpenAI API, a database and a conversational interface on WhatsApp.

I was responsible for structuring how the application worked, exploring different strategies for retrieving and processing the data and defining which indicators and analyses would be available.

The development involved decisions about the technology used, the agent's logic, the calculation methods and how results would be presented.

The project was run as a proof of concept, so that alternatives could be tested before considering a possible operational deployment.

03

The solution

The prototype let users ask questions in natural language and get financial information through a conversation. The features developed included:

  • Queries of financial indicators (KPIs).
  • Retrieval of information from a database.
  • Generation of analytical reports.
  • Queries about the fund's operated volume (VOP).
  • Financial projections based on the available information.

The application used Python to connect the components of the solution and run the query and processing steps.

The AI took part in interpreting requests and presenting results, with different calculation strategies evaluated during experimentation.

04

Technical and product decisions

Building the prototype involved decisions that went beyond implementing a conversational agent.

Choosing the API and the language model

One technical decision involved evaluating the available models and APIs, including solutions from OpenAI and Gemini. The development described here used the OpenAI API directly.

The choice of technology had to consider the ability to interpret financial requests, integration with the Python application, processing limits and the feasibility of running the proposed features.

Defining the indicators offered

Another decision was establishing which information made sense in a conversational interface.

Rather than exposing everything in the database, it was necessary to define relevant indicators, calculation rules and answers users could understand. The features tested included KPI queries and VOP projections.

Dynamic queries versus predefined queries

Two approaches to retrieving information were tested:

Model-generated queries
The model interpreted the request and took part in generating the SQL query needed to retrieve the data.
Predefined queries
The application used previously structured queries, giving more control over the data retrieved and the rules implemented.

The comparison made it possible to explore the trade-off between flexibility in interpreting questions and control over access to and processing of the information.

Calculations by the model versus Python

Two analytical processing strategies were also tested:

Calculations by GPT
The model received the information and produced calculations, analyses and projections.
Calculations in Python
The application ran the calculations programmatically and passed structured results to the model, which was responsible for interpreting and presenting them in natural language.

These alternatives made it possible to investigate how to divide responsibilities between the language model and conventional analytical processing.

05

Interactive demo

Try the flow of a financial query. Select a question, choose the query strategy and the calculation strategy, and follow how the agent processes the question, up to the result and the natural-language answer.

Question
Query strategy
Calculation strategy

Agent response

Sample response

Simulation with synthetic financial data

1What came in

What was December's VOP?

Message received on WhatsApp

2How it was processed

Query
Predefined SQLQuery vop_by_period, 2024‑11 to 2024‑12. Returned: 2 rows.
Calculation
Calculations run in Python and presented by GPTPython calculates the monthly change; GPT only writes the answer.
6 steps completed

3What came out

R$ 65.7MVOP for Dec 24
Change vs Nov 24+6.6%

Answer sent

December 2024 VOP was R$ 65.7M, +6.6% compared with November.

Interpretation

December came in above the six-month average (R$ 64.1M).

Calculated in code: with the same data, the same request always produces the same number.

Technical flow

  1. WhatsAppMessage received

    What was December's VOP?

  2. ModelThe model interprets the request
    { "intent": "query_vop", "period": "2024-12" }
  3. ApplicationThe application runs a predefined SQL query
    -- predefined query: vop_by_period
    SELECT month, vop
    FROM monthly_vop
    WHERE month BETWEEN :start AND :end
    ORDER BY month;
    -- parameters: start = 2024-11, end = 2024-12
  4. DatabaseThe database returns 2 rows
    2024-11  61.6
    2024-12  65.7
  5. PythonPython runs the calculations
    change = vop["2024-12"] / vop["2024-11"] - 1
  6. ModelGPT presents the answer in natural language

    The final text appears in the Agent response panel.

What matters in this combination

Predefined SQL: more control over the data retrieved and the rules implemented, covering the anticipated questions.

Calculations in Python: the application calculates programmatically and the model handles interpretation and presentation in natural language.

In this demo, every route reaches the same number; in a real system, it is the reliability of each route that has to be assessed.

This demo uses synthetic financial data and illustrative flows. It does not represent access to the original database or real calls to the OpenAI API.
06

Demonstrated results

The project resulted in a working proof of concept of conversational intelligence applied to financial analysis.

The solution made it possible to try indicator queries, report generation and VOP projections from natural-language requests.

The development also made it possible to compare different query and processing strategies, assessing how language models could be combined with programmatic calculations.

The solution was not deployed to production, so there are no adoption, productivity or operational financial impact metrics to report.

07

Limitations and lessons

The development revealed challenges in using language models to work with large volumes of financial data.

High volume of transactional data
The number of records required careful attention to how information was retrieved, aggregated and processed.
Token limits
The context and processing limits of the API used in 2024 restricted how much information could be sent to the model in a single interaction.
Structuring retrieval and processing
It was necessary to define how data would be retrieved and processed before reaching the model, and which steps would stay with the Python application and which with the language model.
Dynamic versus predefined SQL
Comparing dynamic SQL with predefined queries showed the need to balance flexibility and control.
Calculations by GPT versus Python
Testing processing by GPT against processing in Python helped assess how to distribute analytical tasks across the components of the solution.
Choice of indicators
It was necessary to consider which information would be useful and technically feasible to offer through a conversational interface.
Reliability of answers
The experience reinforced the importance of validating results produced by language models before using them in financial decisions.
08

What I would take into a next version

If the project were resumed, the next steps would be to strengthen validation mechanisms, query control, systematic evaluation of answers and monitoring of the application's behavior.

The architecture could also separate more explicitly the steps of interpreting the question, running the queries, calculating the indicators and generating the answer.

These points are possible next steps, not features actually implemented in the original prototype.