Commit ebfb5bf
committed
Fix llama-stack function tool serialization for Gemini compatibility
llama-stack's Responses API to Chat Completions conversion in
streaming.py leaks a "type" field into the function tool dict via
model_dump(). The OpenAI Chat Completions FunctionDefinition schema
only allows name, description, parameters, and strict — not type.
OpenAI silently ignores the extra field, but Gemini's OpenAI-compatible
endpoint strictly validates and rejects it with:
"Unknown name 'type' at 'tools[N].function': Cannot find field."
Fix: exclude type from serialization in streaming.py:
function=input_tool.model_dump(exclude={"type"})
Signed-off-by: Dan Prince <dprince@redhat.com>1 parent d1ccbfe commit ebfb5bf
2 files changed
Lines changed: 46 additions & 1 deletion
File tree
- src/llama_stack/providers/inline/agents/meta_reference/responses
- tests/unit/providers/agents/meta_reference
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1397 | 1397 | | |
1398 | 1398 | | |
1399 | 1399 | | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
1400 | 1404 | | |
1401 | | - | |
| 1405 | + | |
1402 | 1406 | | |
1403 | 1407 | | |
1404 | 1408 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2540 | 2540 | | |
2541 | 2541 | | |
2542 | 2542 | | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
2543 | 2584 | | |
2544 | 2585 | | |
2545 | 2586 | | |
| |||
0 commit comments