Skip to content

Vertex AI MCP client fails on Reactive runtime #2649

Open
@sidutti

Description

@sidutti

The VertexAiGeminiChatModel does not subscribe on bounded elastic and fail as .block() gets called in the MCP client implementation.

This has been addressed for few models in this issue with commit.

Can the same be applied to VertexAI as well?
Proposed change:
in the method internalStream

Flux<ChatResponse> chatResponse1 = Flux.fromStream(responseStream.stream())
		.switchMap(response2 -> Mono.just(response2).map(response -> {
			List<Generation> generations = response.getCandidatesList()
				.stream()
				.map(this::responseCandidateToGeneration)
				.flatMap(List::stream)
				.toList();
		return new ChatResponse(generations, toChatResponseMetadata(response));
})).subscribeOn(Schedulers.bounderedElastic());

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions