deepset-ai / haystack-core-integrations

Additional packages (components, document stores and the likes) to extend the capabilities of Haystack version 2.0 and onwards
https://haystack.deepset.ai
Apache License 2.0
83 stars 80 forks source link

psycopg.DataError: PostgreSQL text fields cannot contain NUL (0x00) bytes #751

Open M-JULIANI opened 3 months ago

M-JULIANI commented 3 months ago

Describe the bug

Running a simple embedding/indexing pipeline based on the pgvector integration (example).

Having no problem when running markdown files, when running the pipeline through pdf files, I get the following error on some pdfs:

psycopg.DataError: PostgreSQL text fields cannot contain NUL (0x00) bytes.

I wonder whether you all have come across this before and whether this might be a common case to solve for in document_writer.

I added a patch to that file to replace null bytes before attempting to write to pg vector

Error message psycopg.DataError: PostgreSQL text fields cannot contain NUL (0x00) bytes.

Expected behavior Would expect the pipeline to write valid content to the db, and perhaps ignore null bytes.

Additional context The PDF includes images, tables, etc. This is the type of PDF I will likely be ingesting, as opposed to a super clean and simple one. The PDF is 28MB.

To Reproduce

  1. Run the following (example) with a large PDF.

FAQ Check

System:

alez007 commented 3 months ago

just chipping in, I get the same error using the all-minilm ollama embedder and 384 dimensions. the pdf is an invoice so contains a simple table and text

CarlosFerLo commented 3 months ago

@alez007 Could you add more context, eg. code example or something.

ddorian commented 2 months ago

Insert this string into a text column to reproduce:

value = "\x1c\x00Þé`\U00104103Æ\U000eadac\U00018d30I"
masci commented 2 months ago

I'm moving this issue to the core-integrations repository because I think we should address this problem in the integration and not at the Haystack level, at least initially.