mongodb / chatbot

MongoDB Chatbot Framework. Powered by MongoDB and Atlas Vector Search.
https://mongodb.github.io/chatbot/
Apache License 2.0
106 stars 48 forks source link

Documentation improvement: Booster #343

Closed eric-gardyn closed 3 months ago

eric-gardyn commented 4 months ago

from: https://mongodb.github.io/chatbot/server/rag/retrieve

to add a booster, to filter for a given data source, the field needs to be added to the Query index as seen here https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/

index definition (to be inline with mongodb-ingest)

{
  "fields": [
    {
      "numDimensions": 1536,
      "path": "embedding",
      "similarity": "cosine",
      "type": "vector"
    },
    {
      "path": "sourceName",
      "type": "filter"
    }
  ]
}
mongodben commented 4 months ago

thanks for pointing this out.

i think it'd make sense to add a note about this in the retrieve page, https://mongodb.github.io/chatbot/server/rag/retrieve/.

note that on the docs for creating atlas vector search index, we do already have the commented out filter definition, https://mongodb.github.io/chatbot/mongodb#3-create-atlas-vector-search-index-required-for-rag. i think it'd also make sense to add a bit more documentation there to make clear that you need to define filters.

this is a quick fix. will get it in soon.

nlarew commented 4 months ago

@eric-gardyn Would you mind sharing a bit about what you're trying to accomplish with the search boosters? This is a feature we might revisit in a future update and we'd love to have some more context on the use cases folks have.

eric-gardyn commented 4 months ago

in my case, I am trying to boost a category of documents that I want to make sure the retrieval step will get back, referred as "re-ranking", based on the context of the query. A very specific use case is when we need to inject personal data (coming from an external database): if the user's query is very specific/personal, very often the retrieve step fails and does not return any data (and won't call the LLM part). So I am trying to force the Index search to return a "templated" document that the LLM will then analyze (and use function calling to retrieve the specific/personal data). I was able to make it work most of the time: sometimes, the retrieve part does not return the "templated" document (hence, the reason for the boost). Hope this helps. Happy to hop on a call if you want to discuss further.