Skip to content

[Bug] Unable to run example notebook: pubmed-bm25.ipynb #340

Open
@paulz

Description

@paulz

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

0%
 0/32 [00:00<?, ?it/s]
---------------------------------------------------------------------------
SparseValuesMissingKeysError              Traceback (most recent call last)
[<ipython-input-22-8f2be8886c89>](https://dtujx39ytn-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240502-060125_RC00_630016150#) in <cell line: 5>()
     35     # new_vectors = { 'sparse_values': {'indices': indices, 'values': values}}
     36     # index.upsert(vectors=new_vectors)
---> 37     index.upsert(vectors=vectors)
     38 
     39 # show index description after uploading the documents

6 frames
[/usr/local/lib/python3.10/dist-packages/pinecone/data/vector_factory.py](https://dtujx39ytn-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240502-060125_RC00_630016150#) in _dict_to_sparse_values(sparse_values_dict, check_type)
    104             raise SparseValuesDictionaryExpectedError(sparse_values_dict)
    105         if not {"indices", "values"}.issubset(sparse_values_dict):
--> 106             raise SparseValuesMissingKeysError(sparse_values_dict)
    107 
    108         indices = convert_to_list(sparse_values_dict.get("indices"))

SparseValuesMissingKeysError: Missing required keys in data in column `sparse_values`. Expected format is `'sparse_values': {'indices': List[int], 'values': List[float]}`. Found keys [16984, 3526, 2331, 1006, 7473, 2094, 1007, 2003, 1996, 12222, 1997, 4442, 2306, 2019, 15923, 1012, 12922, 3269, 9706, 17175, 18150, 2239, 11934, 27806, 7137, 2566, 29278, 10708, 1999, 2049, 3727, 2083, 8676, 1037, 17779, 6198, 20134, 1998, 18323, 9607, 4372, 20464, 18606, 2024, 29111, 5158, 2012, 2415, 2122, 22901, 15436, 2015, 1010, 7458, 3155, 2274, 2013, 12436, 28817,

Expected Behavior

example notebooks should work without error

Steps To Reproduce

  1. run https://github.com/pinecone-io/examples/blob/master/learn/search/hybrid-search/fast-intro/pubmed-bm25.ipynb in Colab
  2. go through steps until error

Relevant log output

0%
 0/32 [00:00<?, ?it/s]
---------------------------------------------------------------------------
SparseValuesMissingKeysError              Traceback (most recent call last)
<ipython-input-22-8f2be8886c89> in <cell line: 5>()
     35     # new_vectors = { 'sparse_values': {'indices': indices, 'values': values}}
     36     # index.upsert(vectors=new_vectors)
---> 37     index.upsert(vectors=vectors)
     38 
     39 # show index description after uploading the documents

6 frames
/usr/local/lib/python3.10/dist-packages/pinecone/data/vector_factory.py in _dict_to_sparse_values(sparse_values_dict, check_type)
    104             raise SparseValuesDictionaryExpectedError(sparse_values_dict)
    105         if not {"indices", "values"}.issubset(sparse_values_dict):
--> 106             raise SparseValuesMissingKeysError(sparse_values_dict)
    107 
    108         indices = convert_to_list(sparse_values_dict.get("indices"))

SparseValuesMissingKeysError: Missing required keys in data in column `sparse_values`. Expected format is `'sparse_values': {'indices': List[int], 'values': List[float]}`. Found keys [16984, 3526, 2331, 1006, 7473, 2094, 1007, 2003, 1996, 12222, 1997, 4442, 2306, 2019, 15923, 1012, 12922, 3269, 9706, 17175, 18150, 2239, 11934, 27806, 7137, 2566, 29278, 10708, 1999, 2049, 3727, 2083, 8676, 1037, 17779, 6198, 20134, 


### Environment

```markdown
- **OS**: Google Colab
- **Language version**: Python
- **Pinecone client version**: default

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions