ChromaDB retrieves irrelevant context
Labels: name: area: embeddings, name: area: vector store, name: auto:bug, name: integration: chroma

### Issue you'd like to raise.

I followed the tutorial at [Code Understanding](https://python.langchain.com/docs/use_cases/code_understanding), loaded a small directory of test files into the db, and asked the question:

`Ask a question: what ways would you simplify e2e_btc_mint_2auto.test.js?`
The retriever, which was setup as follows, actually gave every file in the directory except `e2e_btc_mint_2auto.test.js` to ChatGPT! Why is ChromaDB so _bad_?

```
# Load
loader = GenericLoader.from_filesystem(
    repo_path,
    glob="**/*",
    suffixes=[".js"],
    parser=LanguageParser(language=Language.JS, parser_threshold=500) # Currently, the supported languages for code parsing are Python and JavaScript. 
    # Source https://api.python.langchain.com/en/latest/document_loaders/langchain.document_loaders.parsers.language.language_parser.LanguageParser.html
)
documents = loader.load()
# print("# of documents", len(documents))

go_splitter = RecursiveCharacterTextSplitter.from_language(language=Language.JS, 
                                                               chunk_size=2000, 
                                                               chunk_overlap=200)
texts = go_splitter.split_documents(documents)
# print("# of split documents (texts)", len(texts))

def chatgpt(texts):
    db = Chroma.from_documents(texts, OpenAIEmbeddings(disallowed_special=()))
    retriever = db.as_retriever(
        search_type="mmr", # Also test "similarity"
        search_kwargs={"k": 8},
    )

    llm = ChatOpenAI(model_name="gpt-4")
    return db, retriever, llm

def llama(texts) -> LlamaCpp:
    db = Chroma.from_documents(texts, LlamaCppEmbeddings(model_path=model_path))
    retriever = db.as_retriever(
        search_type="mmr", # Also test "similarity"
        search_kwargs={"k": 8},
    )

    llm = LlamaCpp(
        model_path=model_path,
        n_gpu_layers=0,
        n_batch=512,
        n_ctx=2048,
        f16_kv=True,  
        callback_manager=CallbackManager([StreamingStdOutCallbackHandler()]),
        verbose=False)
    return db, retriever, llm

if args.llama:
    db, retriever, llm = llama(texts)
else:
    db, retriever, llm = chatgpt(texts)

memory = ConversationSummaryMemory(llm=llm,memory_key="chat_history",return_messages=True)
qa = ConversationalRetrievalChain.from_llm(llm, retriever=retriever, memory=memory)

print("going to ask some questions now")
while True:
    question = input("Ask a question: ")
    if not question:
        break
    documents = retriever.get_relevant_documents(question)
    pp(documents)
    result = qa(question)
    print(f"-> **Question**: {question} \n")
    print(f"**Answer**: {result['answer']} \n")
```
Output
```
[Document(page_content="...", metadata={'language': 'js', 'source': '/home/shinichi/source/go/src/github.com/dove-foundation/dove/test/src/e2e_btc_mint_1basic.test.js'}),
 Document(page_content="...", metadata={'language': 'js', 'source': '/home/shinichi/source/go/src/github.com/dove-foundation/dove/test/src/e2e.test.js'}),
 Document(page_content="...", metadata={'language': 'js', 'source': '/home/shinichi/source/go/src/github.com/dove-foundation/dove/test/src/e2e_btc_transfer.test.js'}),
 Document(page_content="...", metadata={'language': 'js', 'source': '/home/shinichi/source/go/src/github.com/dove-foundation/dove/test/src/archive/e2e_followup_auto.test.js'}),
 Document(page_content="...", metadata={'language': 'js', 'source': '/home/shinichi/source/go/src/github.com/dove-foundation/dove/test/src/e2e_slashing.test.js'}),
 Document(page_content="...", metadata={'language': 'js', 'source': '/home/shinichi/source/go/src/github.com/dove-foundation/dove/test/src/e2e_evm.test.js'}),
 Document(page_content="...", metadata={'language': 'js', 'source': '/home/shinichi/source/go/src/github.com/dove-foundation/dove/test/src/e2e_recharge.test.js'}),
 Document(page_content="...", metadata={'language': 'js', 'source': '/home/shinichi/source/go/src/github.com/dove-foundation/dove/test/src/e2e_reshare.test.js'})]
```



### Suggestion:

The very least ChromaDB could do is search the metadata.source for string matches.