Skip to content

Vector API: awkward to get hold of matching chunks #673

@jazzm0

Description

@jazzm0

Describe the Problem

When using

public VectorSearchResults search(
      @Nonnull final String aiResourceGroup, @Nonnull final TextSearchRequest textSearchRequest)
      throws OpenApiRequestException

the VectorSearchResults are too deeply nested. To access the actual matching chunks someone has to do the following:

        var context = new StringBuilder();

        searchResult.getResults().forEach(r -> {
            r.getResults().forEach(
                    s -> s.getDocuments().forEach(
                            d -> d.getChunks().forEach(
                                    c -> {
                                        context.append(c.getContent());
                                    })));
        });

This makes the usage unnecessarily complex.

Propose a Solution

I would expect a Collection<VectorChunk> objects from the searchResult object, so they can be used directly in inference afterwards.

Describe Alternatives

No response

Affected Development Phase

Development

Impact

Inconvenience

Timeline

No response

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