RetrieverEvaluator
to evaluate the quality of different embeddings. The evaluation process involves comparing the quality of retrieved results from the ground-truth context for any given question. The metrics observed during this process are Hit-Rate and MRR (Mean-Reciprocal-Rank) source ().import nest_asyncio from llama_index.core.evaluation import generate_question_context_pairs from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.core.node_parser import SentenceSplitter from llama_index.llms.openai import OpenAI from llama_index.embeddings.cohere import CohereEmbedding nest_asyncio.apply()
nest_asyncio
is a Python library that solves the problem of running asynchronous tasks in environments that do not natively support them, such as Jupyter notebooks or Python's interactive shell. It allows you to use Python's asyncio
library in these environments.nest_asyncio
is used to allow asynchronous operations to run within Jupyter notebooks. This is particularly useful when working with LlamaIndex's asynchronous operations such as creating an index, querying, or running evaluations.import nest_asyncio nest_asyncio.apply()
nest_asyncio
. FastAPI is built on Starlette for the web parts and Pydantic for the data parts, both of which natively support asynchronous operations. async
and await
keywords, which are used to define coroutine functions in Python. These keywords are part of Python's asyncio
library, which allows for asynchronous I/O operations, and they're natively supported in FastAPI. async
and await
for your asynchronous operations without needing to use nest_asyncio
.from fastapi import FastAPI app = FastAPI() @app.get("/") async def read_root(): return {"Hello": "World"}
read_root
is an asynchronous function that FastAPI can run concurrently with other functions, improving the overall performance of your application.AttributeError: 'NoneType' object has no attribute 'search'
, suggests that the _aclient
attribute of your QdrantVectorStore
instance is None
at the time when the search
method is called. This usually happens when the QdrantVectorStore
instance is not properly initialized.QdrantVectorStore
instance. Here is an example of how to do it:from llama_index.vector_stores.qdrant import QdrantVectorStore vector_store = QdrantVectorStore(host="localhost", port=6333, collection_name="my_collection")
"localhost"
and 6333
with your Qdrant server's host and port, and "my_collection"
with the name of your collection._aclient
attribute will not be properly initialized.nest_asyncio.apply()
to enable nested event loops.