Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] index.list() error message for non-serverless indexes is unclear #331

Open
2 tasks done
shamussim-ai opened this issue Apr 17, 2024 · 6 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@shamussim-ai
Copy link

shamussim-ai commented Apr 17, 2024

Is this a new bug in the Pinecone Python client?

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

Current Behavior

I followed the code exactly from the documentation

from pinecone import Pinecone

pc = Pinecone(api_key='34zzzzzzzzzz')
index = pc.Index('self-retriever-pae')

# To iterate over all result pages using a generator function
for ids in index.list( namespace="Non_Varicea"):
    print(ids)

This succeeds (as expected) against a serverless index, but when run on a pod-based index (which indeed does not support list()) an unclear error message is returned:

PineconeApiTypeError: Invalid type for variable 'received_data'. Required value type is ListResponse and passed type was str at ['received_data']

Expected Behavior

When run on a non-serverless index (which do not support list()) a clear error message that this is an unsupported operation should be displayed.

Steps To Reproduce

Run code using env specified

Code

from pinecone import Pinecone

pc = Pinecone(api_key='34zzzzzzzzzz')
index = pc.Index('self-retriever-pae')

# To iterate over all result pages using a generator function
for ids in index.list( namespace="Non_Varicea"):
    print(ids)

Relevant log output

PineconeApiTypeError                      Traceback (most recent call last)
[<ipython-input-10-ccee60efe570>](https://localhost:8080/#) in <cell line: 8>()
      6 
      7 # To iterate over all result pages using a generator function
----> 8 for ids in index.list( namespace="Non_Variceal_hi_res"):
      9     print(ids)

10 frames
[/usr/local/lib/python3.10/dist-packages/pinecone/core/client/model_utils.py](https://localhost:8080/#) in attempt_convert_item(input_value, valid_classes, path_to_item, configuration, spec_property_naming, key_type, must_convert, check_type)
   1419         if configuration is None or not configuration.discard_unknown_keys:
   1420             raise get_type_error(input_value, path_to_item, valid_classes,
-> 1421                                  key_type=key_type)
   1422     for valid_class in valid_classes_coercible:
   1423         try:

PineconeApiTypeError: Invalid type for variable 'received_data'. Required value type is ListResponse and passed type was str at ['received_data']

Environment

- OS:Windows
- Python:3.11
- pinecone: 3.0.03

Additional Context

none

@shamussim-ai shamussim-ai added the bug Something isn't working label Apr 17, 2024
@volksport
Copy link

Can confirm this is also an issue for us

@shamussim-ai
Copy link
Author

Hi there, any updates on this? Thank you

@daverigby
Copy link
Contributor

I attempted to reproduce this on the latest version (v4.0.0) on macOS and don't see the problem anymore.

@cbelsole
Copy link

cbelsole commented Aug 5, 2024

@daverigby I finally figured out why this was not working. This only works for a serverless index. The error message could probably be clearer.

@daverigby
Copy link
Contributor

@daverigby I finally figured out why this was not working. This only works for a serverless index. The error message could probably be clearer.

Thanks @cbelsole . I'll re-open and change to cover the fact that the error is not clear for non-server less indexes.

@daverigby daverigby reopened this Aug 6, 2024
@daverigby daverigby changed the title [Bug] index.list to List Vector IDs dont work [Bug] index.list() error message for non-serverless indexes is unclear Aug 6, 2024
@gildemberg-santos
Copy link

gildemberg-santos commented Oct 30, 2024

Additionally, this issue is occurring in version 5.3.1, and I experienced it on Google Cloud Run

RetryError[<Future at 0x3ee6ff794dc0 state=finished raised AttributeError>]

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
  File "/code/vector_store/providers/pinecone_vectorstore.py", line 150, in delete
    return self._delete_by_ids(ids)
  File "/code/vector_store/providers/pinecone_vectorstore.py", line 189, in _delete_by_ids
    raise e
  File "/code/vector_store/providers/pinecone_vectorstore.py", line 183, in _delete_by_ids
    ids_to_delete = list(self.index.list(prefix=id, limit=100))
  File "/usr/local/lib/python3.10/site-packages/pinecone/data/index.py", line 621, in list
    if len(results.vectors) > 0:
AttributeError: 'str' object has no attribute 'vectors'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants