yangjj-iso opened a new pull request, #7580: URL: https://github.com/apache/shenyu/pull/7580
AI Provider profiles currently lack explicit capability/operation validation and deployment-specific endpoint, credential, query, model and default-field settings. This change adds those settings to the existing Provider registry and reuses Connect for provider dialect and response conversion. Fixes #7383. - Add immutable `AiProviderCapabilities` and `OpenAiProviderOptions`, with protocol/operation declarations, streaming/tool/JSON/audio capability checks, header/query/no-auth credentials, encoded query parameters, operation paths, model aliases and missing-field defaults. - Carry the decoded operation in the ShenYu-owned request model. Validate capabilities before HTTP execution and against the final converted payload; reject dialects that change the selected streaming mode. Preserve unmapped fields and original bytes on identity adaptation. - Normalize OpenAI token limits to one `max_completion_tokens` field, including legacy/null handling and gateway overrides. Generic compatible profiles preserve field choices or select an explicit token dialect. DeepSeek retains Connect's token/thinking/tool adaptation and reasoning/usage response conversion, adds Chat capability restrictions, and resolves root/versioned/beta endpoints. - Register the generic `OpenAICompatible` identifier alongside all existing identifiers. Custom profiles work through Spring beans or the collection-based registry without changing Engine, Protocol or Transport. Preserve the existing `OpenAi(ProviderProfile)` constructor; Provider implementations use no Spring AI clients/DTOs or HTTP execution/retry/pool logic. - Document profile selection, capability limits, extension examples, model/default precedence and token-field migration in the AI Proxy README. Validation: - Complete AI Common, AI Proxy and AI Proxy starter suites passed: 37 + 142 + 3 = 182 tests, with no failures or skips. The selected reactor and its dependency tests passed with `./mvnw -B -ntp -T 4 -pl shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-ai-proxy -am test -DskipRemoteResources=true -Djacoco.skip=true`. - New tests cover authentication, endpoint/query encoding, model/default precedence, unknown fields, immutable options, token mapping, unsupported operations/features, DeepSeek differences, actual HTTP requests and Responses SSE reasoning/usage conversion, and Spring extension discovery. Existing retry/fallback/cancellation/error passthrough tests pass. - Full reactor `./mvnw -B -ntp -T 4 clean install -DskipTests -Dmaven.javadoc.skip=true -DskipRemoteResources=true -Djacoco.skip=true` passed, including Checkstyle and Apache RAT. HTTP integration uses local upstream fixtures; live vendor APIs were not invoked. Provider capabilities describe a service/profile and may be narrowed for individual models or deployments. OpenAI token normalization and DeepSeek Chat restrictions are documented behavior changes; native Responses upstreams remain outside this change. - [x] Contribution guidelines reviewed. - [x] Regression tests included. - [x] Full build and relevant tests passed as detailed above. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
