Slide 47
Slide 47 text
©2023 DataStax. – All rights reserved
LangChain: LLM回答のキャッシュ
47
import langchain
from langchain.cache import InMemoryCache
langchain.llm_cache = InMemoryCache()
import langchain
from langchain.cache import CassandraCache
from cqlsession import getCQLSession, getCQLKeyspace
cqlMode = 'astra_db' # 'astra_db'/'local'
session = getCQLSession(mode=cqlMode)
keyspace = getCQLKeyspace(mode=cqlMode)
langchain.llm_cache = CassandraCache(
session=session,
keyspace=keyspace,
)
メモリ利用
Cassandra/Astra 利用