Skip to content

Introduce ChatClient + ChatModelApi SPI with LangChain4j bridge #7216

@maff

Description

@maff

What should we do?

Replace the AiFrameworkAdapter abstraction with a new SPI under framework/api/ and route BaseAgentRequestHandler through it.

  • New SPI types: ChatClient, ChatClientResult, ChatModelApi, ChatModelApiFactory<C extends ProviderConfiguration>, ChatModelApiRegistry, ChatRequest, ChatResponse, ChatOptions, ModelCapabilities, ChatStreamListener, ChatModelEvent sealed hierarchy, CacheRetention, ReasoningConfig.
  • BaseAgentRequestHandler invokes ChatClient.chat(...) and consumes ChatClientResult instead of AiFrameworkChatResponse.
  • LangChain4j is wired as the only implementation in this issue, via one Langchain4JChatModelApiFactory bean per provider discriminator. Each bridge bean returns a conservative hardcoded ModelCapabilities from capabilities().

End-to-end behavior is unchanged after this issue. The point is to swap the abstraction layer, not the behavior.

Why should we do it?

Lays the SPI foundation that every subsequent native implementation registers against. Doing the cutover as a behavior-preserving step keeps each later native impl reviewable on its own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentic-aikind:taskCategorizes an issue or PR as general maintenance, i.e. cleanup, refactoring, etc.

    Type

    Urgency

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions