Skip to content

Incompatible error in the "before" method of RetrievalAugmentationAdvisor #5124

@fangyan123123

Description

@fangyan123123

Bug description
java.lang.IllegalStateException: Duplicate key Query[text=你是谁, history=[], context={}] (attempted merging values [[]] and [[]])

Environment
spring-ai: 1.1.2
jdk: 17

Steps to reproduce
If I customize the queryExpander, when executing the queryExpander to add historical queries to the List, if there are duplicates in my historical queries, an error will occur in the following line: Map<Query, List<List<Document>>> documentsForQuery = (Map)expandedQueries.stream().map((query) -> CompletableFuture.supplyAsync(() -> this.getDocumentsForQuery(query), this.taskExecutor)).toList().stream().map(CompletableFuture::join).collect(Collectors.toMap(Map.Entry::getKey, (entry) -> List.of((List)entry.getValue())));

Expected behavior
Add (v1, v2) -> v2 after toMap

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions