In this video we are going to look
a little on all the different options we
have when we call RunAsync.
RunAsync and RunAsyncStreaming have exactly the same options
so we will just cover RunAsync and we
will keep RunAsync for structured output to its
own separate video.
So when we do this we have a
lot of options but behind the scenes it's
actually not that much different.
So let's go through them one by one.
So first up we can just give an
18 thread and nothing more.
We can give the thread and options and
throughout this we can give thread and options.
So the thread itself we saw is the
one that keeps the persistence between the different
calls and I know this specific overload is
actually something that the team is considering removing
because it doesn't really make sense to just
give a thread without a new message.
But the thread itself we don't really do
anything other than get it from the agent
and then paste it in.
The options might look a bit empty in
that we can give some additional properties.
In general there's always an additional property that
can be used to put in new things
at some point.
It doesn't really do anything for most of
the providers but they have made it ready
so it's possible.
And then there's something called background responses.
It's a very very niche feature that needs
a continuation token in order to be able
to make everything happen in the background and
with long streaming.
I don't think even I will cover this
in this because it's so advanced but I
actually have a video I will link to
in the system if you really want to
see what this is about.
Beyond that we can actually give when we
have a chat client instead of an agent
run options we can give a chat client
agent run options instead and have a bit
more features in that it can give some
chat options similar to what we did up
in the agent itself.
So we can under fly switch to a
different instruction, switch to a different temperature, switch
to some other tools.
So let's say we have an agent that
has three tools but in this specific call
you only want to give two.
That is possible so it can overwrite the
stuff here.
And beyond that it also has the client
factory which is the slow level thing of
being able to manipulate the underlying agents.
So those was the the thread and the
options.
There's a cancellation token, gives itself.
There's serialisation options whenever there's some serialisation back
and forward.
That's mostly again to do with structured output
which we will talk about later.
Then we have the various versions of giving
it as a message.
So we can either give it as a
chat message, a list of chat messages.
Get this for me.
So either messages, chat messages, collection of chat
messages or down here we have all the
things happening together.
So it looks much.
In reality you mostly will just give a
message and an agent thread and that's it.
It is very, very rare that you need
to do more than that but the options
are there.