Ground DeepSeek, Qwen, and Llama chat replies in your vector store on Vultr Serverless Inference, with tool calling.
Retrieval-Augmented Generation (RAG) combines information retrieval with text generation. In Vultr Serverless Inference, RAG lets chat models use domain-specific knowledge from your vector store collections, which improves the contextual accuracy of responses and reduces hallucinations.
The RAG endpoint also supports tool calling. Models can invoke functions that you define during RAG-based interactions, such as performing calculations, fetching live data, or calling APIs based on the retrieved context.
Follow this guide to use RAG-based chat completion on Vultr Serverless Inference using the Vultr API.
RAG-based chat completion works with any of the chat models listed at the List Models endpoint.
Retrieve the subscription's API key and export it as the INFERENCE_API_KEY environment variable. See How to Retrieve the API Key for Vultr Serverless Inference.
Send a GET request to the List Collections endpoint and note the target collection's ID.
Send a GET request to the List Models endpoint and note the preferred inference model's ID.
Send a POST request to the RAG Chat Completion endpoint to generate responses using Retrieval-Augmented Generation (RAG). Replace COLLECTION_ID with the collection ID, MODEL_ID with the model ID, and USER_INPUT with your message.
Visit the RAG Chat Completion API page to view additional attributes you can apply for greater control when interacting with the preferred inference model.
Only chat models whose List Models endpoint response includes a tools parameter support tool calling.
Send a POST request to the RAG Chat Completion endpoint to combine RAG retrieval and tool invocation. Define your tools in the tools parameter of the request body, and set tool_choice to auto, required, or none to control when the model triggers a tool call. Replace COLLECTION_ID with the collection ID and MODEL_ID with the model ID.
The response includes a tool_calls array with the function name and its arguments.
Run the function locally or through an API, then send its output back to the RAG endpoint in a follow-up request to generate a complete, context-aware response.
For a complete implementation example, see How to Use Tool Calling with Vultr Serverless Inference.
0 Comments
Be the first to comment and share your perspective with the community.