Unlock the full potential of AI with RAG Tuning—a revolutionary feature designed to simplify the process of tuning and optimizing AI responses using your custom data. By augmenting model queries with your own data, RAG Tuning ensures more accurate and context-aware responses, providing a cost-effective alternative to traditional training or fine-tuning.
RAG Tuning allows you to bypass expensive and time-consuming model training by augmenting prompts with specific data from your own collection of documents. This enables any AI model to become highly specialized in responding to queries that relate to your content, making it ideal for businesses looking to integrate their own knowledge base without needing to retrain or fine-tune models.
RAG Tuning is built around a few simple steps:
rag_tune parameter to specify the collection, enhancing the model's ability to provide answers based on your data.To start using RAG Tuning, upload a document and associate it with a collection. Here’s an API call that demonstrates how to do this:
curl -L -X POST 'https://apipie.ai/ragtune' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"collection": "my-ragtune-collection",
"url": "https://example.com/mydocument.pdf",
"metatag": "important-document"
}'
This request processes the document and adds it to your specified collection. The metatag is optional but can be useful for categorizing your documents.
To see all collections you’ve created for RAG Tuning, you can use the following API request:
curl -L -X POST 'https://apipie.ai/ragtune/listCollections' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>'
This call returns an array of collections currently associated with your account.
If you need to remove a collection from RAG Tuning, use this API call:
curl -L -X POST 'https://apipie.ai/ragtune/deleteCollection' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"collection": "my-ragtune-collection",
"collectionName": "my-collection",
"deleteAll": false,
"ids": [
"id1",
"id2"
],
"filter": {
"key": "value"
}
}'
This will delete specific documents from the collection based on the provided filters, or you can delete the entire collection if needed.
Once you’ve uploaded documents and created a collection, you can augment your queries with RAG Tuning. Here’s an example of how to use the rag_tune parameter in an API query:
curl -L -X POST 'https://apipie.ai/v1/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <TOKEN>' \
--data-raw '{
"messages": [
{
"role": "user",
"content": "Why the sky is blue?"
}
],
"model": "gpt-3.5-turbo",
"provider": "openai",
"rag_tune": "my-ragtune-collection"
}'
In this example, the rag_tune parameter ensures that the query pulls relevant data from the specified RAG collection to generate a more accurate response.
Keep in mind that RAG Tuning incurs the following costs:
gpt-4o is a great default, experiment with different models to find the most cost-effective solution for your needs.collectionName, it automatically handles both the index and namespace for you.RAG Tuning empowers businesses to enhance their AI models without the cost and complexity of retraining. By augmenting model queries with your own data, RAG Tuning enables any model to provide more accurate and contextually relevant answers. Explore the power of RAG Tuning today and make your AI integrations smarter, faster, and more reliable.
AI Image Generation: DALL-E, Stable Diffusion, & More
Create stunning AI images using our powerful API with DALL-E 3, Stable Diffusion XL, and more. Experience professional quality today!
AI Voice: ElevenLabs & OpenAI TTS API Guide
Generate lifelike voices with our advanced text-to-speech API, featuring 30+ voices, multilingual support, and customizable options.