Skip to content

m serve OpenAI API tool calling round-trip #825

@markstur

Description

@markstur

Do the wiring for m serve openai API support for tool calling.

P1 — Core Features Expected by Clients (from parent issue details item 7)

Tool calling round-trip. Map tools -> ModelOption.TOOLS, set
tool_calls=True. Return ModelOutputThunk.tool_calls in the response message.
set finish_reason appropriately for tool_calls

TBD: Most likely handle function params at the same time.

Response fields

Field Type Notes
choices[].finish_reason "stop" | "length" | "tool_calls" | "content_filter" | "function_call" The OpenAI Python SDK and most wrappers expect this to be present.
choices[].message.tool_calls list[ToolCall] Already on ModelOutputThunk.tool_calls — not wired through.
choices[].message.function_call FunctionCall Deprecated but still used by some clients.

Request fields

Field What Should Happen
tools / functions Map to ModelOption.TOOLS and set tool_calls=True on instruct().
tool_choice / function_call Control whether and which tools are called.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions