fix(poolside): handle integer finish_reason and tool_call id

- ChatCompletionsTransport.normalize_response: convert integer
  finish_reason (e.g. 24) to string for Poolside compatibility
- Chat completion helpers: handle integer tool_call.id during streaming
  by converting to string
- Add Poolside as first-class CANONICAL_PROVIDERS entry (visible in
  CLI/TUI/desktop provider pickers)
This commit is contained in:
root 2026-07-04 18:39:00 +02:00 committed by Teknium
parent 2bb11adb49
commit 55e7986896
3 changed files with 18 additions and 5 deletions

View file

@ -2194,15 +2194,23 @@ def interruptible_streaming_api_call(agent, api_kwargs: dict, *, on_first_delta=
idx = _active_slot_by_idx[raw_idx]
if idx not in tool_calls_acc:
# Poolside may send integer id instead of string
_tc_id = tc_delta.id
if isinstance(_tc_id, int):
_tc_id = str(_tc_id)
tool_calls_acc[idx] = {
"id": tc_delta.id or "",
"id": _tc_id or "",
"type": "function",
"function": {"name": "", "arguments": ""},
"extra_content": None,
}
entry = tool_calls_acc[idx]
if tc_delta.id:
entry["id"] = tc_delta.id
if tc_delta.id is not None:
_new_id = tc_delta.id
if isinstance(_new_id, int):
_new_id = str(_new_id)
if _new_id:
entry["id"] = _new_id
if tc_delta.function:
if tc_delta.function.name:
# Use assignment, not +=. Function names are

View file

@ -609,7 +609,11 @@ class ChatCompletionsTransport(ProviderTransport):
"""
choice = response.choices[0]
msg = choice.message
finish_reason = choice.finish_reason or "stop"
# Poolside returns integer finish_reason (e.g. 24) instead of string
_fr = choice.finish_reason
if isinstance(_fr, int):
_fr = str(_fr)
finish_reason = _fr or "stop"
tool_calls = None
if msg.tool_calls:

View file

@ -1055,7 +1055,8 @@ CANONICAL_PROVIDERS: list[ProviderEntry] = [
ProviderEntry("minimax", "MiniMax", "MiniMax (Global direct API)"),
ProviderEntry("minimax-oauth", "MiniMax (OAuth)", "MiniMax via OAuth browser login (Coding Plan, minimax.io)"),
ProviderEntry("minimax-cn", "MiniMax (China)", "MiniMax China (Domestic direct API)"),
ProviderEntry("ollama-cloud", "Ollama Cloud", "Ollama Cloud (Cloud-hosted open models, ollama.com)"),
ProviderEntry("poolside", "Poolside", "Poolside (Laguna models via inference.poolside.ai)"),
ProviderEntry("ollama-cloud", "Ollama Cloud", "Ollama Cloud (Cloud-hosted open models, ollama.com)"),
ProviderEntry("arcee", "Arcee AI", "Arcee AI (Trinity models, direct API)"),
ProviderEntry("gmi", "GMI Cloud", "GMI Cloud (Multi-model direct API)"),
ProviderEntry("kilocode", "Kilo Code", "Kilo Code (Kilo Gateway API)"),