deepset-ai / deepset-ai/haystack-core-integrations

PgvectorDocumentStore - an error occurred while running the sample code in the official website documentation

Open
#1,714 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

integration:pgvector P3
Dominant language
Python
Stars
203
Forks
332
Avg merge
2d 4h
Merged PRs (30d)
80

Description

I am running the sample code of PgvectorDocumentStore, as follows:

Image
The above is an example of the PgvectorDocumentStore section of the document. I executed it intact and encountered the following error:
File "F:\AWorks\work_python\ragkb\test\PythonTest.py", line 407, in
document_store.write_documents([
File "F:\AWorks\work_python\ragkb.venv\lib\site-packages\haystack_integrations\document_stores\pgvector\document_store.py", line 432, in write_documents
db_documents = self._from_haystack_to_pg_documents(documents)
File "F:\AWorks\work_python\ragkb.venv\lib\site-packages\haystack_integrations\document_stores\pgvector\document_store.py", line 486, in _from_haystack_to_pg_documents
db_document["dataframe"] = Jsonb(db_document["dataframe"]) if db_document["dataframe"] else None
KeyError: 'dataframe'

Image
By locating the source code, I found that when document is converted into a dictionary, the old field dataframe is still needed. However, I am using version 2.13.1 and found that the dataframe field is ignored when it is converted into a dictionary. How can I solve this problem?

use haystack-ai 2.13.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with haystack_integrations/document_stores/pgvector/document_store.py, especially write_documents and _from_haystack_to_pg_documents, and compare their expected fields with the Haystack 2.13.1 Document dictionary used by the official PgvectorDocumentStore sample. Re-run the sample after investigating the mismatch and confirm that write_documents completes without the dataframe KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.