๐Ÿง™๐Ÿผ Earning Sage

Have you ever thought about joining an earning call and asking questions to these CFOs? That used to be the privilege held by the investors from high-end investment banks such as JP Morgan, Goldman Sachs and Morgan Stanley.

Yet with the capability of LLM and proper techniques around it, not anymore. And if you donโ€™t feel like reading the whole post, feel free to try out a demo here. This demo is created based on the Apple Q2 2023 earning call.

In this tutorial, we will demonstrate how to use TUNA to build an earning call assistant. The assistant will be able to answer questions such as:

  • What earning reports are available?
  • What was talked during Apple's earning report?
  • How much revenue is achieved on the iphone sector

Step 1 : Data Preparation

The first step is to prepare the data. We need to transofrm the earning call data into a format that can be used by TUNA. I've prepared a sample data file for you here.

Click here to take a peek into the sample data
[
    {
        "messages": [
            {
                "role": "system",
                "content": "Certainly. [Operator Instructions] And our first question comes from the line of Gregory Peters from Raymond James. Your question please."
            },
            {
                "role": "user",
                "content": "Well, Good morning. A lot to unpack in your comments. I think what I'd like to do for my question and follow-up would be to focus on, first, slide 5. And I was interested in your comments about the average underlying loss ratio, I think, up 6.5% in first quarter versus the average earned premium being a good guide for 5.7%. I guess the question would be, is the expectation that 6.5% is going to continue? And when will the average earned premium go beyond where the underlying loss ratio deterioration is?"
            },
            {
                "role": "assistant",
                "content": "I'll get Mario to dig in on claim expenses. When you look at the 5.7%, I'll remind you -- I'll remind you that remember, this is a number that's been trending up as the rates that we took in 2021 and 2022 start to be earned in. So we would expect that number to continue to increase as we earn in the rates we've already implemented, and so we think this. In terms of claims severity, I'll let Mario give you an update on where we are and what we're thinking about."
            },
            {
                "role": "assistant",
                "content": "Yes. So in terms of claims severity, what we disclosed this quarter was across major coverages. We're running in the 9% to 11% range in both physical damage and in injury coverages. Really, the drivers of those costs, if you start with physical damage, we continue to see pretty persistent inflation particularly in parts and labor costs to repair cars. Actually, used car prices or total values for used cars actually came down a little bit in the first quarter in our numbers, but we had a higher percentage of total loss frequency which impacted the mix, so those are really the drivers. And on bodily injury, it's the same things we've been talking about. Medical inflation, medical consumption and attorney representation."
            },
            {
                "role": "assistant",
                "content": "So I think the drivers of severity continue to persist. In terms of where they're going forward, it's really anybody's guess, but I think our perspective is, and we've been pretty consistent on this point, we're going to continue to take prices up. We've been doing that really since the fourth quarter of 2021 throughout last year. That continued into the first quarter. We're going to continue to, on a forward-looking basis, implement rate increases to first catch up and then outpace loss cost trends. But our perspective on rates as we continue to need to push more price through the system, and we intend to do that throughout the balance of 2023."
            },
            {
                "role": "user",
                "content": "Right. On slide seven, you -- in your comments, you talked about those three states. And I guess, a follow-up question would be, where do you think that's going to go from a rate perspective? I think you said in your comment, Mario, that you expect to file the balance of your full rate need in California. And won't that trigger a different process causing a delay in potential rate approvals? So give us some color on that slide, please."
            }
        ]
    }
]

Step 2 : Model Training with TUNA

Now we can start training the model with TUNA. The training process is pretty straightforward. We will navigate to the TUNA page and click on the "Create tuna"

In the prompted window, we need to fill in the name of the model and then upload the data file downloaded.

Once the model is created, the training process will start automatically. It will take from few minutes to few hours depending on the size of the data and the queue. Once the training is done, we can start using the model.

TUNA Training

Step 3 : Model Deployment

Once the model is trained, we will see the training status indicator on the model card will change to Success. We can click the Deploy button to deploy the model. The initial deployment will take a few minutes. Once the deployment is done, we can start using the model.

Step 4 : Model Usage

Use the model in the Web UI

The simplest way of We can click on the model card to navigate to the chat interface. On this page, we can also test the model by entering the question in the input box and click the "Ask" button. The model will return the answer to the question.

TUNA Web UI

Use the model in the API

We can also use the model in the API. The API endpoint is available on the model card.

TUNA API

In this tutorial, we will update the environment variable OPENAI_API_BASE and OPENAI_API_KEY with in main.py . You may clone this file to your local machine, Then we can run the following code to get the answer.

# Create the photon
lep photon create -n earning-sage -m py:main.py

# Running locally
lep photon run -n earning-sage --local

Then visit localhost:8080/ui to try out your own earning sage!