mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-14 23:26:34 +00:00
Docs: Add self-querying retriever and store to AstraDB provider doc (#16362)
Add self-querying retriever and store to AstraDB provider doc
This commit is contained in:
parent
076dbb1a8f
commit
f9be877ed7
@ -40,7 +40,7 @@ set_llm_cache(AstraDBCache(
|
|||||||
))
|
))
|
||||||
```
|
```
|
||||||
|
|
||||||
Learn more in the [example notebook](/docs/integrations/llms/llm_caching) (scroll to the Astra DB section).
|
Learn more in the [example notebook](/docs/integrations/llms/llm_caching#astra-db-caches) (scroll to the Astra DB section).
|
||||||
|
|
||||||
|
|
||||||
### Semantic LLM Cache
|
### Semantic LLM Cache
|
||||||
@ -55,14 +55,14 @@ set_llm_cache(AstraDBSemanticCache(
|
|||||||
))
|
))
|
||||||
```
|
```
|
||||||
|
|
||||||
Learn more in the [example notebook](/docs/integrations/llms/llm_caching) (scroll to the appropriate section).
|
Learn more in the [example notebook](/docs/integrations/llms/llm_caching#astra-db-caches) (scroll to the appropriate section).
|
||||||
|
|
||||||
### Chat message history
|
### Chat message history
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from langchain.memory import AstraDBChatMessageHistory
|
from langchain.memory import AstraDBChatMessageHistory
|
||||||
message_history = AstraDBChatMessageHistory(
|
message_history = AstraDBChatMessageHistory(
|
||||||
session_id="test-session"
|
session_id="test-session",
|
||||||
api_endpoint="...",
|
api_endpoint="...",
|
||||||
token="...",
|
token="...",
|
||||||
)
|
)
|
||||||
@ -75,14 +75,62 @@ Learn more in the [example notebook](/docs/integrations/memory/astradb_chat_mess
|
|||||||
```python
|
```python
|
||||||
from langchain_community.document_loaders import AstraDBLoader
|
from langchain_community.document_loaders import AstraDBLoader
|
||||||
loader = AstraDBLoader(
|
loader = AstraDBLoader(
|
||||||
|
collection_name="my_collection",
|
||||||
api_endpoint="...",
|
api_endpoint="...",
|
||||||
token="...",
|
token="..."
|
||||||
collection_name="my_collection"
|
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Learn more in the [example notebook](/docs/integrations/document_loaders/astradb).
|
Learn more in the [example notebook](/docs/integrations/document_loaders/astradb).
|
||||||
|
|
||||||
|
### Self-querying retriever
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain_community.vectorstores import AstraDB
|
||||||
|
from langchain.retrievers.self_query.base import SelfQueryRetriever
|
||||||
|
|
||||||
|
vector_store = AstraDB(
|
||||||
|
embedding=my_embedding,
|
||||||
|
collection_name="my_store",
|
||||||
|
api_endpoint="...",
|
||||||
|
token="...",
|
||||||
|
)
|
||||||
|
|
||||||
|
retriever = SelfQueryRetriever.from_llm(
|
||||||
|
my_llm,
|
||||||
|
vector_store,
|
||||||
|
document_content_description,
|
||||||
|
metadata_field_info
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Learn more in the [example notebook](/docs/integrations/retrievers/self_query/astradb).
|
||||||
|
|
||||||
|
### Store
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain_community.storage import AstraDBStore
|
||||||
|
store = AstraDBStore(
|
||||||
|
collection_name="my_kv_store",
|
||||||
|
api_endpoint="...",
|
||||||
|
token="..."
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Learn more in the [example notebook](/docs/integrations/stores/astradb#astradbstore).
|
||||||
|
|
||||||
|
### Byte Store
|
||||||
|
|
||||||
|
```python
|
||||||
|
from langchain_community.storage import AstraDBByteStore
|
||||||
|
store = AstraDBByteStore(
|
||||||
|
collection_name="my_kv_store",
|
||||||
|
api_endpoint="...",
|
||||||
|
token="..."
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
Learn more in the [example notebook](/docs/integrations/stores/astradb#astradbbytestore).
|
||||||
|
|
||||||
## Apache Cassandra and Astra DB through CQL
|
## Apache Cassandra and Astra DB through CQL
|
||||||
|
|
||||||
@ -103,7 +151,7 @@ vector_store = Cassandra(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Learn more in the [example notebook](/docs/integrations/vectorstores/astradb) (scroll down to the CQL-specific section).
|
Learn more in the [example notebook](/docs/integrations/vectorstores/astradb#apache-cassandra-and-astra-db-through-cql) (scroll down to the CQL-specific section).
|
||||||
|
|
||||||
|
|
||||||
### Memory
|
### Memory
|
||||||
@ -123,7 +171,7 @@ from langchain.cache import CassandraCache
|
|||||||
langchain.llm_cache = CassandraCache()
|
langchain.llm_cache = CassandraCache()
|
||||||
```
|
```
|
||||||
|
|
||||||
Learn more in the [example notebook](/docs/integrations/llms/llm_caching) (scroll to the Cassandra section).
|
Learn more in the [example notebook](/docs/integrations/llms/llm_caching#cassandra-caches) (scroll to the Cassandra section).
|
||||||
|
|
||||||
|
|
||||||
### Semantic LLM Cache
|
### Semantic LLM Cache
|
||||||
@ -136,4 +184,4 @@ cassSemanticCache = CassandraSemanticCache(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Learn more in the [example notebook](/docs/integrations/llms/llm_caching) (scroll to the appropriate section).
|
Learn more in the [example notebook](/docs/integrations/llms/llm_caching#cassandra-caches) (scroll to the appropriate section).
|
||||||
|
Loading…
Reference in New Issue
Block a user