shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

[Task][AI Proxy] Extend and harden the AI Provider layer

Open hengyuss opened this issue 2 months ago • 2 comments

[Task][AI Proxy] Extend and harden the AI Provider layer

Parent issue: #7351

Depends on: #7381

Background

#7381 provides the initial OpenAI Provider request adapter. Additional OpenAI-compatible services can differ in endpoints, authentication, field support, model names, and response details even when they expose a similar protocol.

Goal

Complete Provider adaptation and capability handling without moving HTTP execution or client-protocol behavior into Provider implementations.

Scope

  • validate supported Protocols and operations;
  • resolve Provider endpoints and paths;
  • apply authentication, headers, and query parameters;
  • map model names and Provider defaults;
  • map fields such as max_tokens and max_completion_tokens;
  • declare and validate streaming, tool-calling, JSON-mode, and related capabilities where ShenYu needs them;
  • handle Provider-specific request and response differences;
  • preserve fields that do not require transformation;
  • add OpenAI-compatible and DeepSeek behavior, reusing a generic profile when a separate implementation is unnecessary.

The explicit Provider registry remains a supported extension mechanism. ShenYu SPI is not required unless non-Spring discovery becomes a demonstrated requirement.

Boundaries

Provider must not:

  • parse the original client request independently of Protocol;
  • write the client response;
  • establish or manage HTTP connections;
  • configure network timeouts or connection pools;
  • execute retry or fallback policy.

Acceptance criteria

  • [ ] OpenAI, OpenAI-compatible, and DeepSeek behavior uses the shared models.
  • [ ] Provider implementations do not depend on Spring AI clients or DTOs.
  • [ ] Protocol and operation compatibility can be validated.
  • [ ] Endpoint, authentication, headers, query parameters, and model mappings are applied by Provider.
  • [ ] Provider-specific request and response differences are handled without leaking HTTP execution into Provider code.
  • [ ] Unknown fields are preserved when no mapping is required.
  • [ ] Adding another Provider does not require changing AiProxyEngine, Protocol, or Transport.
  • [ ] Tests cover authentication, endpoint resolution, field mapping, capabilities, unsupported operations, and Provider-specific parameters.

hengyuss avatar Sep 30 '26 09:09 hengyuss

👋 Hello @yuluo-yx

A new issue has been opened by @hengyuss:

  • Title: [Task][AI Proxy] Implement the extensible AI Provider layer
  • Link: https://github.com/apache/shenyu/issues/7383

Please review when you have time. Thank you! 🙏

github-actions[bot] avatar Sep 30 '26 09:09 github-actions[bot]

Status after #7543: the merged implementation provides OpenAi plus named OpenAI-compatible profiles, shared models, authentication/endpoint/header adaptation, protocol support checks, and extension through the provider registry. Keeping this issue open because production Provider hardening remains: capability declarations and validation, provider-specific model/query/field mappings, unsupported-operation behavior, richer DeepSeek/OpenAI-compatible differences, and the corresponding focused tests.

hengyuss avatar Oct 11 '26 09:10 hengyuss