llama-cpp-python icon indicating copy to clipboard operation
llama-cpp-python copied to clipboard

fix: add binding for name in ChatCompletionRequestToolMessage

Open JDScript opened this issue 1 year ago • 6 comments

Follow issue #1405

JDScript avatar Apr 29 '24 20:04 JDScript

@JDScript I'm not sure that's correct based on the OpenAI OpenAPI spec here

abetlen avatar Apr 30 '24 18:04 abetlen

Yeah, but I checked the document here, under Example invoking multiple function calls in one response. Examples given by OpenAI also adds the name parameter, which is the same as in the examples/notebooks/Functions.ipynb. Therefore, I used an optional binding.

JDScript avatar May 02 '24 00:05 JDScript

Any update on this? I am facing same issue while using functionary.

pseudorandomrants avatar May 26 '24 12:05 pseudorandomrants

This does not seem like the correct fix.

I see this message when specifying a message "role": "tool" and if its missing a name. so you can workaround with another role e.g. system if missing a name

allenporter avatar Jul 15 '24 03:07 allenporter

Also discussed here https://github.com/openai/openai-python/issues/1078

I see, the tool role template is expecting a name in the chat template:

  • https://huggingface.co/meetkai/functionary-7b-v2/blob/68795699d4632529a92530ab55bbe8efbd62707a/tokenizer_config.json#L67
  • https://huggingface.co/meetkai/functionary-small-v2.5/blob/89e6716271825c203b7e9c7836d2d3b1ed191bea/tokenizer_config.json#L2053

So a name needs to be populated from somewhere, or the tool role can't be used.

allenporter avatar Jul 15 '24 03:07 allenporter

Perhaps we have to get it by looking at the history of tool calls with the same tool id.

allenporter avatar Jul 15 '24 04:07 allenporter