Skip to content

[Bug] Index.search() failing to execute. #661

@Shub-Agg

Description

@Shub-Agg

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

My python code has been using Index.search() method to query an index for a semantic search, running on v8.1.0 pinecone python sdk version.
Since 5-6 days ago, it has started throwing the following error:

Index.search() got an unexpected keyword argument 'query'
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/opentelemetry/trace/__init__.py", line 619, in use_span
    yield span
  File "/usr/local/lib/python3.11/site-packages/opentelemetry/sdk/trace/__init__.py", line 1173, in start_as_current_span
    yield span
  File "/app/services/tools/lms_pinecone_service.py", line 62, in vector_search_pinecone
    results = self._index.search(
              ^^^^^^^^^^^^^^^^^^^
TypeError: Index.search() got an unexpected keyword argument 'query'

Relevant Code Block:

query_dict = {
            "inputs": {"text": query["query"]},
            "top_k": top_k,
            "filter": filter_dict}

results = self._index.search(
    namespace=self._namespace,
    query=query_dict,
    fields=["text", "answer"]
    )

Expected Behavior

The error should not be shown and it should be working as intended.

Currently there are two ways I could find out to fix this issue:

  1. Upgrade to pinecone v9.0.0 and use Index.search() in the following way:
self._index.search(
    namespace=self._namespace, # Update to capture from .env
    inputs={"text": query['query']},
    top_k=top_k,
    filter = filter_dict,
    fields=["text", "answer"]
)
  1. Or keep the same query parameters and use Index.search_records() instead.

I would like to understand why this particular function suddenly started breaking, and/or if the function has been deprecated. I could not find any relevant changelog or migration guide for the same, especially since my Pinecone python sdk version has been unchanged.

If I did miss any release notes or changelog for this particular function(ality), please do let me know so I can keep an eye on it in the future as well.

Steps To Reproduce

  1. Running in a Docker Container, relevant DockerFile:
FROM --platform=linux/amd64 python:3.11-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8000

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
  1. Install pinecone python sdk version pinecone==8.1.0

  2. Execute Index.search() in the following manner:

results = self._index.search(
    namespace=self._namespace,
    query=query_dict,
    fields=["text", "answer"]
)

Relevant log output

Index.search() got an unexpected keyword argument 'query'
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/opentelemetry/trace/__init__.py", line 619, in use_span
    yield span
  File "/usr/local/lib/python3.11/site-packages/opentelemetry/sdk/trace/__init__.py", line 1173, in start_as_current_span
    yield span
  File "/app/services/tools/lms_pinecone_service.py", line 62, in vector_search_pinecone
    results = self._index.search(
              ^^^^^^^^^^^^^^^^^^^
TypeError: Index.search() got an unexpected keyword argument 'query'

Environment

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