Skip to content

fix chroma only retrieving one source#132

Merged
dharhas merged 2 commits intomainfrom
fix-chroma
Oct 29, 2023
Merged

fix chroma only retrieving one source#132
dharhas merged 2 commits intomainfrom
fix-chroma

Conversation

@pmeier
Copy link
Member

@pmeier pmeier commented Oct 29, 2023

Offline report from @dharhas.

@pmeier pmeier requested a review from pavithraes October 29, 2023 21:07
)

num_results = len(result["ids"])
num_results = len(result["ids"][0])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual fix. For some reason, result["ids"] is a list, which contains nothing but another list, which ultimately holds the IDs we are after here.

# dict of lists -> list of dicts
results = [
{key: value[idx] for key, value in result.items()}
{key[:-1]: value[idx] for key, value in result.items()}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring the last character here drops the "s" and thus makes the keys singular. Might sound nitpicky here, but I found myself confused when looking at the source again and having something like id=result["ids"] in the Source instantiation below.

@dharhas dharhas self-requested a review October 29, 2023 22:37
@dharhas dharhas merged commit 223aa4c into main Oct 29, 2023
@dharhas dharhas deleted the fix-chroma branch October 29, 2023 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants