Manual creation of functions #298
Replies: 3 comments 6 replies
-
You should only be creating this list one time, should be simple enough to change your list to readonly property or field in your class. You should only register these once, and can be cleared if needed using the Tool class methods. Tool.GetAllAvailableTools();
Tool.GetOrCreateTool(instance, "tool-name");
Tool.TryGetTool("tool-name", instance, out var tool);
Tool.IsToolRegistered(tool);
Tool.ClearRegisteredTools();
You should be able to do either. I did not change the default behaviour, and you can still specify functions in json form as you did before.
I'd have to see an example, but you should be able to register the tool/function one time at the start of your app, then just use that same list of tools for the chat/assistant requests. Check the test suite or my Unity demo scene for examples. |
Beta Was this translation helpful? Give feedback.
-
I think the concept of a mandatory static list of tools isn't going to work. I want my users to be able to define their own tools and callbacks. Having to manage a static list of every tool in memory and sync it with user settings is going to be an unnecessary amount of work. It makes much more sense to just generate this on each request from the DB but the new changes seem to make this impossible. |
Beta Was this translation helpful? Give feedback.
-
How do we opt out of the cache or bypass it? |
Beta Was this translation helpful? Give feedback.
-
I have just updated from latest code and got a breaking change for tools that I can't quite see how to get around.
In my app at beginning of each request I read users account and dynamically generate a function list that lets the user interface based on their own configurations. This now throws an error due to internal private static dictionary every time a function is created with same name across all threads.
Looking at the example in the docs it seems now you pass a delegate and the tool call is handled internally but this will not work for me as the only way I have got my application working well is by adding in descriptions for every parameter, not just the method. They have to be tweaked based on individual users data.
In my app I manually build the list of functions but it seems this internal dictionary now makes that approach impossible as there is no method to access this dictionary externally. Maybe there is still a way to do that but I can't see any example of how it is supposed to work.
How should I approach use case where each request has custom functions and multiple concurrent requests?
Beta Was this translation helpful? Give feedback.
All reactions