Skip to content

ChatRequest Message roles tool and system unhandled #41

Description

@neagualexa

ChatRequest.messages[].role accepts TOOL (OpenAPI v0.1.0, components.schemas.Message), but the service treats every message as plain conversation history and forwards it unmodified. No major provider accepts a tool or system message.

for tool:

  • OpenAI — role: "tool" requires tool_call_id matching a tool_calls entry in the immediately preceding assistant message. Unmatched: 400.
  • Anthropic — tool_result blocks must reference a tool_use id from the previous assistant turn. Same constraint.
  • Gemini — no tool role exists. Content.role is user or model; results go in as a functionResponse part whose name must match a declared functionDeclaration.

for system:

  • Anthropic — system is a top-level request parameter, not a role. messages[].role accepts only user and assistant. A system-role message in the array is rejected.
  • Gemini — same shape: systemInstruction is a separate top-level field, Content.role is user or model.
  • OpenAI — the only one that tolerates system/developer messages positioned mid-array.

Next steps

To discuss on how to approach this, either:

  1. Ensure in capabilities of the clients that they can map TOOL and SYSTEM messages to a LLM-provider appropriate term.
  2. Drop TOOL and SYSTEM from the enum.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions