### Run OmniAI with Docker Secrets (YAML) Source: https://docs.getomni.ai/docs/enterprise/vpc/get-started Illustrates running OmniAI using Docker Compose with environment variables managed via Docker secrets. It maps ports, uses a persistent volume for data, and specifies a secret file for the DATABASE_URL. The example also shows the expected format for the secret file. ```YAML services: app: image: omni-dev # pull_policy: always ports: - '3000:3000' - '4000:4000' # - "5432:5432" environment: - OMNI_PRODUCT_KEY=12345 secrets: - DATABASE_URL volumes: - pgdata:/var/lib/postgresql/16/main secrets: DATABASE_URL: file: /path/to/DB_URL_SECRET volumes: pgdata: name: omni_pg_data ``` ```YAML # Example content for /path/to/DB_URL_SECRET postgresql://postgres:password@172.0.0.1:5432/omni ``` -------------------------------- ### Process Documents via API Source: https://docs.getomni.ai/docs/extraction/quickstart Demonstrates how to use the Get Omni AI API to extract data from documents by providing a file URL and a template ID. Includes examples for Node.js, Python, and cURL. ```APIDOC POST https://api.getomni.ai/extract Description: Extracts structured data from a document using a predefined extraction template. Authentication: Requires an 'x-api-key' header with your valid API key. Headers: - Content-Type: application/json - x-api-key: Request Body: - url (string, required): The URL of the document to process. - templateId (string, required): The ID of the extraction template to use. Response: Returns a JSON object containing the extracted data. Error Conditions: - Invalid API key - Invalid template ID - Document URL not accessible - Malformed request body ``` ```javascript import axios from 'axios'; const options = { headers: { 'x-api-key': '', 'Content-Type': 'application/json', } }; const data = { url: '', templateId: '', }; axios.post('https://api.getomni.ai/extract', data, options) .then(response => console.log(response.data)) .catch(error => console.error(error)); ``` ```python import requests url = "https://api.getomni.ai/extract" headers = { "x-api-key": "", "Content-Type": "application/json" } payload = { "url": "", "templateId": "", } response = requests.request("POST", url, json=payload, headers=headers) ``` ```bash curl --request POST \ --url https://api.getomni.ai/extract \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data '{ "url": "", "templateId": "", }' ``` -------------------------------- ### Run OmniAI with Docker Compose (YAML) Source: https://docs.getomni.ai/docs/enterprise/vpc/get-started Defines and runs the OmniAI application using Docker Compose. This configuration includes persistent storage for the PostgreSQL database via a named volume ('pgdata') and maps the necessary ports. It also sets the product key environment variable. ```YAML version: '1.01' services: app: image: omniai:latest container_name: omniai ports: - '3000:3000' - '4000:4000' volumes: - pgdata:/var/lib/postgresql/16/main environment: - OMNI_PRODUCT_KEY="12345" volumes: pgdata: name: omni_pg_data ``` -------------------------------- ### Install Zerox Node.js SDK Source: https://docs.getomni.ai/zerox/nodejs Installs the Zerox Node.js SDK using npm. This is the primary step to integrate the SDK into your project. ```bash npm install zerox ``` -------------------------------- ### Install Zerox Python SDK Source: https://docs.getomni.ai/zerox/python Installs the Zerox Python SDK using pip. It also requires system installation of 'poppler' for PDF processing. ```bash pip install py-zerox ``` -------------------------------- ### Tag OmniAI Docker Image (Bash) Source: https://docs.getomni.ai/docs/enterprise/vpc/get-started Tags the pulled OmniAI Docker image with a more accessible alias, 'omniai:latest'. This simplifies subsequent commands by allowing you to refer to the image by its shorter name instead of the full ECR URL. ```Bash docker tag 851725384009.dkr.ecr.us-east-2.amazonaws.com/omniai:latest omniai:latest ``` -------------------------------- ### Pull OmniAI Docker Image (Bash) Source: https://docs.getomni.ai/docs/enterprise/vpc/get-started Pulls the OmniAI Docker image from the specified AWS ECR repository. This command downloads the latest version of the OmniAI image to your local machine, making it available for running. ```Bash docker pull 851725384009.dkr.ecr.us-east-2.amazonaws.com/omniai:latest ``` -------------------------------- ### Run OmniAI Container (Bash) Source: https://docs.getomni.ai/docs/enterprise/vpc/get-started Runs the OmniAI Docker image as a detached container. It maps ports 3000 and 4000 for the front-end and API services respectively, sets an environment variable for the product key, and names the container 'omniai'. Note that data is not persistent by default. ```Bash docker run -d \ --name omniai \ -p 3000:3000 \ -p 4000:4000 \ -e OMNI_PRODUCT_KEY='12345' \ omniai:latest ``` -------------------------------- ### Response Examples Source: https://docs.getomni.ai/api-reference/pipeline/run-batch-pipeline Examples of JSON responses for a successful pipeline run (200 OK) and an error case (400 Bad Request). ```JSON 200 OK: { "jobId": "123e4567-e89b-12d3-a456-426614174000", "result": "https://api.getomni.ai/batches/pipelines/poll/123e4567-e89b-12d3-a456-426614174000?jobId=123e4567-e89b-12d3-a456-426614174000", "status": "PENDING" } 400 Bad Request: { "error": "Invalid request" } ``` -------------------------------- ### Authenticate Docker to AWS ECR (Bash) Source: https://docs.getomni.ai/docs/enterprise/vpc/get-started Authenticates your Docker client to the AWS Elastic Container Registry (ECR) using provided access keys. This step is necessary to pull private Docker images hosted on ECR. It requires AWS CLI to be installed and configured. ```Bash export AWS_ACCESS_KEY_ID=user_access_key_id export AWS_SECRET_ACCESS_KEY=user_secret_access_key aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 851725384009.dkr.ecr.us-east-2.amazonaws.com ``` -------------------------------- ### Install System Dependencies for Zerox Source: https://docs.getomni.ai/zerox/nodejs Installs required system dependencies, graphicsmagick and ghostscript, for PDF to image processing. Instructions are provided for both Linux (apt-get) and macOS (brew). ```bash sudo apt-get update sudo apt-get install graphicsmagick ghostscript ``` ```bash brew install graphicsmagick ghostscript ``` -------------------------------- ### Response Example Source: https://docs.getomni.ai/zerox/nodejs An example of the JSON response structure returned after processing a document, including completion time, token usage, and page-specific content. ```json { "completionTime": 10038, "fileName": "invoice_36258", "inputTokens": 25543, "outputTokens": 210, "pages": [ { "page": 1, "content": "# INVOICE 36258 ...", "contentLength": 747 } ], "extracted": null, "summary": { "totalPages": 1, "ocr": { "failed": 0, "successful": 1 }, "extracted": null } } ``` -------------------------------- ### Request Body Example Source: https://docs.getomni.ai/api-reference/pipeline/run-batch-pipeline An example JSON payload for the request body when running a batch pipeline. ```JSON { "requests": [ { "file": "file_1.pdf" }, { "file": "file_2.pdf" } ] } ``` -------------------------------- ### Extract API Request Examples Source: https://docs.getomni.ai/api-reference/extract/run-extract Provides examples of how to call the 'Run Extract' API endpoint using different programming languages and tools. ```javascript const options = { method: 'POST', headers: { 'x-api-key': '', 'Content-Type': 'application/json', }, body: JSON.stringify({ url: '', templateId: '', }), }; fetch('https://api.getomni.ai/extract', options) .then((response) => response.json()) .then((response) => console.log(response)) .catch((err) => console.error(err)); ``` ```python import requests url = "https://api.getomni.ai/extract" headers = { "x-api-key": "", "Content-Type": "application/json" } payload = { "url": "", "templateId": "", } response = requests.request("POST", url, json=payload, headers=headers) ``` ```bash curl --request POST \ --url https://api.getomni.ai/extract \ --header 'Content-Type: application/json' \ --header 'x-api-key: ' \ --data '{ \ "url": "", \ "templateId": "", \ }' ``` -------------------------------- ### cURL Request Example Source: https://docs.getomni.ai/api-reference/classify/get-classification Example of how to fetch classification data using cURL. ```bash curl --request GET \ --url "https://api.getomni.ai/classification/" \ --header "Content-Type: application/json" \ --header "x-api-key: " ``` -------------------------------- ### Python Request Example Source: https://docs.getomni.ai/api-reference/classify/get-classification Example of how to fetch classification data using Python and the Requests library. ```python import requests url = "https://api.getomni.ai/classification/" headers = { "x-api-key": "", "Content-Type": "application/json" } response = requests.request("GET", url, headers=headers) ``` -------------------------------- ### Node.js Request Example Source: https://docs.getomni.ai/api-reference/classify/get-classification Example of how to fetch classification data using Node.js and the Fetch API. ```javascript const options = { method: "GET", headers: { "x-api-key": "", "Content-Type": "application/json", }, }; fetch("https://api.getomni.ai/classification/", options) .then((response) => response.json()) .then((response) => console.log(response)) .catch((err) => console.error(err)); ``` -------------------------------- ### Get Classification by ID Source: https://docs.getomni.ai/api-reference/classify/get-classification Retrieves a classification by its unique identifier. The response includes the classification's name, its options, and examples associated with each option. Supports GET requests. ```APIDOC GET /classification/{id} Retrieves a classification by its ID. Parameters: - Path Parameters: - id (string, required): Unique identifier of the classification to retrieve. Response: - Status Code 200: - classification (object): The classification object. - id (string): Unique identifier for the classification. - name (string): Name of the classification. - options (array): List of classification options. - id (string): Unique identifier for the classification option. - name (string): Name of the classification option. - examples (array): List of examples associated with the classification option. - id (string): Unique identifier for the example. - url (string): URL of the example document. - Status Code 400: - error (string): "Invalid request" Example Request: curl --request GET \ --url "https://api.getomni.ai/classification/" \ --header "Content-Type: application/json" \ --header "x-api-key: " Example Response (200): { "classification": { "id": "62faa34f-1229-4d20-8008-ce1e7830397b", "name": "Financial Document Classification", "options": [ { "id": "4e3598e3-3ee2-423b-820e-176f4547ac4b", "name": "BANK_STATEMENT", "examples": [ { "id": "646c7c86-1fa4-433a-a224-7ea552653f9e", "name": "bank-statement.pdf", "type": "application/pdf", "url": "https://example.com/bank-statement.pdf" } ] } ] } } ``` -------------------------------- ### Get Poll Extract (cURL) Source: https://docs.getomni.ai/api-reference/extract/poll-extract Example of how to fetch poll extraction results using cURL. This command-line snippet demonstrates making a GET request to the API endpoint with the necessary headers. ```bash curl --request GET \ --url https://api.getomni.ai/extract?jobId=${jobId} \ --header 'x-api-key: ' ``` -------------------------------- ### Get Webhooks API Response Source: https://docs.getomni.ai/api-reference/webhook/get-webhooks Details the structure of the response when retrieving webhooks. It outlines the fields for each webhook, including its ID, URL, headers, and enabled status. Includes successful and error response examples. ```APIDOC GET /webhooks Description: Retrieves a list of webhooks. Response: 200 OK: Content: application/json: Schema: type: object properties: webhooks: type: array items: type: object properties: id: type: string description: Webhook ID url: type: string description: Webhook URL headers: type: array items: type: object properties: key: type: string description: Header key name. e.g. `Authorization` value: type: string description: Header value. e.g. `Bearer ` isEnabled: type: boolean description: Whether the webhook is enabled Examples: 200: ```json { "webhooks": [ { "id": "6901b859-fe94-4c3c-a826-a4d484f309a6", "headers": [ { "key": "Authorization", "value": "Bearer your_token_here" } ], "isEnabled": true, "url": "https://your-webhook-url.com" } ] } ``` 400 Bad Request: Content: application/json: Schema: type: object properties: error: type: string description: Error message Examples: 400: ```json { "error": "Invalid request" } ``` ``` -------------------------------- ### Get Poll Extract (Python) Source: https://docs.getomni.ai/api-reference/extract/poll-extract Example of how to retrieve poll extraction results using the Python requests library. It shows how to construct the URL and headers for the API call. ```python import requests jobId = "" url = f"https://api.getomni.ai/extract?jobId={jobId}" headers = { "x-api-key": "", } response = requests.request("GET", url, headers=headers) ``` -------------------------------- ### Get Poll Extract (Node.js) Source: https://docs.getomni.ai/api-reference/extract/poll-extract Example of how to fetch poll extraction results using the Node.js Fetch API. It demonstrates setting up the request with the job ID and API key. ```javascript const jobId = ""; const options = { method: "GET", headers: { "x-api-key": "", }, }; fetch(`https://api.getomni.ai/extract?jobId=${jobId}`, options) .then((response) => response.json()) .then((response) => console.log(response)) .catch((err) => console.error(err)); ``` -------------------------------- ### Use Zerox SDK with Local Path (Node.js) Source: https://docs.getomni.ai/zerox/nodejs Example of using the Zerox SDK in Node.js to process a local PDF file. It requires the SDK import, path resolution, and a credentials object with an API key. ```javascript import { zerox } from "zerox"; import path from "path"; const result = await zerox({ filePath: path.resolve(__dirname, ""), credentials: { apiKey: process.env.OPENAI_API_KEY, }, }); ``` -------------------------------- ### Extract API Reference Source: https://docs.getomni.ai/docs/introduction Documentation for the OmniAI Extract API, detailing its capabilities for document OCR and structured data extraction. It supports various file formats and custom JSON schema formatting for output. ```APIDOC API Endpoint: /extract Functionality: - Document OCR: Parse PDFs, DOCX, PPT, images, and more into markdown. - Structured Extraction: Format responses by passing in a custom JSON schema. Capabilities: - Supports OCR for a wide range of document types. - Enables structured data extraction based on user-defined schemas. Related Concepts: - Document-based Workflows - Data Connectors (Postgres, Snowflake, MongoDB, Google Drive, etc.) - Continuous and batch data processing ``` -------------------------------- ### Use Zerox SDK with File URL (Node.js) Source: https://docs.getomni.ai/zerox/nodejs Example of using the Zerox SDK in Node.js to process a PDF from a file URL. It requires the SDK import and a credentials object with an API key. ```javascript import { zerox } from "zerox"; const result = await zerox({ filePath: "https://omni-demo-data.s3.amazonaws.com/test/cs101.pdf", credentials: { apiKey: process.env.OPENAI_API_KEY, }, }); ``` -------------------------------- ### Java Variable Declaration and Assignment Example Source: https://docs.getomni.ai/zerox/python Illustrates fundamental Java syntax for declaring variables with specific types and assigning values. It covers naming conventions, the assignment operator, and the concept of default values for instance variables. ```java int numUnits; double costPerUnit; char firstInitial; boolean isStudent; // Example assignment: numUnits = 10; costPerUnit = 25.50; firstInitial = 'A'; isStudent = true; ``` -------------------------------- ### OpenAI Model Support Source: https://docs.getomni.ai/zerox/nodejs Details the supported OpenAI models and their required API credentials. ```APIDOC Provider: OpenAI Supported models: - gpt-4o - gpt-4o-mini Credentials: apiKey: string (Required) ``` -------------------------------- ### OmniAI Embedded Widget Quickstart Source: https://docs.getomni.ai/api-reference/embedded/bank-statements Demonstrates how to load the OmniAI embedded JavaScript library, mount the widget to a specified container element, and configure its behavior using various options and event handlers. ```html OmniAI Bank Statement Widget
``` -------------------------------- ### Python ZeroxOutput Structure Example Source: https://docs.getomni.ai/zerox/python Demonstrates the structure of a ZeroxOutput object, commonly used to encapsulate results from AI LLM text processing. It includes fields for completion time, token counts, and a list of processed pages, each containing content and metadata. ```python ZeroxOutput( completion_time=9432.975, file_name='cs101', input_tokens=36877, output_tokens=515, pages=[ Page( page=1, content='| Type | Description | Wrapper Class |\n' + '|---------|--------------------------------------|---------------|\n' + '| byte | 8-bit signed 2s complement integer | Byte |\n' + '| short | 16-bit signed 2s complement integer | Short |\n' + '| int | 32-bit signed 2s complement integer | Integer |\n' + '| long | 64-bit signed 2s complement integer | Long |\n' + '| float | 32-bit IEEE 754 floating point number| Float |\n' + '| double | 64-bit floating point number | Double |\n' + '| boolean | may be set to true or false | Boolean |\n' + '| char | 16-bit Unicode (UTF-16) character | Character |\n\n' + 'Table 26.2.: Primitive types in Java\n\n' + '### 26.3.1. Declaration & Assignment\n\n' + 'Java is a statically typed language meaning that all variables must be declared before you can use ' + 'them or refer to them. In addition, when declaring a variable, you must specify both its type and ' + 'its identifier. For example:\n\n' + '```java\n' + 'int numUnits;\n' + 'double costPerUnit;\n' + 'char firstInitial;\n' + 'boolean isStudent;\n' + '```\n\n' + 'Each declaration specifies the variable’s type followed by the identifier and ending with a ' + 'semicolon. The identifier rules are fairly standard: a name can consist of lowercase and ' + 'uppercase alphabetic characters, numbers, and underscores but may not begin with a numeric ' + 'character. We adopt the modern camelCasing naming convention for variables in our code. In ' + 'general, variables must be assigned a value before you can use them in an expression. You do not ' + 'have to immediately assign a value when you declare them (though it is good practice), but some ' + 'value must be assigned before they can be used or the compiler will issue an error.\n\n' + 'The assignment operator is a single equal sign, `=` and is a right-to-left assignment. That is, ' + 'the variable that we wish to assign the value to appears on the left-hand-side while the value ' + '(literal, variable or expression) is on the right-hand-side. Using our variables from before, ' + 'we can assign them values:\n\n' + '> 2 Instance variables, that is variables declared as part of an object do have default values. ' + 'For objects, the default is `null`, for all numeric types, zero is the default value. For the ' + 'boolean type, `false` is the default, and the default char value is `\0`, the null-terminating ' + 'character (zero in the ASCII table).', content_length=2333 ) ] ) ```