feat: add OpenAI, Anthropic, and Gemini LLM interceptors#1
Merged
Conversation
Add transparent governance integration for LLM providers: - OpenAIInterceptor: Wraps OpenAI chat completion calls with policy enforcement and audit logging - AnthropicInterceptor: Wraps Anthropic message creation calls with policy enforcement and audit logging Features: - Sync and async (CompletableFuture) support - Configurable async audit logging - PolicyViolationException for blocked requests - Static wrapper methods for one-off calls - Complete type definitions for request/response handling Includes comprehensive tests (27 new tests) using WireMock.
Add new LLM provider interceptors for: - Ollama: Local LLM server support with chat and generate methods - AWS Bedrock: Multi-model support (Claude, Titan, Llama) with IAM auth Both interceptors include: - Policy pre-check with executeQuery - Token usage tracking and audit logging - Builder patterns and async support
- Import PolicyViolationException from exceptions package - Use TokenUsage.of() instead of non-existent builder pattern
- Move jacoco rules to plugin-level config so standalone check works - Lower coverage threshold from 70% to 50% temporarily - New interceptors need tests to restore threshold
- Add GeminiInterceptorTest with type tests and integration tests - Add OllamaInterceptorTest with type tests and integration tests - Add BedrockInterceptorTest with type tests and integration tests - Add AdditionalTypesTest for PolicyInfo, HealthStatus, ConnectorResponse, TokenUsage, Mode, RequestType, RateLimitInfo, ConnectorInfo, ConnectorQuery, and AuditResult - Update coverage threshold from 50% to 70% Coverage increased from 54.9% to 81.9%. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
saurabhjain1592
added a commit
that referenced
this pull request
Dec 19, 2025
* feat(interceptors): add OpenAI and Anthropic LLM interceptors Add transparent governance integration for LLM providers: - OpenAIInterceptor: Wraps OpenAI chat completion calls with policy enforcement and audit logging - AnthropicInterceptor: Wraps Anthropic message creation calls with policy enforcement and audit logging Features: - Sync and async (CompletableFuture) support - Configurable async audit logging - PolicyViolationException for blocked requests - Static wrapper methods for one-off calls - Complete type definitions for request/response handling Includes comprehensive tests (27 new tests) using WireMock. * feat(interceptors): add Gemini interceptor for Google Generative AI * feat(interceptors): add Ollama and Bedrock interceptors Add new LLM provider interceptors for: - Ollama: Local LLM server support with chat and generate methods - AWS Bedrock: Multi-model support (Claude, Titan, Llama) with IAM auth Both interceptors include: - Policy pre-check with executeQuery - Token usage tracking and audit logging - Builder patterns and async support * fix(interceptors): fix imports and TokenUsage usage - Import PolicyViolationException from exceptions package - Use TokenUsage.of() instead of non-existent builder pattern * fix(ci): fix jacoco configuration and lower coverage threshold - Move jacoco rules to plugin-level config so standalone check works - Lower coverage threshold from 70% to 50% temporarily - New interceptors need tests to restore threshold * test: add comprehensive tests for interceptors and types - Add GeminiInterceptorTest with type tests and integration tests - Add OllamaInterceptorTest with type tests and integration tests - Add BedrockInterceptorTest with type tests and integration tests - Add AdditionalTypesTest for PolicyInfo, HealthStatus, ConnectorResponse, TokenUsage, Mode, RequestType, RateLimitInfo, ConnectorInfo, ConnectorQuery, and AuditResult - Update coverage threshold from 50% to 70% Coverage increased from 54.9% to 81.9%.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added LLM interceptors for transparent governance integration with popular AI providers.
Features
OpenAI Interceptor
Anthropic Interceptor
Gemini Interceptor
Test Results
Files Changed
interceptors/OpenAIInterceptor.java- OpenAI governance wrapperinterceptors/AnthropicInterceptor.java- Anthropic governance wrapperinterceptors/GeminiInterceptor.java- Gemini governance wrapperinterceptors/ChatCompletionRequest.java- Request typesinterceptors/ChatCompletionResponse.java- Response typesinterceptors/ChatMessage.java- Message typeOpenAIInterceptorTest.java,AnthropicInterceptorTest.java