Class AsyncNotSupported

java.lang.Object
dev.langchain4j.internal.AsyncNotSupported

public final class AsyncNotSupported extends Object
Factory for the "not implemented" result of an asynchronous / reactive SPI default method.

The async and reactive SPI methods (e.g. ChatModel.doChatAsync, EmbeddingStore.searchAsync, StreamingChatModel.doChat(ChatRequest)) ship a default body for providers that have not opted into the non-blocking path. Rather than throwing AsyncNotSupportedException synchronously - which would escape the method's own return-type contract, so whether it is safe depends on whether the call site happened to be inside a future/publisher stage that launders the throw - the defaults signal the failure through their return type's error channel: a failed CompletableFuture for future-returning methods, or an immediately-failing Flow.Publisher for publisher-returning methods. The framework's offload-or-fail-loud orchestration then observes it uniformly (via exceptionallyCompose/onError), regardless of context.

This does not change genuine implementations, nor the public entry points (chatAsync, embedAsync, the AI-Service dispatch), which still convert their own synchronous validate(request) failures.

Since:
1.20.0