Skip to main content
If you’re new to Unstructured, read this note first.Before you can create a destination connector, you must first sign in to your Unstructured account:After you sign in, the Unstructured user interface (UI) appears, which you use to get your Unstructured API key.
  1. After you sign in to your Unstructured Starter account, click API Keys on the sidebar.
    For a Team or Enterprise account, before you click API Keys, make sure you have selected the organizational workspace you want to create an API key for. Each API key works with one and only one organizational workspace. Learn more.
  2. Click Generate API Key.
  3. Follow the on-screen instructions to finish generating the key.
  4. Click the Copy icon next to your new key to add the key to your system’s clipboard. If you lose this key, simply return and click the Copy icon again.
After you create the destination connector, add it along with a source connector to a workflow. Then run the worklow as a job. To learn how, try out the hands-on Workflow Endpoint quickstart, go directly to the quickstart notebook, or watch the two 4-minute video tutorials for the Unstructured Python SDK.You can also create destination connectors with the Unstructured user interface (UI). Learn how.If you need help, email Unstructured Support at support@unstructured.io.You are now ready to start creating a destination connector! Keep reading to learn how.
Send processed data from Unstructured to Astra DB. The requirements are as follows.
  • An IBM Cloud account or DataStax account.
    • For an IBM Cloud account, sign up for an IBMid, and then sign in to DataStax with your IBMid.
    • For a DataStax account, sign up for a DataStax account, and then sign in to DataStax with your DataStax account.
  • An Astra DB database in the DataStax account. To create a database: a. After you sign in to DataStax, click Create database.
    b. Click the Serverless (vector) tile, if it is not already selected.
    c. For Database name, enter some unique name for the database.
    d. Select a Provider and a Region, and then click Create database.
    Learn more.
  • An application token for the database. To create an application token: a. After you sign in to DataStax, in the list of databases, click the name of the target database.
    b. On the Overview tab, under Database Details, in the Application Tokens tile, click Generate Token.
    c. Enter some Token description and select and Expiration time period, and then click Generate token.
    d. Save the application token that is displayed to a secure location, and then click Close.
    Learn more.
  • A keyspace in the database. To create a keyspace: a. After you sign in to DataStax, in the list of databases, click the name of the target database.
    b. On the Data Explorer tab, in the Keyspace list, select Create keyspace.
    c. Enter some Keyspace name, and then click Add keyspace.
    Learn more.
  • A collection in the keyspace. For the Unstructured UI and Unstructured API:
    • An existing collection is not required. At runtime, the collection behavior is as follows:
      • If an existing collection name is specified, and Unstructured generates embeddings, but the number of dimensions that are generated does not match the existing collection’s embedding settings, the run will fail. You must change your Unstructured embedding settings or your existing collection’s embedding settings to match, and try the run again.
      • If a collection name is not specified, Unstructured creates a new collection in your keyspace. If Unstructured generates embeddings, the new collections’s name will be u<short-workflow-id>_<short-embedding-model-name>_<number-of-dimensions>. If Unstructured does not generate embeddings, the new collections’s name will be u<short-workflow-id.
    For Unstructured Ingest:
    • For the source connector only, an existing collection is required.
    • For the destination connector only, an existing collection is not required. At runtime, the collection behavior is as follows:
      • If an existing collection name is specified, and Unstructured generates embeddings, but the number of dimensions that are generated does not match the existing collection’s embedding settings, the run will fail. You must change your Unstructured embedding settings or your existing collections’s embedding settings to match, and try the run again.
      • If a collection name is not specified, Unstructured creates a new collection in your keyspace. The new collection’s name will be unstructuredautocreated.
    To create a collection yourself: a. After you sign in to DataStax, in the list of databases, click the name of the target database.
    b. On the Data Explorer tab, in the Keyspace list, select the name of the target keyspace.
    c. In the Collections list, select Create collection.
    d. Enter some Collection name.
    e. Turn on Vector-enabled collection, if it is not already turned on.
    f. For Embedding generation method, select Bring my own.
    g. For Dimensions, enter the number of dimensions for the embedding model that you plan to use.
    h. For Similarity metric, select Cosine.
    i. Click Create collection.
    Learn more.
To create an Astra DB destination connector, see the following examples.
import os

from unstructured_client import UnstructuredClient
from unstructured_client.models.operations import CreateDestinationRequest
from unstructured_client.models.shared import CreateDestinationConnector

with UnstructuredClient(api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")) as client:
    response = client.destinations.create_destination(
        request=CreateDestinationRequest(
            create_destination_connector=CreateDestinationConnector(
                name="<name>",
                type="astradb",
                config={
                    "token": "<token>",
                    "api_endpoint": "<api-endpoint>",
                    "collection_name": "<collection-name>",
                    "keyspace=": "<keyspace>",
                    "batch_size": <batch-size>,
                    "flatten_metadata": <True|False>
                }
            )
        )
    )

    print(response.destination_connector_information)
Replace the preceding placeholders as follows:
  • <name> (required) - A unique name for this connector.
  • <token> (required) - The application token for the database.
  • <api-endpoint> (required) - The database’s associated API endpoint.
  • <collection-name> - The name of the collection in the keyspace. If no value is provided, see the beginning of this article for the behavior at run time.
  • <keyspace> - The name of the keyspace in the collection. The default is default_keyspace if not otherwise specified.
  • <batch-size> - The maximum number of records to send per batch. The default is 20 if not otherwise specified.
  • flatten_metadata - Set to true to flatten the metadata into each record. Specifically, when flattened, the metadata key values are brought to the top level of the element, and the metadata key itself is removed. By default, the metadata is not flattened (false).
I