ValueError: Invalid query mode: hybridI am running into an error where I cannot seem to query/retrieve a Vector Store Index with the query mode "hybrid". I believe it may be because I'm just using a simple vector store built from the
Documents.example()
function.
My code:
## setup
@pytest.fixture
def setup() -> dict:
os.environ["OPENAI_API_KEY"] = str(settings.openai_api_key)
service_context = ServiceContext.from_defaults(
embed_model=OpenAIEmbedding(
model="text-embedding-ada-002"
),
llm=OpenAI(
model="gpt-3.5-turbo"
)
)
shots = AlphaMatrix(data=DEFAULT_CATEGORIES)
vector_index = VectorStoreIndex.from_documents(
[Document.example()]
, service_context=service_context
)
reranker = LLMRerank(service_context=service_context)
retriever = CustomRetriever(
index=vector_index,
llm=service_context.llm,
reranker=reranker,
matrix=shots,
verbose=True,
)
return {
"retriever": retriever,
"service_context": service_context,
"vector_index": vector_index,
"matrix": shots,
}
#Where the error occurs:
retriever = VectorIndexRetriever(
index=index,
vector_store_query_mode="hybrid",
alpha=default_alpha,
**kwargs, # filters, etc, added here
)
def test_retrieve(setup):
retriever = setup.get("retriever")
query = "What are LLMs good at?"
results = retriever.retrieve(query)
Error:
ValueError: Invalid query mode: hybrid