text-generation-inference icon indicating copy to clipboard operation
text-generation-inference copied to clipboard

Add support for correct tool names

Open cyril-k opened this issue 1 year ago • 2 comments

Feature request

Current implementation 1.4.5 does not return the correct tool name when using function calling. When returning a ToolCall, tool name is hardcoded to tools: https://github.com/huggingface/text-generation-inference/blob/4ee0a0c4010b6e000f176977648aa1749339e8cb/router/src/server.rs#L950

The name of the tool should be inferred by the model and parsed together with parameters to return the ToolCall with correct tool name.

Motivation

The name of the tool in the ToolCall is used in popular LLM frameworks (such as Langchain and LLamaIndex) to dispatch the underlying function calls. Currently, the corresponding function should be named "tools" for this to function properly. This modification will improve integration with open source LLM frameworks and allow to use multiple tools with correct names.

Your contribution

Need to verify if tool's name is handled properly by the tool_grammar and make sure the name field is valid in gen_text_value: https://github.com/huggingface/text-generation-inference/blob/4ee0a0c4010b6e000f176977648aa1749339e8cb/router/src/server.rs#L934-L943

cyril-k avatar Apr 01 '24 20:04 cyril-k

@drbh, this is an issue that is currently holding us back. Do you think it can be fixed "easily" ?

Jofthomas avatar Apr 01 '24 21:04 Jofthomas

It appears that this issue is going to be fixed in the related pull request.

cyril-k avatar Apr 02 '24 12:04 cyril-k

resolved with https://github.com/huggingface/text-generation-inference/pull/1693

drbh avatar May 01 '24 14:05 drbh