Improve function calling (auto selection, parallel functions, parameters grammar) #1347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Examples:
gives me:
Choice(finish_reason='tool_calls', index=0, logprobs=None, message=ChatCompletionMessage(content=None, role='assistant', function_call=FunctionCall(arguments='{ "term": "burger", "item_price_to": 10 }', name='search_item'), tool_calls=[ChatCompletionMessageToolCall(id='call__0_search_item_cmpl-768bb07b-6b14-47b1-8d91-3efa3c4de6d3', function=Function(arguments='{ "term": "burger", "item_price_to": 10 }', name='search_item'), type='function')]))
multiple functions:
same tools definition
gives:
Choice(finish_reason='tool_calls', index=0, logprobs=None, message=ChatCompletionMessage(content=None, role='assistant', function_call=None, tool_calls=[ChatCompletionMessageToolCall(id='call__0_search_item_cmpl-f924aecb-64e8-4ba0-8fc4-e9a620700064', function=Function(arguments='{ "term": "burger", "item_price_to": 10, "merchant_delivery_fee_to": 0 } ', name='search_item'), type='function'), ChatCompletionMessageToolCall(id='call__1_search_merchant_cmpl-98995992-1197-48c0-8740-d67ee7e12255', function=Function(arguments='{ "term": "Burger King" } ', name='search_merchant'), type='function')]))
I ran the server with:
python3 -m llama_cpp.server --model 'llm_models/WizardLM-2-7B.Q8_0.gguf' --n_gpu_layers 100 --chat_format vicuna-function-calling --n_ctx 1024