Improve function calling (auto selection, parallel functions, parameters grammar)#1347
Closed
themrzmaster wants to merge 11 commits intoabetlen:mainfrom
Closed
Improve function calling (auto selection, parallel functions, parameters grammar)#1347themrzmaster wants to merge 11 commits intoabetlen:mainfrom
themrzmaster wants to merge 11 commits intoabetlen:mainfrom
Conversation
Owner
|
Hey @themrzmaster this is awesome, thank you for the contribution! Do you mind splitting this up into 2 seperate PRs one for the grammar updates and one for the chat format changes. |
This was referenced Apr 17, 2024
Merged
Contributor
Author
Contributor
Author
|
@abetlen i see the test failing. maybe we should use this https://github.com/ggerganov/llama.cpp/blob/8dd1ec8b3ffbfa2d26e82e672cea89f5eeb2f141/examples/pydantic_models_to_grammar.py#L518 for pydantic grammar? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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