Skip to content

feat(llmgw): add decisions.create() for the gateway's /v1/decisions - #292

Draft
dmorrissey-aai wants to merge 1 commit into
masterfrom
dmorrissey/llmgw-decisions
Draft

dmorrissey-aai wants to merge 1 commit into
masterfrom
dmorrissey/llmgw-decisions

Conversation

@dmorrissey-aai

Copy link
Copy Markdown
Contributor

Adds gateway.decisions.create() to LLMGateway and AsyncLLMGateway. It calls the gateway's POST /v1/decisions, which answers predicate, choice, and score questions about an input.

  • Request: questions are plain dicts typed by LLMGatewayDecisionQuestionParam. Optional settings are named in the signature so IDEs show them, and any other kwarg is forwarded unchanged. The gateway rejects unknown fields itself.
  • Response: LLMGatewayDecisionResponse / LLMGatewayDecisionAnswer. It has its own usage model, because decisions doesn't return prompt_tokens/completion_tokens. probabilities[].value is typed Any: on pydantic v1, a Union[str, int] would coerce one of the two.
  • Tests and docs: unit tests for sync and async; examples in CLAUDE.md and README.md.

Testing

  • Unit suite passes on pydantic 2 and on pydantic 1.10 (gateway tests).
  • Live run against production with gpt-6-luna:
    • sync and async calls, with both a string input and a list of input items
    • all three question types parsed, with choice values as str and level indexes as int
    • a 400 validation error and an unknown kwarg each surface as LLMGatewayError with .errors

🤖 Generated with Claude Code

- New `decisions` resource on LLMGateway/AsyncLLMGateway: TypedDict question param, named optionals for discoverability, extra kwargs forwarded as-is.
- Typed response models; probabilities[].value stays Any so pydantic v1 keeps str choice values and int level indexes.
- Unit tests (sync + async) and CLAUDE.md/README docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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