Ask a question to an existing dataset | Dadosfera AutoDriveDDF API

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Description

Submit a natural-language question that AutoDriveDDF will answer using the specified dataset as context.
Ideal for ad-hoc insight, non-technical users, or exploratory analysis where you’d rather “ask” than write SQL.

  • For small datasets or simple prompts, the API may answer synchronously.
  • For larger datasets or more complex questions, the request is queued for background processing. You receive a question_id and poll the GET endpoint to retrieve the answer later.

HTTP Request

POST /dataset/{dataset_id}/ai_question

No query parameters; the dataset is identified by the path.



Authentication

In your REST client (Postman/Insomnia), select Basic Auth and enter your Username and Password.

The client will automatically generate the Authorization: Basic … header for you. Do not add that header manually.



Request Headers

HeaderExampleRequiredNotes
AuthorizationBasic YWRtaW46bXlwYXNzd29yZA==HTTP Basic Auth – always use HTTPS.
Content-Typeapplication/jsonIndicates a JSON payload.
Acceptapplication/jsonEnsures JSON response.

Path Parameters

LocationNameTypeRequiredDescription
Pathdataset_idstringUUID of the dataset created earlier, e.g. c8004e22-87f7-441f-8302-80c934841196.

Request Body

FieldTypeRequiredDescription
questionstringThe natural-language question you want answered, e.g. "What were the total sales in Q1?". Maximum 1000 characters.
fetch_kintegerNumber of top documents to retrieve initially (e.g. 250). The system ranks these and then selects the next k documents for answer synthesis.
kintegerNumber of documents (from the initial fetch_k) to actually pass to the model for an answer (e.g. 100).
modelstringThe AI model identifier to use, e.g. "gemini-2.5-flash-preview-04-17".

Note: Higher fetch_k and k values can improve answer quality at the expense of longer processing time. If omitted, the server may apply sensible defaults (check your environment’s configuration).

Example Request Body (JSON)

{
  "question": "Why do some pipeline jobs fail intermittently?",
  "fetch_k": 250,
  "k": 100,
  "model": "gemini-2.5-flash-preview-04-17"
}

Example Request (cURL)

curl -u admin:mypassword \
     -H "Content-Type: application/json" \
     -d '{
           "question": "Why do some pipeline jobs fail intermittently?",
           "fetch_k": 250,
           "k": 100,
           "model": "gemini-2.5-flash-preview-04-17"
         }' \
     https://api.autodriveddf.example/dataset/c8004e22-87f7-441f-8302-80c934841196/ai_question

Success Response 200 OK (Asynchronous)

{
  "dataset_id": "c8004e22-87f7-441f-8302-80c934841196",
  "question_id": "04534356-9ee0-431d-8b6e-74c2eed261c2",
}
FieldDescription
dataset_idUUID of the dataset queried.
question_idUnique UUID for this question instance (use it to poll for the answer).

Notes on Usage

  1. Synchronous vs Asynchronous:

    • For small datasets, the API may return a complete answer in a single POST response (status 200 OK with answer).
    • For larger datasets, you will receive a question_id immediately and must poll the GET endpoint until status = "completed".
  2. Rate Limits:
    AI-powered questions may count against a separate rate limit. Expect slower throughput than simple document retrieval calls.

  3. Parameter Tuning:

    • A larger fetch_k retrieves more context but takes longer.
    • A larger k provides more context to the model, potentially improving accuracy at the cost of latency.
  4. Language:
    The answer’s language matches the question’s language. Non-English questions will yield non-English answers, provided the underlying model supports that language.


Next Steps
Once you receive a completed answer, you can:

  • Analyze the returned snippets to verify facts.
  • Use the answer text in your application or dashboard.
  • Ask follow-up questions by re-using the same dataset_id.
  • If you want only relevant documents (no AI answer), use
    POST /dataset/{dataset_id}/questionGET /dataset/{dataset_id}/question/{question_id} instead.
Path Params
string
required
Body Params
string
required

Question that will be asked to the dataset

metadata_filter
object
    This field can be used to filter documents using the metadata
      of the documents.

    Example:
    metadata_filter={"source": "file.txt"}

    In this scenario, before selecting the documents, the following filter
      would be routerlied to the dataset.
    
string
enum
Defaults to cos
    Distance Metric in Embedding Distances

    In the realm of embeddings, where data points are represented as
      vectors in a continuous space, a distance metric quantifies the
      similarity or dissimilarity between these vectors. It allows us
      to gauge how close or far apart two embeddings are, helping
      capture semantic or contextual relationships.

    Available metrics:
      - "L2": "Euclidean Distance"
      - "L1": "Nuclear distance"
      - "max": "L-infinity"
      - "cos": "Cosine"
      - "dot": "dot product"
    
Allowed:
boolean
Defaults to true
    Whether to use MMR (Maximal Marginal Relevance) in the selection of documents
    to retrieve.

    MMR is an algorithm commonly used in information retrieval and text summarization.
      Its primary goal is to balance relevance and diversity. When retrieving or
      summarizing documents, MMR ensures that the selected items are
      not only relevant to the query or topic but also diverse enough
      to provide comprehensive information. This prevents redundancy and
      offers a broader perspective on the topic.
    
integer
Defaults to 10

Amount of Langchain documents to pass to MMR algorithm.

integer
Defaults to 3

Amount of Langchain documents to return

boolean
Defaults to true
string
enum
Defaults to gemini-1.5-flash-002
Responses

Language
Credentials
Basic
base64
:
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json