Skip to content

Litellm model usage config#32

Closed
dgarson wants to merge 6 commits intomainfrom
litellm-model-usage-config
Closed

Litellm model usage config#32
dgarson wants to merge 6 commits intomainfrom
litellm-model-usage-config

Conversation

@dgarson
Copy link
Owner

@dgarson dgarson commented Feb 21, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

dgarson and others added 6 commits February 20, 2026 22:08
Implements a validation + repair pipeline for tool calls from models
with known tool-calling quirks (MiniMax M2.5, GLM-5, Grok 4).

## Files

- src/agents/tool-call-validator.ts — validates tool calls, reports
  typed issues, determines repairability via fuzzy matching
- src/agents/tool-call-repair.ts — applies 7 ordered repair strategies
  to produce a best-effort corrected call
- src/agents/tool-call-validator.test.ts — 50 unit tests
- src/agents/tool-call-repair.test.ts — 98 unit tests

## Validator

Reports typed issues:
  - unknown_tool (fuzzy-aware repairability check)
  - invalid_id
  - empty_args
  - malformed_json
  - missing_required
  - wrong_type (notes coercibility)
  - extra_params

## Repair strategies (in order)

1. JSON fix-up: trailing commas, single quotes, unquoted keys,
   missing braces/brackets, BOM removal
2. Type coercion: string->boolean, string->number, scalar->array
3. Tool name fuzzy matching: Levenshtein <= 3 or case-insensitive
4. Parameter name normalisation: camelCase <-> snake_case
5. Missing required params relocation from extra fields
6. Tool call ID generation/sanitisation
7. Provider-specific fixes:
   - MiniMax: unwrap object/string wrappers, double-encoded JSON,
     malformed strings via fixJson
   - GLM-5/ZhipuAI: unwrap parameters/function_arguments wrappers
   - Grok 4: same patterns as MiniMax
   - Generic (unknown provider): heuristic single-key wrapper detection

## Test results

148/148 passing, 0 skipped
TypeScript: clean (tsc --noEmit exit 0)
ESLint: 0 errors, 0 warnings

Levenshtein distance implemented from scratch, no external deps.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dgarson
Copy link
Owner Author

dgarson commented Feb 21, 2026

Closing — all commits already present in dgarson/fork.

@dgarson dgarson closed this Feb 21, 2026
dgarson added a commit that referenced this pull request Feb 22, 2026
Built by Reed:
- Two-column: version sidebar + release notes content
- 5 releases: v2.4.1 (patch), v2.4.0 (minor/major Horizon launch), v2.3.0 (node/browser), v2.2.0 (sessions), v2.0.0 (major rewrite)
- Section types: ✨ New / 🛠️ Improvements / 🐛 Fixes / ⚠️ Breaking / 📦 Dependencies
- Latest badge, version type badges (major/minor/patch/beta)
- Prev/Next navigation, Subscribe CTA
- Full a11y: role=listbox/option, aria-selected

Build: ✓ 0 TS errors, 1.39s, 9.55 kB / gzip 3.28 kB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant