Copy
---
title: AwaDB
---
>[AwaDB](https://github.com/awa-ai/awadb)는 LLM Application에서 사용하는 embedding vector의 검색 및 저장을 위한 AI Native 데이터베이스입니다.
이 integration을 사용하려면 `pip install -qU langchain-community`로 `langchain-community`를 설치해야 합니다
이 notebook은 `AwaDB`와 관련된 기능을 사용하는 방법을 보여줍니다.
```python
pip install -qU awadb
Copy
from langchain_community.document_loaders import TextLoader
from langchain_community.vectorstores import AwaDB
from langchain_text_splitters import CharacterTextSplitter
Copy
loader = TextLoader("../../how_to/state_of_the_union.txt")
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=100, chunk_overlap=0)
docs = text_splitter.split_documents(documents)
Copy
db = AwaDB.from_documents(docs)
query = "What did the president say about Ketanji Brown Jackson"
docs = db.similarity_search(query)
Copy
print(docs[0].page_content)
Copy
And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.
score를 포함한 유사도 검색
반환되는 distance score는 0-1 사이입니다. 0은 유사하지 않음, 1은 가장 유사함을 의미합니다Copy
docs = db.similarity_search_with_score(query)
Copy
print(docs[0])
Copy
(Document(page_content='And I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.', metadata={'source': '../../how_to/state_of_the_union.txt'}), 0.561813814013747)
이전에 생성하고 데이터를 추가한 table 복원하기
AwaDB는 추가된 document 데이터를 자동으로 유지합니다. 이전에 생성하고 추가한 table을 복원하려면, 아래와 같이 하면 됩니다:Copy
import awadb
awadb_client = awadb.Client()
ret = awadb_client.Load("langchain_awadb")
if ret:
print("awadb load table success")
else:
print("awadb load table failed")
Copy
---
<Callout icon="pen-to-square" iconType="regular">
[Edit the source of this page on GitHub.](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/vectorstores/awadb.mdx)
</Callout>
<Tip icon="terminal" iconType="regular">
[Connect these docs programmatically](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
</Tip>