> ## Documentation Index
> Fetch the complete documentation index at: https://help.peliqan.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Cloud Document AI - Getting started in Peliqan

> Set up the Google Cloud Document AI connector in Peliqan to process documents with OCR and extract structured data using custom pipeline scripts and GCP processors.

Google Cloud (GCP) Document AI allows you to create document processors that help automate tedious tasks, improve data extraction, and gain deeper insights from unstructured or structured document information. Document AI helps developers create high-accuracy processors to extract, classify, and split documents.

This guide provides an overview of setting up the **Google Cloud Document AI** Connector in Peliqan. For technical assistance or custom integration requirements, please [contact our support team](https://peliqan.io/contact).

## Setup

Perform these steps:

* Create a Project on [Google Cloud (GCP)](https://console.cloud.google.com/)
* Copy your Project ID

<img src="https://mintcdn.com/peliqan-9d7f0393/-nwNqUkSPUzSM-9F/images/Google%20Cloud%20Document%20AI%20-%20Getting%20started%20in%20Peli/Project_ID.png?fit=max&auto=format&n=-nwNqUkSPUzSM-9F&q=85&s=4704b8ac0702b72a2d7083dff514ced6" alt="Project_ID" title="Project_ID" width="1584" height="546" data-path="images/Google Cloud Document AI - Getting started in Peli/Project_ID.png" />

* [Enable the Document AI API](https://console.cloud.google.com/apis/library/documentai.googleapis.com)
* Set up billing in your Google Cloud account
* Enable a processor (e.g. "OCR") in Document AI:
  * Go to [https://console.cloud.google.com/ai/document-ai](https://console.cloud.google.com/ai/document-ai)
  * Click on Explore Processors

<img src="https://mintcdn.com/peliqan-9d7f0393/-nwNqUkSPUzSM-9F/images/Google%20Cloud%20Document%20AI%20-%20Getting%20started%20in%20Peli/Google_GCP_Document_AI.png?fit=max&auto=format&n=-nwNqUkSPUzSM-9F&q=85&s=4763d3756d6e4dea14d87afa60d6ecc3" alt="Google_GCP_Document_AI" title="Google_GCP_Document_AI" width="2612" height="1560" data-path="images/Google Cloud Document AI - Getting started in Peli/Google_GCP_Document_AI.png" />

* Select a processor, give it a name and click on "Create"

<img src="https://mintcdn.com/peliqan-9d7f0393/-nwNqUkSPUzSM-9F/images/Google%20Cloud%20Document%20AI%20-%20Getting%20started%20in%20Peli/Add_processor.png?fit=max&auto=format&n=-nwNqUkSPUzSM-9F&q=85&s=01cdedba5f850f012ba3db72a03c6748" alt="Add_processor" title="Add_processor" width="3518" height="1600" data-path="images/Google Cloud Document AI - Getting started in Peli/Add_processor.png" />

* Copy the Processor ID

<img src="https://mintcdn.com/peliqan-9d7f0393/-nwNqUkSPUzSM-9F/images/Google%20Cloud%20Document%20AI%20-%20Getting%20started%20in%20Peli/Processor_ID.png?fit=max&auto=format&n=-nwNqUkSPUzSM-9F&q=85&s=45316a7497309fe03f95ada1142b5cbd" alt="Processor_ID" title="Processor_ID" width="2622" height="1240" data-path="images/Google Cloud Document AI - Getting started in Peli/Processor_ID.png" />

* Add a connection in Peliqan for "Google Document AI" and authorize Peliqan to access the Google GCP project

## Example script

```python theme={null}
google_document_ai_api = pq.connect('Google Document AI')

import base64
import requests

allowed_upload_file_type = 'pdf'
uploaded_file = st.file_uploader(f"Upload {allowed_upload_file_type} file", accept_multiple_files=False, type=[allowed_upload_file_type])

if uploaded_file is not None:
    file_contents = uploaded_file.read()
    file_base64 = base64.b64encode(file_contents).decode('utf-8')

    params = {
        'base64_content': file_base64,
        'mimetype': "application/pdf"
    }
    
    result = google_document_ai_api.get('process_document', params)
    st.json(result)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.