llama-stack/llama_stack/providers/utils
Ben Browning 6378c2a2f3
fix: resolve BuiltinTools to strings for vllm tool_call messages (#2071)
# What does this PR do?

When the result of a ToolCall gets passed back into vLLM for the model
to handle the tool call result (as is often the case in agentic
tool-calling workflows), we forgot to handle the case where BuiltinTool
calls are not string values but instead instances of the BuiltinTool
enum. This fixes that, properly converting those enums to string values
before trying to serialize them into an OpenAI chat completion request
to vLLM.

PR #1931 fixed a bug where we weren't passing these tool calling results
back into vLLM, but as a side-effect it created this serialization bug
when using BuiltinTools.

Closes #2070

## Test Plan

I added a new unit test to the openai_compat unit tests to cover this
scenario, ensured the new test failed before this fix, and all the
existing tests there plus the new one passed with this fix.

```
python -m pytest -s -v tests/unit/providers/utils/inference/test_openai_compat.py
```

Signed-off-by: Ben Browning <bbrownin@redhat.com>
2025-05-01 08:47:29 -04:00
..
bedrock Fix precommit check after moving to ruff (#927) 2025-02-02 06:46:45 -08:00
common feat: [new open benchmark] BFCL_v3 (#1578) 2025-03-14 12:50:49 -07:00
datasetio refactor: extract pagination logic into shared helper function (#1770) 2025-03-31 13:08:29 -07:00
inference fix: resolve BuiltinTools to strings for vllm tool_call messages (#2071) 2025-05-01 08:47:29 -04:00
kvstore chore: made inbuilt tools blocking calls into async non blocking calls (#1509) 2025-03-09 16:59:24 -07:00
memory fix(deps): move chardet and pypdf imports inline where used (#1434) 2025-03-06 17:09:14 -08:00
scoring feat: [New Eval Benchamark] IfEval (#1708) 2025-03-19 16:39:59 -07:00
telemetry feat: use same trace ids in stack and otel (#1759) 2025-03-21 15:41:26 -07:00
__init__.py API Updates (#73) 2024-09-17 19:51:35 -07:00
scheduler.py feat: Implement async job execution for torchtune training (#1437) 2025-04-14 08:59:11 -07:00