Logo
Search & Inference

FAQ Generator

View Docs

API Reference

POST
/api/agent/faq_generator

Authorization

ApiKeyAuth
access-key<token>

Your unique access-key generated from the platform UI

In: header

Request Body

application/json

doc_process_ids*array<string>

Array of document IDs to generate FAQs from (obtained from Upload or List Documents APIs). Only documents with status 'processed' can be used.

focus_areas?array<string>

List of focus areas to generate questions about (e.g., 'pricing', 'legal', 'technical'). Leave empty for general FAQs

question_count*integer

Number of questions to generate (minimum: 1, maximum: 10)

Range1 <= value <= 10
model_data*

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.k-v.ai/api/agent/faq_generator" \  -H "Content-Type: application/json" \  -d '{    "doc_process_ids": [      "your_doc_id"    ],    "focus_areas": [      "fee"    ],    "question_count": 2,    "model_data": {      "model_name": "gpt-5.1",      "api_key": ""    }  }'
{
  "data": {
    "questions_answers": [
      {
        "question": "What is the prevailing party entitled to regarding attorneys' fees in any action relating to the Agreement?",
        "answer": "In any action relating to the Agreement, the prevailing party is entitled to collect reasonable attorneys' fees and costs from the non-prevailing party in addition to any other recovery.",
        "focus_area": "fee",
        "page_numbers": [
          "1"
        ],
        "rank": 1,
        "source": "Settlement Agreement (1).pdf",
        "doc_hash": [
          "264dfa262b748d15ccbeaada89430c68"
        ]
      },
      {
        "question": "Who is responsible for paying attorneys' fees and costs incurred before the execution of the Settlement Agreement?",
        "answer": "Each party is responsible for bearing its own attorneys' fees and costs arising from the actions of its own counsel incurred prior to the date of execution of the Agreement.",
        "focus_area": "fee",
        "page_numbers": [
          "1"
        ],
        "rank": 2,
        "source": "Settlement Agreement (1).pdf",
        "doc_hash": [
          "264dfa262b748d15ccbeaada89430c68"
        ]
      }
    ],
    "is_sufficient": true,
    "tokens": {
      "input": 1501,
      "output": 261,
      "total": 1762
    }
  },
  "message": "FAQs extracted successfully"
}
{
  "data": {},
  "message": "Invalid docs selected"
}
{
  "value": {
    "data": {},
    "message": "Invalid or missing access key"
  }
}

{
  "detail": [
    {
      "type": "literal_error",
      "loc": [
        "body",
        "model_data",
        "model_name"
      ],
      "msg": "Input should be 'gpt-5-chat-latest', 'gpt-5.1', 'gpt-5-mini', 'claude-sonnet-4-5-20250929', 'gemini/gemini-2.5-flash-lite', 'mistral/mistral-small-latest', 'mistral/mistral-medium-latest', 'gemini/gemini-2.5-pro', 'gemini/gemini-3-pro-preview' or 'llama3.1-70b'",
      "input": "",
      "ctx": {
        "expected": "'gpt-5-chat-latest', 'gpt-5.1', 'gpt-5-mini', 'claude-sonnet-4-5-20250929', 'gemini/gemini-2.5-flash-lite', 'mistral/mistral-small-latest', 'mistral/mistral-medium-latest', 'gemini/gemini-2.5-pro', 'gemini/gemini-3-pro-preview' or 'llama3.1-70b'"
      }
    }
  ]
}

{
  "data": {},
  "message": "litellm.AuthenticationError: AuthenticationError: OpenAIException - Incorrect API key provided: tyrdfuih**uhf7. You can find your API key at https://platform.openai.com/account/api-keys."
}