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

docs: add Pinecone tab to "How to create and query vector stores" #22076

Closed
wants to merge 8 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions docs/docs/how_to/vectorstores.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,41 @@ pip install langchain-chroma
from langchain_chroma import Chroma

db = Chroma.from_documents(documents, OpenAIEmbeddings())
```

</TabItem>
<TabItem value="pinecone" label="Pinecone">

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the current vectorstores features here are local vectorstores if I'm not mistaken. We did this on purpose to avoid a race between vectorstores providing to populate the tabs on this page. cc @efriis

This walkthrough uses the `Pinecone` vector database, which provides broad functionality to store and search over vectors. For a more detailed guide to using Pinecone with LangChain, check out the [Pinecone integration page](/docs/integrations/vectorstores/pinecone).

```bash
pip install langchain-pinecone
```

```python
import time
from langchain_pinecone import PineconeVectorStore
from pinecone import Pinecone, ServerlessSpec

pc = Pinecone(api_key=pinecone_api_key)

os.environ['PINECONE_API_KEY'] = getpass.getpass('Pinecone API Key:')

index_name = "langchain-index" #change if desired

if index_name not in existing_indexes:
pc.create_index(
name=index_name,
dimension=1536,
metric="cosine",
spec=ServerlessSpec(cloud="aws", region="us-east-1"),
)
while not pc.describe_index(index_name).status["ready"]:
time.sleep(1)

index = pc.Index(index_name)

docsearch = PineconeVectorStore.from_documents(documents, OpenAIEmbeddings(), index_name=index_name)
```

</TabItem>
Expand Down
Loading