mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-06 21:43:44 +00:00
pinecone: init pkg (#16556)
<!-- Thank you for contributing to LangChain! Please title your PR "<package>: <description>", where <package> is whichever of langchain, community, core, experimental, etc. is being modified. Replace this entire comment with: - **Description:** a description of the change, - **Issue:** the issue # it fixes if applicable, - **Dependencies:** any dependencies required for this change, - **Twitter handle:** we announce bigger features on Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out! Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` from the root of the package you've modified to check this locally. See contribution guidelines for more information on how to write/run tests, lint, etc: https://python.langchain.com/docs/contributing/ If you're adding a new integration, please include: 1. a test for the integration, preferably unit tests that do not rely on network access, 2. an example notebook showing its use. It lives in `docs/docs/integrations` directory. If no one reviews your PR within a few days, please @-mention one of @baskaryan, @eyurtsev, @hwchase17. -->
This commit is contained in:
@@ -7,6 +7,7 @@ import warnings
|
||||
from typing import TYPE_CHECKING, Any, Callable, Iterable, List, Optional, Tuple, Union
|
||||
|
||||
import numpy as np
|
||||
from langchain_core._api.deprecation import deprecated
|
||||
from langchain_core.documents import Document
|
||||
from langchain_core.embeddings import Embeddings
|
||||
from langchain_core.utils.iter import batch_iterate
|
||||
@@ -41,24 +42,16 @@ def _is_pinecone_v3() -> bool:
|
||||
return version.parse(pinecone_client_version) >= version.parse("3.0.0.dev")
|
||||
|
||||
|
||||
@deprecated(
|
||||
since="0.0.18", removal="0.2.0", alternative_import="langchain_pinecone.Pinecone"
|
||||
)
|
||||
class Pinecone(VectorStore):
|
||||
"""`Pinecone` vector store.
|
||||
|
||||
To use, you should have the ``pinecone-client`` python package installed.
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
from langchain_community.vectorstores import Pinecone
|
||||
from langchain_community.embeddings.openai import OpenAIEmbeddings
|
||||
import pinecone
|
||||
|
||||
# The environment should be the one specified next to the API key
|
||||
# in your Pinecone console
|
||||
pinecone.init(api_key="***", environment="...")
|
||||
index = pinecone.Index("langchain-demo")
|
||||
embeddings = OpenAIEmbeddings()
|
||||
vectorstore = Pinecone(index, embeddings, "text")
|
||||
This version of Pinecone is deprecated. Please use `langchain_pinecone.Pinecone`
|
||||
instead.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
Reference in New Issue
Block a user