index = VectorStoreIndex([], ....) for doc in documents: try: index.insert(doc) except: ...
llm = OpenAI(model="gpt-4")
chunk_sizes = [128, 256, 512, 1024]
service_contexts = []
nodes_list = []
vector_indices = []
query_engines = []
for chunk_size in chunk_sizes:
print(f"Chunk Size: {chunk_size}")
service_context = ServiceContext.from_defaults(chunk_size=chunk_size, llm=llm)
service_contexts.append(service_context)
nodes = service_context.node_parser.get_nodes_from_documents(documents)
....
node_parser = SimpleNodeParser()
service_context = ServiceContext.from_defaults(chunk_size=chunk_size, llm=llm, node_parser=node_parser)
nodes = await retriever.aretrieve(
"Who founded MyCase?"
)
There are 0 selections, please use .inds.
The above exception was the direct cause of the following exception:
ValueError: Failed to select retriever
from_defaults
function. I'm surprised this fixes your issue haharetriever = RouterRetriever( selector=PydanticMultiSelector.from_defaults(llm=llm, max_outputs=4), retriever_tools=retriever_tools, )
from llama_index.selectors import LLMMultiSelector retriever = RouterRetriever( selector=LLMMultiSelector.from_defaults(service_context=service_context, max_outputs=4), retriever_tools=retriever_tools, )