mongodb not working with fast-api backend (0.1.35) #34

Closed
opened 2026-02-15 19:15:21 -05:00 by yindo · 2 comments
Owner

Originally created by @aadnegture on GitHub (Aug 15, 2024).

Originally assigned to: @thucpn on GitHub.

I'm not getting the mongodb integration to work with fast-api.
Poetry run generate runs without errors, but with this output:

2272
Parsing nodes: 0it [00:00, ?it/s]
Generating embeddings: 0it [00:00, ?it/s]
INFO:root:Finished generating the index

Where 2272 is from adding a print of store._collection.estimated_document_count() in the get_vector_store function. So the connection seems fine.

When calling the api it doesn't retrieve any nodes at all:

8:[{"type": "sources", "data": {"nodes": []}}]
the logs of the api looks like this:

INFO:     127.0.0.1:64494 - "OPTIONS /api/chat HTTP/1.1" 200 OK
INFO:     Creating chat engine with filters: filters=[MetadataFilter(key='private', value='true', operator=<FilterOperator.NE: '!='>)] condition=<FilterCondition.AND: 'and'>    
INFO:     Connecting vector store...
2272
INFO:     Finished load index from vector store.
INFO:     127.0.0.1:64494 - "POST /api/chat HTTP/1.1" 200 OK
Originally created by @aadnegture on GitHub (Aug 15, 2024). Originally assigned to: @thucpn on GitHub. I'm not getting the mongodb integration to work with fast-api. Poetry run generate runs without errors, but with this output: ``` 2272 Parsing nodes: 0it [00:00, ?it/s] Generating embeddings: 0it [00:00, ?it/s] INFO:root:Finished generating the index ``` Where 2272 is from adding a print of `store._collection.estimated_document_count()` in the get_vector_store function. So the connection seems fine. When calling the api it doesn't retrieve any nodes at all: `8:[{"type": "sources", "data": {"nodes": []}}] ` the logs of the api looks like this: ``` INFO: 127.0.0.1:64494 - "OPTIONS /api/chat HTTP/1.1" 200 OK INFO: Creating chat engine with filters: filters=[MetadataFilter(key='private', value='true', operator=<FilterOperator.NE: '!='>)] condition=<FilterCondition.AND: 'and'> INFO: Connecting vector store... 2272 INFO: Finished load index from vector store. INFO: 127.0.0.1:64494 - "POST /api/chat HTTP/1.1" 200 OK ```
yindo closed this issue 2026-02-15 19:15:21 -05:00
Author
Owner

@marcusschiesser commented on GitHub (Aug 19, 2024):

@aadnegture I guess that the metadata filters are not working with MongoDB. Can you please try:

filters = None  # generate_filters(doc_ids)

in chat.py and let me know if that works?

@marcusschiesser commented on GitHub (Aug 19, 2024): @aadnegture I guess that the metadata filters are not working with MongoDB. Can you please try: ``` filters = None # generate_filters(doc_ids) ``` in `chat.py` and let me know if that works?
Author
Owner

@marcusschiesser commented on GitHub (Aug 27, 2024):

@aadnegture the problem is that you need to create the index in MongoDB, see https://github.com/run-llama/llama_index/blob/332d2b9e71acefa166355760c4bf391aa1f3fa48/llama-index-integrations/vector_stores/llama-index-vector-stores-mongodb/llama_index/vector_stores/mongodb/base.py#L54-L72

This is currently not done automatically

@marcusschiesser commented on GitHub (Aug 27, 2024): @aadnegture the problem is that you need to create the index in MongoDB, see https://github.com/run-llama/llama_index/blob/332d2b9e71acefa166355760c4bf391aa1f3fa48/llama-index-integrations/vector_stores/llama-index-vector-stores-mongodb/llama_index/vector_stores/mongodb/base.py#L54-L72 This is currently not done automatically
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/create-llama#34