Skip to content

CreateRunAsync Get Event Type from streamEvent "event: thread.run.created" #260

Answered by StephenHodgson
JBlakeMCAA asked this question in Q&A
Discussion options

You must be logged in to vote

@JBlakeMCAA I added an overload in 8.1.1 to get the event name:

var api = new OpenAIClient();
var tools = new List<Tool>
{
    Tool.GetOrCreateTool(typeof(WeatherService), nameof(WeatherService.GetCurrentWeatherAsync))
};
var assistantRequest = new CreateAssistantRequest(tools: tools, instructions: "You are a helpful weather assistant. Use the appropriate unit based on geographical location.");
var assistant = await api.AssistantsEndpoint.CreateAssistantAsync(assistantRequest);
ThreadResponse thread = null;
async Task StreamEventHandler(string @event, IServerSentEvent streamEvent)
{
    Debug.Log(@event);
    switch (streamEvent)
    {
        case ThreadResponse threadResponse:
            

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@StephenHodgson
Comment options

@StephenHodgson
Comment options

Answer selected by JBlakeMCAA
@JBlakeMCAA
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants