list index out of range error if similarity search gives 0 docs
https://github.com/hwchase17/langchain/blob/276940fd9babf8aec570dd869cc84fbca1c766bf/langchain/vectorstores/milvus.py#L319
I'm using milvus where for my question I'm getting 0 documents and so index out of range error occurs
Error line: https://github.com/hwchase17/langchain/blob/276940fd9babf8aec570dd869cc84fbca1c766bf/langchain/chains/llm.py#L95
19
Hi what's your input for llm and how do you build your chain, could you offer more information
+1 getting this using the following:
from langchain.chains import RetrievalQA
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0)
chroma_retriever = db.as_retriever(k=3)
qa = RetrievalQA.from_chain_type(llm=llm,
chain_type="map_reduce",
retriever=chroma_retriever,
+1 have the same error
Code to reproduce:
def create_llm(agent):
persist_directory = 'db'
vector_db = Chroma(persist_directory=persist_directory, embedding_function=embedding)
retriever = vector_db.as_retriever(search_type='similarity', search_kwards={'k': 4})
embeddings_filter = EmbeddingsFilter(embeddings=embedding, similarity_threshold=0.76)
compression_retriever = ContextualCompressionRetriever(base_compressor=embeddings_filter, base_retriever=retriever)
qa_chain = RetrievalQAWithSourcesChain.from_llm(ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo"),
retriever=compression_retriever)
return qa_chain
def chat(inp, history, agent):
history = history or []
log.debug("\n==== date/time: " + str(datetime.datetime.now()) + " ====")
log.debug("inp: " + inp)
history = history or []
output = agent({"question": inp, "chat_history": history})
answer = output["answer"]
history.append((inp, answer))
log.debug(history)
return history, history
Error:
if "stop" in input_list[0]:
IndexError: list index out of range
+1 on this error. I don't seem to be getting the error when the chain_type = 'stuff'. It comes up for map_reduce, map_rerank and refine.
+1 getting this using the following:
from langchain.chains import RetrievalQA from langchain.chat_models import ChatOpenAI llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0) chroma_retriever = db.as_retriever(k=3) qa = RetrievalQA.from_chain_type(llm=llm, chain_type="map_reduce", retriever=chroma_retriever,
Hello, is this problem solved?
+1 on this error. I don't seem to be getting the error when the chain_type = 'stuff'. It comes up for map_reduce, map_rerank and refine.
Hello, is this problem solved?
https://github.com/hwchase17/langchain/blob/276940fd9babf8aec570dd869cc84fbca1c766bf/langchain/vectorstores/milvus.py#L319
I'm using milvus where for my question I'm getting 0 documents and so index out of range error occurs
Error line:
https://github.com/hwchase17/langchain/blob/276940fd9babf8aec570dd869cc84fbca1c766bf/langchain/chains/llm.py#L95
Hello, is this problem solved?