NVIDIA / NVIDIA/Personal-AI-Router

[Bug]: OpenAI-compatible tool calls are returned as plain text when routed through PAIR

オープン
#94 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Go
スター
1.4k
フォーク
250
平均マージ
23時間 27分
マージ済み PR(30日)
1

説明

PAIR version or commit

0.1.1-463

Affected component

Ollama proxy

Environment

OS: Ubuntu 26.04.1 LTS on model host; Linux on NVIDIA DGX Spark PAIR client
Architecture: x86_64 model host; arm64 PAIR client
GPU and driver: AMD Radeon 8060S / Ryzen AI Max+ 395 on model host; NVIDIA GB10 on PAIR client
Engine and version: Ollama 0.33.2
Model: qwen3.6:27b
Cluster size: 4 nodes

Steps to reproduce
  1. Configure a PAIR cluster with an Ollama node serving qwen3.6:27b.

  2. Send an OpenAI-compatible POST request to:
    /v1/chat/completions

    The request contains multiple OpenAI function/tool definitions and asks the model to work on a task for which it should call the kanban_show function.

  3. Send the request through the PAIR Ollama proxy.

  4. Send the exact same JSON request body directly to the Ollama server hosting qwen3.6:27b, bypassing PAIR.

  5. Compare finish_reason, message.content, and message.tool_calls in the two responses.

Repeated control test:

  • Direct to Ollama: 3/3 requests returned a native tool_calls object.
  • Through PAIR: 3/3 requests returned finish_reason: stop with no tool_calls object. The intended function call instead appeared as ordinary assistant content.

The behavior is reproducible with curl and does not require an agent framework.

Expected behavior

When an OpenAI-compatible chat completion request containing tool definitions is routed through PAIR, native tool-calling behavior should be preserved.

For this request, the response should contain message.tool_calls with a call to kanban_show, and finish_reason should be tool_calls, matching the response obtained when the identical request is sent directly to the Ollama server.

Actual behavior

When the identical request is sent through the PAIR Ollama proxy, the native OpenAI-compatible tool call is not returned.

In repeated testing, PAIR returned:

  • finish_reason: stop
  • message.tool_calls: null / absent
  • The intended kanban_show call embedded in message.content as ordinary text.

Three consecutive PAIR requests produced textual representations such as:

  1. Python-like syntax:
    kanban_show(task_id="t_65ba4229")

  2. Bracket syntax:
    [kanban_show][0]

  3. XML-like syntax:
    <invoke>kanban_show(task_id="t_65ba4229")</invoke>

By contrast, three consecutive requests using the identical JSON request body sent directly to Ollama returned native OpenAI-compatible tool calls:

finish_reason: tool_calls

with message.tool_calls containing a function call to kanban_show.

The same JSON payload succeeds when sent directly to the Ollama server on the model host, so the failure is introduced only when the request is routed through PAIR.

This also prevents OpenAI-compatible agent/tool frameworks from recognizing and executing the requested function when the request is routed through PAIR.

Sanitized logs or screenshots

Confirmations
  • I searched existing issues for duplicates.
  • This is not a security vulnerability.
  • I agree to follow the Code of Conduct.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Ollama プロキシの /v1/chat/completions エントリポイントから始め、ツール定義が存在する場合にリクエストとレスポンスがどのように処理されるかを比較します。PAIR および Ollama に直接対して、ドキュメントに記載された curl リクエストで再現し、その後、PAIR が呼び出しをテキストとして返すのではなく、message.tool_calls と finish_reason: tool_calls を保持することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go, ollama
領域
api, backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。