Let's make a little hello world.
While there's a lot of things yet to
learn, I have myself seen similar courses like
this, that spent way too much time in
the beginning, talking about all the other things,
when I just want to see something in
action.
So, we're going straight into code here in
a zero to first prompt scenario, where the
only thing I've done here is I've made
a new console app, in this case .NET
10, but it can be any .NET version,
because Microsoft supported.
So, the only thing we need prior to
doing this is some kind of LLM provider,
and in order to make it quickly here,
I will make it using OpenAI, because it's
the easiest to work with, and then later
on, we'll switch it out to Azure OpenAI,
so we have two different providers to look
at.
So, in order to do this, we need
some credentials, and I've logged into platform.openai
.com slash API keys, where I can get
an API key.
You need to register on platform.openai.com
to do this, and you need to put
in at least 5 US dollars in order
to do it.
If you don't want to do that upfront,
take a look at when we do it
with Azure instead.
There you can have an Azure subscription and
only pay on the fly, so we don't
even need to spend the upfront five dollars.
But what we need to do is we
need to get a key, and I'm about
to show you my key, mostly to teach
you how they look.
I will, of course, have deleted that key,
and you shouldn't share a key like this
with anyone, but let's make a key, and
I will call it test key.
It can be restricted, but in my case,
I will just make it have all permissions,
and we get a key.
So, let's put that in, string API key,
and of course, we shouldn't save this in
clear text and code.
There will be a small section on how
we store this key in a more secure
way as well.
A little about this key.
When you use it the first time, it
might pop up with an exception saying you
need to register a project or you need
to verify that you're your organisation, and there
will be a few steps up in this
portal for you to verify with image ID
who you are and such things before you
can actually work with the account.
Again, if you want to use Azure OpenAI
instead, they don't need to do such things,
but there's a bit more other steps that
need to be done.
But that is all we need to do.
One other note is if you are subscribing
to chat GPT, meaning the normal portal for
chat, that does not mean that you have
API keys.
The API is completely separate from that subscription,
and again, you need to have a separate
account, and you need to put in some
money in your billing account in here in
order to do this.
But we now have our key, and we
are ready to continue.