You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can we get custom data into tool function call? Real world use: In the tool function, I need to be able to identify the user or send something over the connected websocket to the client, independent from the output.
Just a simple example with an overloaded InvokeFunctionAsync call.
[Function("Get the current temperature for the current user location.")]publicstaticTask<string>GetCurrentWeatherAsync(Contextcontext,[FunctionParameter("The units the user has requested temperature in. Typically this is based on the users location.")]WeatherUnitunit){varuserid=context.userid;varuserlocation=whatever.getlocation(userid)
return temp.bylocation(userlocation,unit)}
Or maybe make the first argument the ToolCall object (always/or check) . And use it like this:
// store the context somewhere elseContext.SetContext(toolCall.ToolCallId,myContext);// or add a custom property to the toolCalltoolCall.WhatEver=myContext;varfunctionResult=awaittoolCall.InvokeFunctionAsync();
[Function("Get the current temperature for the current user location.")]publicstaticTask<string>GetCurrentWeatherAsync(ToolCalltoolCall,[FunctionParameter("The units the user has requested temperature in. Typically this is based on the users location.")]WeatherUnitunit){// firstvarmyContext=Context.GetContext(toolCall.ToolCallId);// secondvarmyContext=(Context)toolCall.WhatEver;}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
How can we get custom data into tool function call? Real world use: In the tool function, I need to be able to identify the user or send something over the connected websocket to the client, independent from the output.
Just a simple example with an overloaded InvokeFunctionAsync call.
Or maybe make the first argument the ToolCall object (always/or check) . And use it like this:
Beta Was this translation helpful? Give feedback.
All reactions