MeetKai / functionary

Chat language model that can use tools and interpret the results
MIT License
1.42k stars 110 forks source link

Response from oobabooga api not properly formatted #100

Closed EndingCredits closed 9 months ago

EndingCredits commented 9 months ago

Apologies for bringing up what is more an Ooba issue, but I am getting what seems to be incorrectly formatted outputs while querying the model through the text-generation-webui api with text completion.

Input prompt:

<|from|>system
<|recipient|>all
<|content|>// Supported function definitions that should be called when necessary.
namespace functions {

// Get the price of a particular car model
type get_car_price = (_: {
// The name of the car model.
car_name: string,
}) => any;

// get the weather of a location
type get_weather = (_: {
// where to get weather.
location: string,
}) => any;

} // namespace functions
<|from|>system
<|recipient|>all
<|content|>
<|from|>user
<|recipient|>all
<|content|>who is the president of US
<|from|>assistant
<|recipient|>all
<|content|>Biden is the president of US<|stop|>
<|from|>user
<|recipient|>all
<|content|>is the car Song more expensive than car Tang?
<|from|>assistant
<|recipient|>all
<|content|>I will get the price of 2 cars and compare
<|from|>assistant
<|recipient|>get_car_price
<|content|>{"car_name": "Song"}
<|from|>assistant
<|recipient|>get_car_price
<|content|>{"car_name": "Tang"}<|stop|>
<|from|>get_car_price
<|recipient|>all
<|content|>{"price": {"price": "$25000"}}
<|from|>get_car_price
<|recipient|>all
<|content|>{"price": {"price": "$20000"}}
<|from|>assistant
<|recipient|>

Returned Completion:

 all
 The car Tang is more expensive than the car Song. assistant
 all
 The car Tang is more expensive than

I did wonder if it might be the quants, but I've tried it with this model https://huggingface.co/LoneStriker/functionary-small-v2.2-6.0bpw-h6-exl2 as well as this one https://huggingface.co/LoneStriker/functionary-medium-v2.2-3.5bpw-h6-exl2 as well as the 4bpw gguf from https://huggingface.co/meetkai/functionary-small-v2.2-GGUF.

Any idea what could be causing this issue - it would be great to get this working with the text-generation-webui as it's just nice t have everything in one place rather than having to rely on multiple different backends.

EndingCredits commented 9 months ago

Okay, I clearly didn't look hard enough, turns out I just neede to pass "skip_special_tokens": False, into the API query.

I will leave this here as testament to my folly (and if anyone else is having similar issues). Feel free to mark as resolved.

jeffreymeetkai commented 9 months ago

Thank you for the solution! Closing now