LLMUnity icon indicating copy to clipboard operation
LLMUnity copied to clipboard

Function calling

Open xumeng12321 opened this issue 1 year ago • 1 comments

Describe the feature

Hi, I wonder if it is possible to add custom tools to the LLM to make it do something like, create a new cube in the scene.

xumeng12321 avatar Mar 26 '24 12:03 xumeng12321

hi, not at the moment! you could do it somehow manually: prompt the LLM to generate some code, then parse the response to extract it and call the code.

amakropoulos avatar Mar 29 '24 16:03 amakropoulos

Function Calling, as i understand it, would be similar to command detection maybe through sentence similarity or intend recognition, like for ex. the input "Hello" -> callfunc WaveHand()

3inary avatar Oct 26 '24 09:10 3inary

Yes, that's correct @3inary ! I was trying to answer the request by @xumeng12321 . At the moment, one way to do function calling is the following:

  • Specify the commands available at the LLMCharacter (system) prompt
  • Ask the LLM to select an appropriate function based on the user input
  • Use a grammar for the response that allows only the function names and parse the function name
  • Call the function

I will implement a sample that does that and then close the issue. Let me know if you have other thoughts!

amakropoulos avatar Oct 29 '24 09:10 amakropoulos

Hi, I would like to know if, by using the method suggested by @amakropoulos for function calling, this approach can return parameters such as, for instance, the weather in NY. Specifically, can the output return the temperature in degrees Celsius?

ringorjo avatar Nov 15 '24 17:11 ringorjo

You can specify it in a grammar. I will add an example for that as well, hopefully this week.

amakropoulos avatar Nov 16 '24 09:11 amakropoulos