POST
/
ask-formatted
curl --location 'https://document-query.pyqai.com/ask-formatted' \
--header 'Authorization: ExampleAPIToken' \
--header 'Content-Type: application/json' \
--data '{"account_id" : ExampleAccountID, "index_name" : "ExampleIndexName", "input_sequence" : "Example query", "description" : "Description of field to populate", "response_type" : "list[str]", "name" : "list of query results"}'
{
      "formatted_response": {
        "sample_str_list_field_name": ["sample str output 1", "sample str output 2"]
    },
    "response": {
        "question": "Your input sequence query!",
        "answer": "Pyq's AI has answered your query.\n",
        "sources": "source_1, source_2, source_3",
        "source_documents": [
            {
                "page_content": "Some information from your documents.",
                "metadata": {
                    "source": "source_1"
                }
            },
            {
                "page_content": "Some information from your documents.",
                "metadata": {
                    "source": "source_2"
                }
            },
            {
                "page_content": "Some information from your documents.",
                "metadata": {
                    "source": "source_3"
                }
            }
        ]
    }
}

Body Parameters

account_id
int
required

This is your account ID.

input_sequence
string
required

This is the query you wish to answer using documents from the given index.

response_type
string
required

This is the type you would like your answer to be in. str, int, float, bool, list[str], list[bool], list[int], list[float] are supported.

name
string
required

This is the name of the JSON field you wish to be populated.

description
string
required

This is a description of the field that will be populated. This helps the AI extract the correct information and make sure it is in the correct type.

index_name
string

This is the name of the index you wish to query with. This parameter is optional - if left blank will use auto indexing.

model
string

This is an optional parameter specifying if you would like to use Anthropic’s Claude instead of our default. The value “claude” will result in using that for your query.

Headers

Authorization
string
required

This is your API token associated with your account.

Response

formatted_response
string

This will contain your response, formatted in the way you specified.

response
string

This contains a natural language response and relevant sources, as specified in the ask endpoint documentation.