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]: Cohere in Bedrock with Pinecone #13688

Open
RiEnClVi opened this issue May 23, 2024 · 1 comment
Open

[Bug]: Cohere in Bedrock with Pinecone #13688

RiEnClVi opened this issue May 23, 2024 · 1 comment
Labels
bug Something isn't working triage Issue needs to be triaged/prioritized

Comments

@RiEnClVi
Copy link

Bug Description

I can still reproduce the bug in: #13376

If I use even the newest llama index

  • llama-index 0.10.38
  • llama-index-embeddings-bedrock 0.1.5
  • llama-index-vector-stores-pinecone 0.1.7

I don't have the bug if I just call the embeddings directly like in the first tutorial but:
https://docs.llamaindex.ai/en/stable/examples/embeddings/bedrock/?h=bedrock+emb

Doing this tutorial will fail:
https://docs.llamaindex.ai/en/stable/examples/vector_stores/PineconeIndexDemo/ (naturally if using bedrock embedding cohere)

This at least occurs if using node mode in combination of serverless AWS pinecone:

index = VectorStoreIndex(nodes, storage_context=storage_context, service_context=service_context)

or in certain examples in this mode too:

index.insert_nodes(subnodes)

Would be thankful if this could be solved.

Version

0.10.38

Steps to Reproduce

Use Bedrock cohere with pinecone serverless.

Like in your demo link. Reproduction should at least work if using node import.

Relevant Logs/Tracbacks

https://github.com/run-llama/llama_index/issues/13376 Same bug in special context. Whyever, I am surprised myself that it not disappeared.
@RiEnClVi RiEnClVi added bug Something isn't working triage Issue needs to be triaged/prioritized labels May 23, 2024
Copy link

dosubot bot commented May 23, 2024

To address the bug you're experiencing when using Bedrock cohere with Pinecone serverless in node mode with the llama-index, here are some steps and potential solutions:

Steps to Reproduce and Relevant Code

  1. Initialization of VectorStoreIndex:

    index = VectorStoreIndex(nodes, storage_context=storage_context, service_context=service_context)
  2. Inserting Nodes:

    index.insert_nodes(subnodes)

Potential Issues and Solutions

1. Ensure Correct Request and Response Formats

Ensure that the request and response formats are correctly handled for the "cohere.command-text-v14" model. Refer to the test cases provided in the test_bedrock.py file to verify the correct formats.

2. Pinecone Vector Store Implementation

Ensure that your implementation of the Pinecone vector store in the llama-index correctly handles the query and response formats. Here is an example of how the Pinecone vector store is implemented:

class PineconeVectorStore(BasePydanticVectorStore):
    # ... other methods ...

    def query(self, query: VectorStoreQuery, **kwargs: Any) -> VectorStoreQueryResult:
        # Implementation details...

3. Check Pinecone Client Version

Ensure you have the correct version of the Pinecone client installed. You can check and install the Pinecone client as follows:

from typing import Any
from packaging import version

def _import_pinecone() -> Any:
    try:
        import pinecone
    except ImportError as e:
        raise ImportError(
            "Could not import pinecone python package. "
            "Please install it with `pip install pinecone-client`."
        ) from e
    return pinecone

def _is_pinecone_v3() -> bool:
    pinecone = _import_pinecone()
    pinecone_client_version = pinecone.__version__
    return version.parse(pinecone_client_version) >= version.parse("3.0.0")

By ensuring the correct request and response formats, verifying the Pinecone vector store implementation, and checking the Pinecone client version, you should be able to resolve the bug. If the issue persists, please provide more specific details or logs to further diagnose the problem.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

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

No branches or pull requests

1 participant