Find answers from the community

Updated last year

Hey All

Hey All!

Is the MongoDB guide broken? here:
https://gpt-index.readthedocs.io/en/latest/examples/vector_stores/MongoDBAtlasVectorSearch.html

My code is here:
Plain Text
# Provide URI to constructor, or use environment variable

from markdown import Markdown
import pymongo
from llama_index.vector_stores.mongodb import MongoDBAtlasVectorSearch
from llama_index.indices.vector_store.base import VectorStoreIndex
from llama_index.storage.storage_context import StorageContext
from llama_index.readers.file.base import SimpleDirectoryReader

mongo_uri = "mongodb+srv://<username>:<password>@<host>/?retryWrites=true&w=majority"

mongodb_client = pymongo.MongoClient(mongo_uri)
store = MongoDBAtlasVectorSearch(mongodb_client)
storage_context = StorageContext.from_defaults(vector_store=store)
silva_docs = SimpleDirectoryReader(input_files=["data/Anderson_Silva.pdf"]).load_data()

index = VectorStoreIndex.from_documents(silva_docs, storage_context=storage_context)

response = index.as_query_engine().query("When was Anderson Silva born?")
print(f"<b>{response}</b>")


But all I got is this:

Plain Text
python3 main.py 
<b>None</b>
B
L
10 comments
my llama is up to date:

Plain Text
pip show llama-index
Name: llama-index
Version: 0.8.21
Summary: Interface between LLMs and your data
and I can even see some embeddings in my default_db.default_collection

on my Atlas cluster--just a snippet:

Plain Text
_id
64f925142fcb48f3ce08145b
id
"f37888d5-4b17-4196-8eb4-f76e51ee0f3e"

embedding
Array
0
-0.02008351869881153
1
-0.00473610358312726
2
-0.007173654157668352
3
0.003149491734802723
4
0.006041328888386488
5
-0.00047971270396374166
6
-0.014116775244474411
7
-0.0012314886553213
8
-0.03010493889451027
9
-0.026755424216389656
10
0.001365401316434145
11
0.04260798171162605
The bigger version is here:
I even tried this:

Plain Text
silva_docs = SimpleDirectoryReader(input_files=["data/Anderson_Silva.pdf"]).load_data()
print(silva_docs[:10])


and can confirm the doc got loaded:

Plain Text
python3 main.py 
[Document(id_='0298945e-39e3-4584-bc8d-70ad8b55b0c8', embedding=None, metadata={'page_label': '1', 'file_name': 'Anderson_Silva.pdf'}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={}, hash='1093a3ddb5d2fe89710755177565d8f46177f1908ee7b2e5397fdea231a89c07', text='Anderson Silva\nSilva in 2012\nBorn Anderson da\nSilva[1]\n14 April 1975\nSΓ£o Paulo,\nBrazil[2]\nOther names The Spider\nResidence Los Angeles,\nCalifornia, United\nStates[3]\nNationality Brazilian\nAmerican[4]\nHeight 6 ft 2 in (1.88 m)\nWeight 185 lb (84 kg;\n13.2 st)\nDivision Middleweight\nLight\nHeavyweight\nReach 771⁄2[5] in\n(197 cm)\nFighting out ofCuritiba, Brazil\nTeam Chute Boxe\nAcademy (1997–\n2003)\nMuay Thai Dream\nTeam (2003–\n2006)[6]\nBrazilian Top\nTeam (2003–\n2006)\nBlack House\n(2007–2013)\nTeam Nogueira[7]\nKiller Bees Muay\nThai College\n(Founded/Current\nTeam)[8]Anderson Silva\nAnderson da Silva[1] (Portuguese pronunciation: [ΛˆΙΜƒdeʁ sΓ΅ ˈ siwv ɐ ]; born 14 April 1975)  is a\nBrazilian mixed martial artist and boxe r. He is a former UFC Middleweight Champion and holds\nthe record for 
Did you enable the search index in the atlas GUI? Its a manual step after the index is created (and tbh I would not recommend this db right now due to mongo requiring that manual step)


https://www.mongodb.com/docs/atlas/atlas-search/create-index/#create-an-fts-index-using-the-service-ui
I've explained it a few times on discord here -- if you search for atlas you'll probably find it LOL
gosh I am mega late to the party πŸ˜‚ and why ya'll moving so damn fast! πŸͺ¦ 😭
Is there a DB you recommend good ser?
For hosting yourself, qdrant and chroma are popular

For cloud hosting, pinecone and weaviate are also popular
Thank you very much Giga-RAG-Chad πŸ™
Add a reply
Sign up and join the conversation on Discord