Custom adapters are created based on the data source, the format of the incoming data, and the proprietary logic written in the code. They include various elements configured together to deliver data to and publish data from the adapter. These elements include a task payload, APIs, and a data source type schema — all of which can be configured in a number of combinations.
Basic adapter sequence
The basic adapter sequence starts with the system creating a new job with an ingestion task targeted at the adapter.
Then, the adapter needs to handle:
- The adapter receives a JSON payload with task details
- The adapter instance calls the external system and coordinates the data collection task.
- The adapter acquires the raw data from the input source and generates output according to its objectives (stream, chunk, or raw format).
If building a custom adapter, each step in this sequence must be built into your code.
If the output of an adapter is a stream audio or video for downstream tasks, the best format is ffmpeg nut container. This helps ensure consumers of the stream (especially tasks with engines using ffmpeg to segment the stream further) are able to access it.
In the GraphQL API, adapters are identified as engines where EngineType=Ingestion.
Source type and schema
An adapter references a source type and contains a schema that describes the structure for incoming data. A source type might be audio, YouTube content, a Dropbox file, or a podcast, for example. A full list of supported source types is in the table below.
Together, a source type and schema define a set of fields that can be queried. When your adapter runs, it runs against the schema of the Source Type ID received in the task payload.
Your adapter must specify what source type(s) it supports by declaring an array of source type IDs in the manifest file:
| { "ingestion": { "supportedSourceTypes": ["6"] } } |
A list of source types can be retrieved by calling the getSourceTypes query.
query getSourceTypes {
sourceTypes {
records {
id
name
}
}
}
The source types currently supported are:
| ID | Source type |
|---|
| 1 | Audio |
| 2 | Broadcast TV |
| 3 | YouTube channel |
| 4 | Podcast |
| 5 | General |
| 6 | Web stream |
| 7 | Push App |
| 10 | Mobile device capture |
| 11 | Amazon S3 |
| 12 | Dropbox |
| 13 | SIP stream |
| 14 | Google drive |
| 15 | RSS |
| 16 | FTP |
| 17 | YouTube video |
| 18 | YouTube live stream |
| 19 | Amazon Kinesis video |
| 20 | SFTP |
| 21 | NAS |
| 22 | Box |
| 23 | External application |
query getSourceType {
sourceType(id: 6) {
name
sourceSchema {
id
validActions
definition
}
organizationId
}
}
[Note] Although a schema cannot be modified, you can add a subset of custom fields to the query.
Payload
Upon execution, your adapter receives a task payload that includes the source ID for ingestion.
When constructing your adapter, specific data fields must be used to define the inputs to and outputs from your service. Each adapter type has supported data types and required fields, and there are advanced options you can set to control other aspects of how data is delivered to its defined output.
Deployment models
Adapters can be deployed in ways that can satisfy security and compliance requirements, if needed. In most cases, adapters will be deployed for external access.
- Network isolated deployment: the adapter performs within its container and does not send user data off the container.
- External access deployment: the adapter requires internet access for tasks such as license checks, database updates, and retrieving the ingestion data.
Compliance testing
Each build that is uploaded to Veritone is required to undergo compliance testing to ensure it works securely and meets the needs of Veritone's customers. Part of this testing includes a vulnerability scan of the Docker image to detect security issues and potential vulnerabilities. A build must pass the compliance testing before it can be deployed to production in Veritone. If security issues are found, a report that details the results of the testing is provided to give insight as to why the build did not pass.
Adapter states
aiWARE uses adapter states to capture the most relevant aspects of an adapter's lifecycle and operations and to help you easily identify and track your adapter's progression through the development workflow.
There are four available states for adapters, three of which apply to workflow stages. Workflow-related states are automatically set by the system and transition from one to the next when certain functions are carried out.
- Upon registration, an adapter enters the Pending state.
- From there, the adapter progresses to Ready when a build is approved.
- The adapter becomes Active when it's live in the Veritone platform.
- The final non-workflow state allows you to manually disable an adapter and stop it from processing new tasks.
The table below provides additional information about each of the adapter states, including details about transitions and optional actions that can be performed.
| Adapter state | Description | Available actions |
|---|
| Pending | The Pending state is system-triggered and takes effect when the adapter has been created but it does not have any Approved builds. | Edit, Disable, Delete |
| Ready | The Ready state is system-triggered and takes effect when an adapter has at least one approved build, but no builds that are deployed. | Edit, Disable, Delete |
| Active | The Active state is system-triggered and takes effect when a build is deployed. | Edit, Disable, Delete |
| Disabled | The Disabled state is user-enabled. Disabling an adapter prevents it from running and processing new tasks. Any tasks that are in progress when the adapter is disabled will finish processing. In addition, when a build is Disabled, the Deploy option will be removed from any Approved builds. An adapter can only be set to Disabled from the Ready or Active states. | Enable |
Build states
The build state allows you to easily identify and track a build's progression through the workflow cycle. Veritone uses seven different states to capture the most relevant aspects of a build's lifecycle stages and general operations.
| Build state | Description | Available Actions |
|---|
| Fetching | The Fetching state is system-triggered and takes effect when the build has been successfully uploaded and is undergoing compliance testing. | N/A |
| Available | The Available state is system-triggered and takes effect when a build successfully completes and passes the compliance testing process. A build in the Available state can be deployed to production. | Submit, Delete, Download Build Report |
| Invalid | The Invalid state is system-triggered and takes effect when a build fails the compliance testing process. A report can be downloaded that presents testing results. | Delete, Download Build Report |
| Deploying | The Deploying state is user-triggered upon clicking Deploy. It displays while the system is in the process of deploying the adapter. | N/A |
| Disapproved | The Disapproved state is system-triggered and takes effect when a build is not approved for deployment. | Delete |
| Deployed | The Deployed state is system-triggered and takes effect when an adapter is Deployed. This status automatically sets the adapter's state as Active. | Pause, Delete, Download Build Report |
| Paused | The Paused state is user-triggered and suspends operation of the build. A build can be manually put in the Paused state, or a previously deployed build will enter the Paused state when a new build is Deployed. | Unpause, Delete, Download Build Report |
The build approach
In the Resource Center utility, the term adapter is used to reference the external-facing, user-friendly representation of your software. You can build an adapter to ingest data from an external source that's not already supported and upload to Resource Center as a resource.
The actual code and processing algorithms are contained in a build. A single adapter can contain multiple builds, but only one build can be deployed in production at a time. The adapter and build approach allows you to update, test, and refine your code while offering the latest version of your adapter to the marketplace. Once a new build is approved, it can be deployed to production and replace the existing one.