Skip to content

[add-moderation-api-support] Locked phrasing — cross-SDK error contract. Do not reword.#52

Open
tbille wants to merge 9 commits intomainfrom
add-moderation-api-support
Open

[add-moderation-api-support] Locked phrasing — cross-SDK error contract. Do not reword.#52
tbille wants to merge 9 commits intomainfrom
add-moderation-api-support

Conversation

@tbille
Copy link
Copy Markdown
Contributor

@tbille tbille commented Apr 17, 2026

Summary

Implementation for add-moderation-api-support in gateway.

Changes

  • Final uncommitted changes for add-moderation-api-support
  • Regenerate OpenAPI spec for /v1/moderations route
  • Import moderation types from gateway-local module in tests
  • Fix moderations route import against older any-llm-sdk
  • Add local ModerationResponse/ModerationResult types
  • Document /v1/moderations in README API surface
  • Add integration tests for /v1/moderations endpoint
  • Register moderations router in standalone mode
  • Add moderations route mirroring /v1/embeddings

Testing

  • See commit history for test additions.

tbille added 9 commits April 17, 2026 15:56
Define gateway-local Pydantic moderation types as a compatibility shim
so the moderations route remains importable against any-llm-sdk
releases that predate the moderation API. When a future SDK ships
native moderation types, they transparently take precedence.
The route imported `amoderation` and `ModerationResponse` unconditionally
from any_llm, causing an ImportError at gateway startup on SDK releases
that do not yet ship moderation support.

Switch to the gateway-local `ModerationResponse` type and import
`amoderation` inside a try/except that falls back to a stub raising
`NotImplementedError`. The stub routes through the existing locked
400 error contract, so behavior is unchanged when the SDK provides
moderation natively.
Match the route's import source so the test file loads regardless of
whether the installed any-llm-sdk exposes moderation types.
@tbille tbille temporarily deployed to integration-tests April 17, 2026 14:11 — with GitHub Actions Inactive
Comment thread AGENTS.md
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file

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