> For the complete documentation index, see [llms.txt](https://documentation.astera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.astera.com/dataflows/sources/smart-document-source.md).

# Smart Document Source

The Smart Document Source object in Astera is designed to parse and map data from documents with varying formats and field structures. It supports formats such as JSON, CSV, Excel, TXT, and delimited files. The object adapts to differences in document layouts at runtime, including changes in field names, data structures, or formats. It also supports exact matching, synonym dictionaries, and AI-based semantic matching to align extracted fields with target layouts.

### Getting the Smart Document Source Object

1. To get a Smart Document Source object, go to *Toolbox > Sources > Smart Document Source*. If you cannot see the Toolbox, go to *View > Toolbox or press Ctrl + Alt + X*.<br>

   <figure><img src="/files/ZslVQlutRKuHrorHpIRL" alt="" width="240"><figcaption></figcaption></figure>
2. Drag-and-drop the Smart Document Source object onto the designer.<br>

   <figure><img src="/files/Poh7e2YhLL757hmfvFcG" alt="" width="251"><figcaption></figcaption></figure>

### Configuring the Smart Document Source Object

3. To configure the *Smart Document Source* object, right-click on its header and select *Properties* from the context menu.
4. The Layout Builder window will open, here you can create an output layout. This will act as the standard output layout that you want all your final data to have.<br>

   <figure><img src="/files/6T6YiJHhv7MOwBdU6g47" alt=""><figcaption></figcaption></figure>
5. Once configured, click *Next. Properties* window will open, there are a few configuration options here<br>

   <figure><img src="/files/aB00ygV5hlet4HaEXWDs" alt=""><figcaption></figcaption></figure>

* *Source File Path:* Provide the file path for the source document to establish connectivity to the source data.<br>

  <figure><img src="/files/q0zqFHprIbLovHyVFquV" alt=""><figcaption></figcaption></figure>

**Map Options**<br>

<figure><img src="/files/ZCsVSKHWxHjp2gA83J22" alt=""><figcaption></figcaption></figure>

* *Mark Unmapped Fields As Error:* Marks unmapped fields as errors during the data preview if any fields in the output layout are not mapped to the input fields. By default, unmapped fields are marked as warning.
* *Write Source File Layout to File:* Creates a layout file with the structure of the source file (including field names, headers, and data types).
* *Write Field Maps to File:* Creates a mapping file that details the field names from the input and output layouts, along with the matching steps used.

These files are generated every time a document is processed through the *Smart Document Source* object. Once you have configured the layouts and mappings, you can convert them to a synonym dictionary for reuse. If no file paths are provided, these files will not be generated.

**Smart Match Options**<br>

<figure><img src="/files/TR25BN6WcDWGwV1kSX7A" alt=""><figcaption></figcaption></figure>

* The *Smart Document Source* object uses several matching strategies to identify fields in the input document and match them with fields in the target layout:
  * *All:* Uses all the sequences available until a match is found.
  * *Exact:* Searches for an exact, case-insensitive match between input and output fields.
  * *SynonymDictionary:* Searches for alternate field names from a pre-defined synonym dictionary. If selected, you must provide the file path for the synonym dictionary.\
    To learn more on how to create a synonym dictionary, click here.
  * *AiSemanticMatch:* Uses AI to semantically match the input fields with the appropriate output fields (using the SemanticMatching LLM Template).<br>

    <figure><img src="/files/LYqrgxsXZ6AP0VY3NfKI" alt=""><figcaption></figcaption></figure>
* *Template Name:* Select the relevant LLM Template to use for AI Matching<br>

  <figure><img src="/files/XntgQUO25rC6dprZ0MKf" alt=""><figcaption></figcaption></figure>
* *Synonym Dictionary File Path:* Provide the file path for the synonym dictionary to be used for matching purposes.

6. Once the properties are configured, click *Next. Config Parameters* window will open. Here, you can define parameters that provide easier deployment and better flexibility. Parameters allow for easier configuration changes without having to modify the flow itself.<br>

   <figure><img src="/files/dI8usRWkIyqwE0gSkrgV" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** Any parameters left blank will use the default values assigned in the properties page.
{% endhint %}

7. Once you've gone through all the configuration options, click *OK* to finalize the setup. The *Smart Document Source* object is now configured and ready to be used in your dataflow.

You can also use the *Preview Output* option to see the Data Preview.

<figure><img src="/files/mSg9v8vYbcSgHCO8ZWkT" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.astera.com/dataflows/sources/smart-document-source.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
