Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI Northstar Tech Vector io ExportVespa

From Leeroopedia
Knowledge Sources
Domains Export, Vector_Database, Vespa
Last Updated 2026-10-15 00:00 GMT

Overview

Concrete tool for exporting vector data from Vespa to the VDF format, provided by the vector-io library.

Description

The ExportVespa class is a concrete subclass of ExportVDB that implements vector data export from a Vespa instance. It connects to Vespa via a custom VespaClient (from marqo_vespa_util) using either a Vespa Cloud secret token or certificate/key pair for authentication.

The export flow accepts an endpoint URL, optional schemas list, and credentials (cloud secret token or cert file + private key file). The get_data method iterates over specified schemas and retrieves documents via VespaClient.get_all_documents with streaming enabled.

Note: This implementation is incomplete. The get_index_names method raises NotImplementedError (pyvespa does not support index enumeration), and get_data retrieves documents but does not complete the full export cycle (no parquet saving, no VDF_META.json writing). It is listed as "Not Supported" in the README.

Usage

Import this class when you need to export vector data from a Vespa instance to the VDF format. The class is auto-registered as the vespa subcommand of the export_vdf CLI via DB_NAME_SLUG = DBNames.VESPA.

Code Reference

Source Location

Signature

class ExportVespa(ExportVDB):
    DB_NAME_SLUG = DBNames.VESPA

    @classmethod
    def make_parser(cls, subparsers):
        """Register CLI subparser with Vespa-specific arguments:
        --endpoint, --vespa_cloud_secret_token, --cert_file, --pk_file, --schemas
        """

    @classmethod
    def export_vdb(cls, args: dict) -> "ExportVespa":
        """Factory classmethod: collect credentials interactively, instantiate, run get_data()."""

    def __init__(self, args: dict):
        """Initialize with args, calls super().__init__(args)."""

    def get_index_names(self) -> List[str]:
        """Raise NotImplementedError — not available in pyvespa."""

    def get_data(self):
        """Iterate schemas from args, call get_data_for_index for each."""

    def get_data_for_index(self, index_name: str):
        """Create VespaClient and fetch all documents for the schema with streaming."""

Import

from vdf_io.export_vdf.vespa_export import ExportVespa

I/O Contract

Inputs

Name Type Required Description
args dict Yes CLI argument dict
args.endpoint str Yes Vespa instance URL (default: http://localhost:8080)
args.vespa_cloud_secret_token str No Vespa Cloud secret token (alternative to cert/key)
args.cert_file str No Path to certificate file (alternative to token)
args.pk_file str No Path to private key file (required with cert_file)
args.schemas str No Comma-separated schema names to export

Outputs

Name Type Description
ExportVespa instance ExportVespa Returned by export_vdb() for metadata extraction
all_docs VisitDocumentsResponse Document batch from Vespa (via VespaClient)
document_count int Count of documents retrieved (printed)

Usage Examples

Programmatic Export

from vdf_io.export_vdf.vespa_export import ExportVespa

# 1. Prepare arguments
args = {
    "endpoint": "https://my-vespa-instance.vespacloud.net",
    "vespa_cloud_secret_token": "vespa_cloud_secret_abc123",
    "schemas": "my_schema",
    "model_name": "text-embedding-ada-002",
}

# 2. Run the export (collects credentials, fetches data)
vespa_export = ExportVespa.export_vdb(args)

Using Certificate-Based Auth

from vdf_io.export_vdf.vespa_export import ExportVespa

# 1. Prepare arguments with cert/key instead of cloud token
args = {
    "endpoint": "http://localhost:8080",
    "cert_file": "/path/to/cert.pem",
    "pk_file": "/path/to/private_key.pem",
    "schemas": "my_schema",
    "model_name": "text-embedding-ada-002",
}

# 2. Run the export
vespa_export = ExportVespa.export_vdb(args)

Related Pages

Implements Principle

Requires Environment

Related Implementations

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment