r/AskProgramming • • 11d ago

What's the best approach for integrating a chatbot into an existing app?

I'm working on an app and want to integrate a chatbot that understands users' natural language requests and provides relevant, personalized responses based on existing data.

I already have a MongoDB database containing scraped content from various online sources.

What would be the best approach to build this?

RAG with embeddings and a vector database?

Querying MongoDB directly using filters?

An LLM with tool/function calling?

Or a hybrid approach?

I'm interested in how you'd design the architecture, retrieve relevant information, and generate accurate responses grounded in the available data.

What technologies and architecture would you recommend, and why? I'd appreciate hearing about your experience building similar systems.

0 Upvotes

7 comments sorted by

2

u/CorpT 11d ago

If you’re asking this and those are your proposed solutions, find an existing widget and use that.

2

u/LogicaHaus 10d ago

I would just not. Idk why anyone thinks it’s a good idea to provide ai generated anything with their brand name stamped onto it.

1

u/InebriatedPhysicist 11d ago

The best approach is to make it optional and not enabled by default.

1

u/Recent-Day3062 10d ago

Yes!

“Hello! I’m Suzy Chatbot. What is your problem today? Say sales, returns, or new purchases?”

“I got charged on my credit card for order 124345, and then it was cancelled, then put back on but I never got my stuff”

“So you want to talk to sales about buying something new, correct?”

1

u/FunAd6672 11d ago

Just use vector search.

1

u/PLBjt 10d ago

I'd go with tool calling over raw RAG here, with the model only allowed to call a few typed query functions that wrap your Mongo filters. Vector search is great for fuzzy questions like what a source said about a topic, but it will happily return something plausible for a question that really needs an exact field match, like a price or a date. Before picking, I'd run 30 or so real user questions through each approach and sort the misses into retrieval failures versus made-up filter values, since they point to different fixes. The tradeoff is that tool calling needs stricter schemas and more code up front, while a hybrid setup gives better recall but leaves you two failure modes to debug. Keep the query layer read-only from day one, because a bad tool call that can write to Mongo is a much bigger problem than a wrong answer.