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.
What should we do?
Replace the
AiFrameworkAdapterabstraction with a new SPI underframework/api/and routeBaseAgentRequestHandlerthrough it.ChatClient,ChatClientResult,ChatModelApi,ChatModelApiFactory<C extends ProviderConfiguration>,ChatModelApiRegistry,ChatRequest,ChatResponse,ChatOptions,ModelCapabilities,ChatStreamListener,ChatModelEventsealed hierarchy,CacheRetention,ReasoningConfig.BaseAgentRequestHandlerinvokesChatClient.chat(...)and consumesChatClientResultinstead ofAiFrameworkChatResponse.Langchain4JChatModelApiFactorybean per provider discriminator. Each bridge bean returns a conservative hardcodedModelCapabilitiesfromcapabilities().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.