Skip to content

add-moderation-api-support: any-llm-ts#3

Merged
tbille merged 12 commits into
mainfrom
add-moderation-api-support
Apr 17, 2026
Merged

add-moderation-api-support: any-llm-ts#3
tbille merged 12 commits into
mainfrom
add-moderation-api-support

Conversation

@tbille
Copy link
Copy Markdown
Member

@tbille tbille commented Apr 17, 2026

Summary

Implementation for add-moderation-api-support in any-llm-ts.

Changes

  • Final uncommitted changes for add-moderation-api-support
  • Apply biome organizeImports and drop unused ignore comments
  • Document moderation method and UnsupportedCapabilityError
  • Add unit tests for moderation method
  • Tolerate status-prefixed messages in unsupported-capability detection
  • Export moderation types and UnsupportedCapabilityError
  • Add moderation method with includeRaw raw-fetch path
  • Map unsupported-capability 400s to UnsupportedCapabilityError
  • Add UnsupportedCapabilityError class
  • Add moderation types and extension interfaces

Testing

  • See commit history for test additions.

tbille added 10 commits April 17, 2026 16:15
Capture baseURL, apiKey, and platformToken on the client instance so
raw fetch calls can reuse gateway routing and auth. Refactor
handleError so the unsupported-capability mapping surfaces in both
platform and non-platform modes (a logical error, not an auth
concern), while the remaining status mappings stay platform-only.
The default path delegates to openai.moderations.create. When the
caller passes { includeRaw: true }, the method bypasses the OpenAI
SDK (which strips unknown fields) and POSTs directly to
/v1/moderations?include_raw=true so the provider's raw body can be
preserved on each result.
OpenAI's APIError prepends the HTTP status to the server's detail
string (for example '400 Provider anthropic does not support
moderation'), which broke the previous startsWith-based parser and
missed the 'multimodal moderation' phrasing. Switch to regex-based
detection so both the plain and multimodal variants map correctly
regardless of any status prefix.
@tbille tbille force-pushed the add-moderation-api-support branch from 4b3fdfd to e33a795 Compare April 17, 2026 14:23
Comment thread AGENTS.md Outdated
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this file should be removed. Part of this PR remove the file.

@tbille tbille merged commit 53d9e28 into main Apr 17, 2026
5 checks passed
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