---
title: Answer questions
description: Ask questions against one or more uploaded files and return AI-generated answers as structured data.
category: AI
tags: [ai, question answering, documents, files]
---

# Answer questions

## **Description**

The **Answer questions** activity sends the configured prompt and any input files to the Infoveave AI service, then returns answers as tabular data. It is useful when a workflow needs to ask one or more natural-language questions about documents, images, spreadsheets, JSON files, text files, or other supported attachments.

### **Supported Features**

- **Prompt-based question answering**: Ask one or more questions through the required prompt.
- **Optional file input**: Attach files from previous workflow steps, or run with only the prompt.
- **Multiple answers**: The AI response can return multiple answer rows in the `responses` array.
- **Structured output parsing**: Each object inside `responses` becomes one output data row.
- **Raw response retention**: The original AI response is returned in `AdditionalResponse`.

---

## **Input**

| Type | Required | Description |
| --- | --- | --- |
| Files | Optional | Files passed to the AI request as inline attachments. Each file is read, converted to base64, and sent with its detected MIME type. |

### **Input Scenarios**

#### **1. Prompt Only**

Use when the question does not require file context.

```json
{
  "Files": []
}
```

#### **2. Single Document**

Use when asking questions about one document.

```json
{
  "Files": [
    {
      "FileName": "contract.pdf",
      "FullPath": "C:/Work/contract.pdf"
    }
  ]
}
```

#### **3. Multiple Documents**

Use when the answer may need context from several files.

```json
{
  "Files": [
    { "FileName": "policy.pdf", "FullPath": "C:/Work/policy.pdf" },
    { "FileName": "invoice.pdf", "FullPath": "C:/Work/invoice.pdf" }
  ]
}
```

---

## **Output**

The activity returns data rows parsed from the AI response's `responses` property.

| Field | Type | Description |
| --- | --- | --- |
| Data | Array | One row for each object returned inside `responses`. Field names depend on the AI response. |
| Errors | Array | Parsing errors or execution errors, if any. |
| AdditionalResponse | String | Raw AI response JSON returned by the service. |

### **Example Output**

```json
{
  "Data": [
    {
      "question": "What is the contract end date?",
      "answer": "The contract ends on 2026-12-31.",
      "source": "contract.pdf"
    },
    {
      "question": "Who is the customer?",
      "answer": "Contoso Ltd.",
      "source": "contract.pdf"
    }
  ],
  "Errors": [],
  "AdditionalResponse": "{\"responses\":[{\"question\":\"What is the contract end date?\",\"answer\":\"The contract ends on 2026-12-31.\"}]}"
}
```

---

## **Configuration Fields**

| Field Name | Type | Required | Description |
| --- | --- | --- | --- |
| Prompt | Text | Yes | Natural-language instructions and questions to ask. The prompt is inserted into the activity's AI question-answering template. |

### **Conditional Field Rendering Rules**

No conditional configuration fields are defined for this activity.

---

## **Sample Configuration**

| Field | Value |
| --- | --- |
| Prompt | `Read the attached contract and answer: 1. Who is the customer? 2. What is the contract end date? 3. What is the payment term?` |

---

## **Sample Output**

```json
{
  "Data": [
    {
      "question": "Who is the customer?",
      "answer": "Contoso Ltd."
    },
    {
      "question": "What is the contract end date?",
      "answer": "2026-12-31"
    },
    {
      "question": "What is the payment term?",
      "answer": "Net 30"
    }
  ]
}
```
