AnswerDotAI / AnswerDotAI/claudette

Client.structured fails when Claude returns tool name with different casing

Open
#102 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
316
Forks
43
PR merge metrics
No merged PRs in 30d

Description

When using Client.structured with a tool function, Claude sometimes returns the tool name with different capitalization than the original function name, causing a KeyError in call_func.

_Example_

Function defined as decision_f → Claude returns tool call with name decision_F → lookup fails.

```
from claudette import Client

def decision_f(component: str, decision: str, rationale: str, date: str) -> dict:
"Candidate Decision Log entry"
return {'Component': component, 'Decision': decision, 'Rationale': rationale, 'Date': date}

c = Client('claude-sonnet-4-5')
c.structured("Extract a decision from: We chose React for the frontend on Dec 1.", decision_f)

KeyError: 'decision_F'
```

_Traceback_

The error occurs in [toolslm.funccall.call_func](https://answerdotai.github.io/toolslm/funccall.html#call_func) when looking up o.name in the namespace — the name comes directly from Claude's API response with altered casing.

_Behavior change_

The minimal example above does *not* fail, I haven't found a minimal example that reliably fails. A fully implemented application was working reliably for several weeks across dozens of calls. Failures started occurring often in the last 24 hours, suggesting a possible model-side change. For full code and full failure traceback see [this dialogue](https://share.solve.it.com/d/dfa63d1292dbb0977fb74f2f05b27b08).

_Possible fix?_

Case-insensitive lookup when matching tool names to functions in the namespace.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at Client.structured and toolslm.funccall.call_func, where the returned o.name is looked up in the namespace. Review the linked full traceback and dialogue because the minimal example does not reproduce the failure. Done means a tool name that differs only in capitalization resolves without a KeyError while exact-name calls continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.