Skip to content

Wire Documents.add_pdf() / Documents.add_csv() into the public client API #1

Description

@cferrys

Summary

The Python client currently advertises first-class local PDF and CSV ingestion, but the public Documents API does not actually implement add_pdf() or add_csv(). As shipped, the documented examples will fail at runtime with AttributeError, leaving a half-integrated ingestion feature in the newest modular client.

Context

The recent modular client work added parser utilities for local files in utils/pdf_parser.py and utils/csv_parser.py, and the README/examples position them as supported ingestion workflows. However, lib/documents.py only exposes CRUD, import, filter delete, and search methods; there is no public bridge from the client to those parsers.

This creates a high-impact mismatch in a search engine client, because document ingestion is the first mile of the indexing path. A broken ingestion helper blocks evaluation of the engine on real PDFs/CSVs and undermines trust in the client surface right after the new package/API expansion.

Relevant locations:

  • lib/documents.py
  • utils/pdf_parser.py
  • utils/csv_parser.py
  • README.md
  • examples/pdf.py
  • examples/csv.py

Proposed Implementation

  1. Add Documents.add_pdf(collection_name, file_path, options=None) and Documents.add_csv(collection_name, file_path, options=None) to lib/documents.py.
  2. In each method, parse the local file via the existing helper, build the document payload, and submit it through the existing add() path so validation/auth/request behavior stays centralized.
  3. Normalize option handling so callers can override document fields, IDs, metadata inclusion, and parser settings without bypassing validation.
  4. Add tests covering:
    • successful PDF/CSV ingestion helper flow
    • missing file / missing optional dependency failures
    • generated document shape
    • README example parity
  5. Keep README/examples aligned with the actual shipped API surface.

Impact

This fixes a user-facing runtime bug in the documented happy path, completes an already-started feature, and makes the Python client materially more useful for real indexing workloads. It also reduces onboarding friction for a high-performance search engine, where fast ingestion from local datasets is often the first proof-of-value step.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions