Batch process all your records to store structured outputs in Qdrant.

The requirements are as follows.

  • For the Unstructured Platform, only Qdrant Cloud is supported.

  • For Unstructured Ingest, Qdrant Cloud, Qdrant local, and Qdrant client-server are supported.

  • For Qdrant local, the path to the local Qdrant installation, for example: /qdrant/local

  • For Qdrant client-server, the Qdrant server URL, for example: http://localhost:6333

  • For Qdrant Cloud:

    • A Qdrant account.

    • A Qdrant cluster.

    • The cluster’s URL. To get this URL, do the following:

      1. Sign in to your Qdrant Cloud account.
      2. On the sidebar, under Dashboard, click Clusters.
      3. Click the cluster’s name.
      4. Note the value of the Endpoint field, for example: https://<random-guid>.<region-id>.<cloud-provider>.cloud.qdrant.io.
    • A Qdrant API key.

  • The name of the target collection on the Qdrant local installation, Qdrant server, or Qdrant Cloud cluster.

    Qdrant requires the target collection to exist before Unstructured can write to the collection. The following example code demonstrates the use of the Python Qdrant Client to create a collection on a Qdrant Cloud cluster, configuring the collection for vectors with 3072 dimensions:

    Python
    from qdrant_client import QdrantClient, models
    import os
    
    client = QdrantClient(
        url=os.getenv("QDRANT_URL"),
        api_key=os.getenv("QDRANT_API_KEY")
    )
    
    client.create_collection(
        collection_name=os.getenv("QDRANT_COLLECTION"),
        vectors_config=models.VectorParams(
            size=3072,
            distance=models.Distance.COSINE
        )
    )
    
    collection = client.get_collection(
                     collection_name=os.getenv("QDRANT_COLLECTION")
                 )
    
    print(f"The collection named '{os.getenv("QDRANT_COLLECTION")}' exists and " +
          f"has a status of '{collection.status}'.")
    

The Qdrant connector dependencies.

pip install "unstructured-ingest[qdrant]"

You might also need to install additional dependencies, depending on your needs. Learn more.

The following environment variables:

  • QDRANT_COLLECTION - The name of the target collection on the Qdrant local installation, Qdrant server, or Qdrant Cloud cluster, represented by --collection-name (CLI) or collection_name (Python).

  • For Qdrant local, QDRANT_PATH - The path to the local Qdrant installation, represented by --path (CLI) or path (Python).

  • For Qdrant client-server, QDRANT_URL - The Qdrant server’s URL, represented by --url (CLI) or url (Python).

  • For Qdrant Cloud:

    • QDRANT_URL - The Qdrant cluster’s URL, represented by --url (CLI) or url (Python).
    • QDRANT_API_KEY - The Qdrant API key, represented by --api-key (CLI) or api_key (Python).

Now call the Unstructured CLI or Python SDK. The source connector can be any of the ones supported.

This example uses the local source connector.

This example sends files to Unstructured API services for processing by default. To process files locally instead, see the instructions at the end of this page.

For the Unstructured Ingest CLI and the Unstructured Ingest Python library, you can use the --partition-by-api option (CLI) or partition_by_api (Python) parameter to specify where files are processed:

  • To do local file processing, omit --partition-by-api (CLI) or partition_by_api (Python), or explicitly specify partition_by_api=False (Python).

    Local file processing does not use an Unstructured API key or API URL, so you can also omit the following, if they appear:

    • --api-key $UNSTRUCTURED_API_KEY (CLI) or api_key=os.getenv("UNSTRUCTURED_API_KEY") (Python)
    • --partition-endpoint $UNSTRUCTURED_API_URL (CLI) or partition_endpoint=os.getenv("UNSTRUCTURED_API_URL") (Python)
    • The environment variables UNSTRUCTURED_API_KEY and UNSTRUCTURED_API_URL
  • To send files to Unstructured API services for processing, specify --partition-by-api (CLI) or partition_by_api=True (Python).

    Unstructured API services also requires an Unstructured API key and API URL, by adding the following:

    • --api-key $UNSTRUCTURED_API_KEY (CLI) or api_key=os.getenv("UNSTRUCTURED_API_KEY") (Python)
    • --partition-endpoint $UNSTRUCTURED_API_URL (CLI) or partition_endpoint=os.getenv("UNSTRUCTURED_API_URL") (Python)
    • The environment variables UNSTRUCTURED_API_KEY and UNSTRUCTURED_API_URL, representing your API key and API URL, respectively.

    Get an API key and API URL.