mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-01 10:54:15 +00:00
docs: update astradb imports to in docs/sample notebook to import from partner package (#17627)
This PR replaces the imports of the Astra DB vector store with the newly-released partner package, in compliance with the deprecation notice now attached to the community "legacy" store.
This commit is contained in:
parent
19ebc7418e
commit
2a239710a0
@ -14,8 +14,8 @@ pip install "astrapy>=0.7.1"
|
|||||||
## Vector Store
|
## Vector Store
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain_community.vectorstores import AstraDB
|
from langchain_astradb import AstraDBVectorStore
|
||||||
vector_store = AstraDB(
|
vector_store = AstraDBVectorStore(
|
||||||
embedding=my_embedding,
|
embedding=my_embedding,
|
||||||
collection_name="my_store",
|
collection_name="my_store",
|
||||||
api_endpoint="...",
|
api_endpoint="...",
|
||||||
@ -82,10 +82,10 @@ Learn more in the [example notebook](/docs/integrations/document_loaders/astradb
|
|||||||
## Self-querying retriever
|
## Self-querying retriever
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain_community.vectorstores import AstraDB
|
from langchain_astradb import AstraDBVectorStore
|
||||||
from langchain.retrievers.self_query.base import SelfQueryRetriever
|
from langchain.retrievers.self_query.base import SelfQueryRetriever
|
||||||
|
|
||||||
vector_store = AstraDB(
|
vector_store = AstraDBVectorStore(
|
||||||
embedding=my_embedding,
|
embedding=my_embedding,
|
||||||
collection_name="my_store",
|
collection_name="my_store",
|
||||||
api_endpoint="...",
|
api_endpoint="...",
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
"id": "bb9be7ce-8c70-4d46-9f11-71c42a36e928",
|
"id": "bb9be7ce-8c70-4d46-9f11-71c42a36e928",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### Setup and general dependencies"
|
"## Setup and general dependencies"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@
|
|||||||
"id": "dbe7c156-0413-47e3-9237-4769c4248869",
|
"id": "dbe7c156-0413-47e3-9237-4769c4248869",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"Use of the integration requires the following Python package."
|
"Use of the integration requires the corresponding Python package:"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -49,7 +49,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"%pip install --upgrade --quiet \"astrapy>=0.7.1\""
|
"pip install --upgrade langchain-astradb"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -57,8 +57,25 @@
|
|||||||
"id": "2453d83a-bc8f-41e1-a692-befe4dd90156",
|
"id": "2453d83a-bc8f-41e1-a692-befe4dd90156",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"_Note: depending on your LangChain setup, you may need to install/upgrade other dependencies needed for this demo_\n",
|
"_**Note.** the following are all packages required to run the full demo on this page. Depending on your LangChain setup, some of them may need to be installed:_"
|
||||||
"_(specifically, recent versions of `datasets`, `langchain-openai` and `pypdf` are required, along with `langchain-community`)._"
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "56c1f86e-5921-4976-ac8f-1d62e5a512b0",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"pip install langchain langchain-openai datasets pypdf"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "c2910035-e61f-48d9-a110-d68c401b62aa",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"### Import dependencies"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -118,7 +135,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from langchain_community.vectorstores import AstraDB"
|
"from langchain_astradb import AstraDBVectorStore"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -167,7 +184,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"vstore = AstraDB(\n",
|
"vstore = AstraDBVectorStore(\n",
|
||||||
" embedding=embe,\n",
|
" embedding=embe,\n",
|
||||||
" collection_name=\"astra_vector_demo\",\n",
|
" collection_name=\"astra_vector_demo\",\n",
|
||||||
" api_endpoint=ASTRA_DB_API_ENDPOINT,\n",
|
" api_endpoint=ASTRA_DB_API_ENDPOINT,\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user