iQ Suite - Docs
SDK ReferenceInstant RAG

Create Instant RAG

Create an instant RAG (Retrieval-Augmented Generation) context.

Description

The Create Instant RAG endpoint allows you to create an instant Retrieval-Augmented Generation context based on a provided context string. This can be used to generate responses that are augmented with relevant retrieved information.

HTTP Request

POST /index/instant/create

Authentication

All requests must include an Authorization header with a valid API key.

Headers

KeyValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Body

  • context: The context string to create the RAG.

JSON

FieldTypeDescription
contextstringThe context for RAG creation

Token Limitation

The instant rag endpoint accepts a maximum of 8000 tokens in the context string. You can check the token count of your context string using the tokenizer endpoint.

Request Example

# Define the context text you want to analyze
context = """
Your extensive text content goes here. This can be a comprehensive document
that you need to analyze or query immediately without creating a persistent index.
"""
 
# Send a request to create an Instant RAG session
response = client.create_instant_rag(context=context)
 
print(f"Message: {response.message}")
print(f"ID: {response.id}")

Response

Success

Status Code: 201 Created

Body:

{
   "message": "Instant index created successfully. Use the `id` below to query.",
   "id": "8576d96c-bc8a-48e1-8e63-a34dde053e8a",
   "query_url": "https://staging.iqsuite.ai/api/v1/index/instant/query"
}

On this page