Okay.
So this is a very interesting level two application.
We are going to build.
You are going to learn how to build an application to evaluate a drug application.
If you remember we have talked about we have we have talked about that before a LM applications are
not very easy to evaluate, not very easy to test.
Test is the word we use as software engineers for traditional software applications.
So when you build a traditional software application, testing is is is relatively easy because every
time you ask one question to a traditional software application, you are going to have the same answer.
So testing is easy, but in the LM applications we have a different situation.
We can, uh, tell the same question twice to an LM application and we can get two different answers.
So sometimes it is difficult to evaluate the, the quality or to test the quality of a LM application.
So we have different methods, different ways to approach evaluation.
And this is a very simple one.
What we are going to do here, as you can see in the drop down with explanation.
But what we are going to do here is first we have created a Rag application.
So we are going to load a txt and we are going to make questions about the content in the in the txt
file.
Okay.
But in this application we have included this evaluation part.
And in the evaluation part we are going to enter a question and an answer we already know.
And then this application is going to ask this security question if you want to the application in order
to see if the application is going to, uh, give us a similar or an exactly and the same, uh, response
that we have.
And this is the interesting the interesting part, because this application is going to be able to see
if the answer provided by the application is not exactly the same as the answer we have provided, but
it it means the same or it is mostly the same, you see.
So if instead of saying, I don't know, uh, the United States of America, the application says United
States of America without the article first, this application is going to be wise enough to see, okay,
the answer is good is correct.
So the evaluation is positive.
Okay.
So this is the very interesting thing about evaluating an app an application with an LM application
okay.
So let's let's try this.
So first we are going to load a txt file.
This is a txt file from AI accelerator our company.
And it's just explaining the different services we provide.
So artificial intelligence consulting services for enterprise level companies for small businesses LM
app development etc. etc..
Right.
So we load this file.
Now we are going to enter this security question or this testing question or whatever.
We know the answer to this question.
So that's the purpose of this security question okay.
So I'm going to ask what.
What is the name of the company?
Company.
When you.
When you talk and write at the same time, what is the name of the company?
Okay.
We press enter and then we enter the real answer to the question.
We say, okay, the name of our company is a AI accelerator okay.
And then we press enter.
Now we enter the OpenAI API key.
We press enter to submit the form.
And the application now is going to make this question to the application okay.
So question what is the name of the company.
Real answer AI accelerator answer provided by the application.
The same.
Therefore the AI application answer was correct.
So the evaluation has been positive.
Usually when we evaluate an application an LM application we have like a range of questions like ten,
15, 20 depends of the case right.
But this is a very simple prototype in order to demo this kind of functionality okay.
So let's take a look at the code.
As always, two main files requirements.
We are familiar with the packages here and Main.py.
As you see, you are also familiar with this drag functionality we have prepared here.
Okay, you did this in the previous blog with level one applications.
Okay, so the only thing is you can see here are the typical Streamlit tricks like encapsulating functionality
and functions, using streamlit elements, etc. etc..
Okay, so nothing new for you now.
As always, download this code, execute our code in your computer, then repeat the code by yourself,
line by line and try to understand what you are doing whenever you have a question or a doubt ChatGPT
for extremely documentation, etc. etc. and only once you are comfortable with this application you
go to the next lesson.