xebia-functional / xef

Building applications with LLMs through composability, in Kotlin, Scala, ...
https://xef.ai
Apache License 2.0
174 stars 15 forks source link

Set default description for assistant tools #777

Closed realdavidvega closed 3 weeks ago

realdavidvega commented 3 weeks ago

This PR sets the default description with the correct name when using toolOf function.

More flexible options were contemplated but not will be part of this PR:

  1. Making Tool Serializable: This option would involve marking Tool as serializable using the @Serializable and @Description annotations. However, I'm uncertain if making Tool serializable adds the necessary value to justify this approach.

  2. Passing Description as a Parameter: Another approach could be to modify the toolOf(tool) method to accept the description as an additional parameter. This method, though functional, is not particularly elegant or intuitive.

  3. Target-Specific Implementation: For JVM targets, we could leverage the @Description annotation and access it via reflection, and set the description if the parameter is null. For other platforms, we would have to rely only on passing the description as a parameter.

Given that none of these options are completely satisfactory and considering that this feature is not immediately critical, I propose for now just this simple change to just set the default description with the correct tool name.