singularity-forge/packages/pi-ai
Mikael Hugo 58b1d7c601 port(pi-mono): omit tools field instead of sending empty array (refs 3e0ee69b5)
Pi-mono Tier 0 #2 — sf-driven port of PR #3650.

Some LLM providers reject API calls when `tools: []` is sent (an empty
array), but accept the call when the tools field is omitted entirely.
This guards each provider's request-body builder to omit `tools` when
the tool list is empty, instead of serialising the empty array.

Files (5 provider builders):
- packages/pi-ai/src/providers/openai-completions.ts
- packages/pi-ai/src/providers/openai-responses.ts
- packages/pi-ai/src/providers/openai-codex-responses.ts
- packages/pi-ai/src/providers/azure-openai-responses.ts
- packages/pi-ai/src/providers/anthropic-shared.ts (covers anthropic
  and anthropic-vertex which both import buildParams from it)

Pattern: `if (context.tools)` → `if (context.tools && context.tools.length > 0)`.

Preserved: the `else if (hasToolHistory(context.messages))` branch in
openai-completions.ts that intentionally emits `tools: []` for
LiteLLM/Anthropic-proxy compatibility is unchanged.

Type-check passes.

Co-Authored-By: sf v2.75.1 (session 38ed0a48)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 14:22:31 +02:00
..
scripts pi-ai: source google-gemini-cli model list from cli-core's VALID_GEMINI_MODELS 2026-04-19 11:44:28 +02:00
src port(pi-mono): omit tools field instead of sending empty array (refs 3e0ee69b5) 2026-04-29 14:22:31 +02:00
bedrock-provider.d.ts feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
bedrock-provider.js feat: vendor Pi source into workspace monorepo 2026-03-12 21:55:17 -06:00
oauth.d.ts fix: add missing package.json subpath exports and oauth stubs (#1014) 2026-03-17 18:01:56 -06:00
oauth.js fix: add missing package.json subpath exports and oauth stubs (#1014) 2026-03-17 18:01:56 -06:00
package.json pi-ai/google-gemini-cli: re-platform transport on @google/gemini-cli-core 2026-04-19 11:29:56 +02:00
tsconfig.json ci: optimize build workflows and caching 2026-04-14 11:16:47 -05:00