You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`ChatCompletionRequest` has no `tools` / `tool_choice` field today, so the OpenAI endpoint silently drops any tool definitions the client sends and the model never sees them. `/v1/messages` (Anthropic) has full tool support; `/v1/chat/completions` does not.
Streaming variant emits incremental `tool_calls` deltas (each `delta.tool_calls[i]` is an array element addressed by index).
History side: a `role:"tool"` message with `{tool_call_id, content}` echoes a prior result.
Scope
Add `Tools`, `ToolChoice` to `ChatCompletionRequest`. Plus matching `tool_calls` field on `OaiAssistantMessage` and a new `ToolCall` record in the response shape. Register types in `SharpInferenceJsonContext`.
Render tool definitions into the Jinja context (`tools` key) on the prompt side, same path the Anthropic endpoint already uses via `ChatTemplateRenderer.Format(dict)`.
Background
`ChatCompletionRequest` has no `tools` / `tool_choice` field today, so the OpenAI endpoint silently drops any tool definitions the client sends and the model never sees them. `/v1/messages` (Anthropic) has full tool support; `/v1/chat/completions` does not.
OpenAI wire shape:
```json
{
"model": "...",
"messages": [...],
"tools": [{"type":"function","function":{"name":"get_weather","description":"...","parameters":{...}}}],
"tool_choice": "auto"|"none"|{"type":"function","function":{"name":"..."}}
}
```
Response:
```json
{
"choices":[{
"message":{
"role":"assistant",
"content": null,
"tool_calls":[{"id":"call_abc","type":"function","function":{"name":"...","arguments":"{...}"}}]
},
"finish_reason":"tool_calls"
}]
}
```
Streaming variant emits incremental `tool_calls` deltas (each `delta.tool_calls[i]` is an array element addressed by index).
History side: a `role:"tool"` message with `{tool_call_id, content}` echoes a prior result.
Scope
Acceptance
Related