-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR 2634 CI - Fix the tool_choice format for named choice by adapting …
…OpenAIs scheme (#2645) * add OpenAI like tool_choice for named choice * add tests * fix: run linter and bump api docs * fix: consolidate changes and remove old tool type * feat: improve, simplify and rename tool choice struct add required support and refactor * fix: simplify tool choice logic, improve tests, openapi and rust docs * fix: refactor away prepare_chat_input and improve tool grammar apply control flow * feat: update docs and add tool choice configuration section * fix: simplify naming, tool choice default and improve test * fix: adjust tool choice none logic, add test and small refactors * fix: add missing snapshot file * fix: adjust tool choice type in test * fix: adjust default when json tool choice is * fix: remove trailing space lint after rebase * fix: remove mostly mocked unit test --------- Co-authored-by: Linus Bierhoff <[email protected]>
- Loading branch information
1 parent
2007a94
commit 5489406
Showing
9 changed files
with
442 additions
and
242 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
27 changes: 27 additions & 0 deletions
27
...test_tools_llama/test_flash_llama_grammar_tools_sea_creatures_stream_function_object.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"choices": [ | ||
{ | ||
"delta": { | ||
"role": "assistant", | ||
"tool_calls": { | ||
"function": { | ||
"arguments": "<|eot_id|>", | ||
"name": null | ||
}, | ||
"id": "", | ||
"index": 0, | ||
"type": "function" | ||
} | ||
}, | ||
"finish_reason": "stop", | ||
"index": 0, | ||
"logprobs": null | ||
} | ||
], | ||
"created": 1729084854, | ||
"id": "", | ||
"model": "meta-llama/Llama-3.1-8B-Instruct", | ||
"object": "chat.completion.chunk", | ||
"system_fingerprint": "2.3.2-dev0-native", | ||
"usage": null | ||
} |
20 changes: 20 additions & 0 deletions
20
...napshots__/test_tools_llama/test_flash_llama_grammar_tools_sea_creatures_stream_none.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"choices": [ | ||
{ | ||
"delta": { | ||
"content": " deep", | ||
"role": "assistant", | ||
"tool_calls": null | ||
}, | ||
"finish_reason": "length", | ||
"index": 0, | ||
"logprobs": null | ||
} | ||
], | ||
"created": 1729262528, | ||
"id": "", | ||
"model": "meta-llama/Llama-3.1-8B-Instruct", | ||
"object": "chat.completion.chunk", | ||
"system_fingerprint": "2.3.2-dev0-native", | ||
"usage": null | ||
} |
28 changes: 28 additions & 0 deletions
28
...hots__/test_tools_llama/test_flash_llama_grammar_tools_sea_creatures_stream_required.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"choices": [ | ||
{ | ||
"delta": { | ||
"content": null, | ||
"role": "assistant", | ||
"tool_calls": { | ||
"function": { | ||
"arguments": "<|eot_id|>", | ||
"name": null | ||
}, | ||
"id": "", | ||
"index": 0, | ||
"type": "function" | ||
} | ||
}, | ||
"finish_reason": "stop", | ||
"index": 0, | ||
"logprobs": null | ||
} | ||
], | ||
"created": 1729084850, | ||
"id": "", | ||
"model": "meta-llama/Llama-3.1-8B-Instruct", | ||
"object": "chat.completion.chunk", | ||
"system_fingerprint": "2.3.2-dev0-native", | ||
"usage": null | ||
} |
This file contains 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
Oops, something went wrong.