Skip to content

Knowledge Base: Normalize file extensions #1192

Description

@AkhileshNegi

Is your feature request related to a problem?
An uppercase file extension (e.g., report.PDF) in a knowledge base document breaks collection creation due to the file being stored verbatim, while the OpenAI vector store rejects uppercase extensions. This causes the entire collection job to fail, affecting all documents in the batch.

Describe the solution you'd like

  • Normalize the filename to lowercase before upload to prevent rejection by OpenAI.
  • Provide a clear error message that names the offending file and lists supported extensions for documents that cannot be indexed, before any uploads occur.
Original issue

Describe the bug

A knowledge base document whose filename carries an uppercase extension (report.PDF) is accepted at upload but breaks collection creation. get_file_format lowercases the suffix (app/services/doctransform/registry.py:63), so the upload validates and the row is stored with fname verbatim — "report.PDF". OpenAIProvider.upload_files then passes that name straight to client.files.create(file=(doc.fname, tmp), ...), and the OpenAI vector store rejects an uppercase extension.

Because a failed file in a file batch is a hard failure that rolls back the whole vector store, a single .PDF document fails the entire collection job — every other document in the batch included.

A second, related gap: Kaapi accepts .csv, .xlsx and .xls at document upload, but OpenAI file search cannot index them. A collection built from those documents fails the same way, with an opaque provider error rather than a message naming the offending file.

To Reproduce

  1. POST /documents with a file named report.PDF → 200, document stored with fname = "report.PDF".
  2. POST /collections including that document.
  3. The collection job goes to FAILED; the vector store is rolled back and no document in the batch is indexed.

Same result for a document named data.csv.

Expected behavior

  • An uppercase extension indexes normally — the provider filename is normalized before upload.
  • A document whose extension OpenAI file search cannot index fails with an error naming the file and the supported extensions, before anything is uploaded, instead of collapsing the batch.

Additional context

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions