Tutorial: RAG with OpenSearch via ml-commons
Summary
If you don’t know the term, it’s short for “retrieval-augmented generation”, which means that we’re using retrieval (in our case OpenSearch) to augment our friendly chatbot by sending it some information relevant to the context. Notice how all the referenced parameters are already specified, with the exception of , which is built for every request – it represents the conversation so far (from the sytem prompt to the user question). For example, I might have: At this point, if I ask OpenAI which modules were loaded, I might make this request: I get back the top 10 results as in a regular query, but I also get this nice reply at the end: Now we have our minimal OpenSearch RAG 🎉 Let’s zoom in to see what happened. And of course, the amount of text in those fields 🙂 • Finally, timeout defined how long to wait for the remote endpoint (in our case the OpenAI API) to respond. It’s up to the LLM (based on your input) to fill in the parameters (query text, for example) which has potential to be smart but also to introduce creative bugs, like a field name typo or the wrong date format.