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

Evaluate Pinecone as optional alternative vector store #2

Open
tomdyson opened this issue Mar 7, 2023 · 2 comments
Open

Evaluate Pinecone as optional alternative vector store #2

tomdyson opened this issue Mar 7, 2023 · 2 comments

Comments

@tomdyson
Copy link
Owner

tomdyson commented Mar 7, 2023

Try out Pinecone as an optional alternative to FAISS. Expected pros: smaller container, lower memory use. Expected cons: slower indexing and querying because of network latency, cost for large document stores.

@tomdyson
Copy link
Owner Author

tomdyson commented Mar 7, 2023

From https://langchain.readthedocs.io/en/latest/ecosystem/pinecone.html:

  1. Add client as dependency: pip install pinecone-client (add to README and Dockerfile)
  2. Add import to microllama.py: from langchain.vectorstores import Pinecone

From Pinecone notebook example:

import pinecone 

# initialize pinecone
pinecone.init(
    api_key="YOUR_API_KEY",  # find at app.pinecone.io
    environment="YOUR_ENV"  # next to api key in console
)

pinecone_index_name = "langchain-demo"

Then something like

def build_pinecone_index():
    return Pinecone.from_documents(
        get_text_chunks(), OpenAIEmbeddings(), index_name=PINECONE_INDEX_NAME
    )

def get_pinecone_index(index_name=PINECONE_INDEX_NAME):
    return Pinecone.from_existing_index(index_name, OpenAIEmbeddings())

@tomdyson
Copy link
Owner Author

tomdyson commented Mar 7, 2023

Initial impressions are the Pinecone is noticeably slower than FAISS. I'd need to refactor get_index to support multiple index types. The check for an existing index (pinecone.describe_index("index-name")) is ~0.7s.

@tomdyson tomdyson changed the title Support Pinecone Evaluate Pinecone as optional alternative vector store Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant