Skip to content

Error: Index isn't ready #519

Open
Open
@thepowerfulwoz

Description

When constructing a basic hybrid router, and then calling it the error "Index is not ready" is thrown. My initial code was as follows:

encoder = HuggingFaceEncoder()
sparse_encoder = BM25Encoder()
index = HybridLocalIndex()
rl = HybridRouter(encoder=encoder, sparse_encoder=sparse_encoder, routes=routes, index=index)

print(rl("Get me an image of ships in the bay"))

After reading through the code and finding the is_ready() function, as well as looking through the index.add() function, I then attempted:

for route in routes:
    index.add(embeddings=encoder(route.utterances), routes=[route.name], utterances=route.utterances, sparse_embeddings=sparse_encoder(route.utterances))
    print(route.utterances)
print(index.get_routes())

This, however, both threw IndexError: index 41 is out of bounds for axis 0 with size 4, and only added the first utterance to the list of utterances.

It is very possible that I am missing something obvious, but I would appreciate some guidance on how to move forward.

Thanks in advance!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions