Skip to content

Commit

Permalink
docs: update astradb imports to in docs/sample notebook to import fro…
Browse files Browse the repository at this point in the history
…m partner package (langchain-ai#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.
  • Loading branch information
hemidactylus authored Feb 16, 2024
1 parent 19ebc74 commit 2a23971
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
8 changes: 4 additions & 4 deletions docs/docs/integrations/providers/astradb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pip install "astrapy>=0.7.1"
## Vector Store

```python
from langchain_community.vectorstores import AstraDB
vector_store = AstraDB(
from langchain_astradb import AstraDBVectorStore
vector_store = AstraDBVectorStore(
embedding=my_embedding,
collection_name="my_store",
api_endpoint="...",
Expand Down Expand Up @@ -82,10 +82,10 @@ Learn more in the [example notebook](/docs/integrations/document_loaders/astradb
## Self-querying retriever

```python
from langchain_community.vectorstores import AstraDB
from langchain_astradb import AstraDBVectorStore
from langchain.retrievers.self_query.base import SelfQueryRetriever

vector_store = AstraDB(
vector_store = AstraDBVectorStore(
embedding=my_embedding,
collection_name="my_store",
api_endpoint="...",
Expand Down
31 changes: 24 additions & 7 deletions docs/docs/integrations/vectorstores/astradb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
"id": "bb9be7ce-8c70-4d46-9f11-71c42a36e928",
"metadata": {},
"source": [
"### Setup and general dependencies"
"## Setup and general dependencies"
]
},
{
"cell_type": "markdown",
"id": "dbe7c156-0413-47e3-9237-4769c4248869",
"metadata": {},
"source": [
"Use of the integration requires the following Python package."
"Use of the integration requires the corresponding Python package:"
]
},
{
Expand All @@ -49,16 +49,33 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install --upgrade --quiet \"astrapy>=0.7.1\""
"pip install --upgrade langchain-astradb"
]
},
{
"cell_type": "markdown",
"id": "2453d83a-bc8f-41e1-a692-befe4dd90156",
"metadata": {},
"source": [
"_Note: depending on your LangChain setup, you may need to install/upgrade other dependencies needed for this demo_\n",
"_(specifically, recent versions of `datasets`, `langchain-openai` and `pypdf` are required, along with `langchain-community`)._"
"_**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:_"
]
},
{
"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"
]
},
{
Expand Down Expand Up @@ -118,7 +135,7 @@
"metadata": {},
"outputs": [],
"source": [
"from langchain_community.vectorstores import AstraDB"
"from langchain_astradb import AstraDBVectorStore"
]
},
{
Expand Down Expand Up @@ -167,7 +184,7 @@
"metadata": {},
"outputs": [],
"source": [
"vstore = AstraDB(\n",
"vstore = AstraDBVectorStore(\n",
" embedding=embe,\n",
" collection_name=\"astra_vector_demo\",\n",
" api_endpoint=ASTRA_DB_API_ENDPOINT,\n",
Expand Down

0 comments on commit 2a23971

Please sign in to comment.