Dria는 개발자들이 공유 embedding lake에 기여하고 활용할 수 있는 공개 RAG 모델의 허브입니다. 이 노트북은 데이터 검색 작업을 위해 Dria API를 사용하는 방법을 보여줍니다.

Installation

dria 패키지가 설치되어 있는지 확인하세요. pip를 사용하여 설치할 수 있습니다:
pip install -qU dria

API Key 구성

접근을 위해 Dria API key를 설정하세요.
import os

os.environ["DRIA_API_KEY"] = "DRIA_API_KEY"

Dria Retriever 초기화

DriaRetriever의 인스턴스를 생성하세요.
from langchain_community.retrievers import DriaRetriever

api_key = os.getenv("DRIA_API_KEY")
retriever = DriaRetriever(api_key=api_key)

Knowledge Base 생성

Dria’s Knowledge Hub에서 knowledge를 생성하세요
contract_id = retriever.create_knowledge_base(
    name="France's AI Development",
    embedding=DriaRetriever.models.jina_embeddings_v2_base_en.value,
    category="Artificial Intelligence",
    description="Explore the growth and contributions of France in the field of Artificial Intelligence.",
)

데이터 추가

Dria knowledge base에 데이터를 로드하세요.
texts = [
    "The first text to add to Dria.",
    "Another piece of information to store.",
    "More data to include in the Dria knowledge base.",
]

ids = retriever.add_texts(texts)
print("Data added with IDs:", ids)

데이터 검색

retriever를 사용하여 쿼리와 관련된 문서를 찾으세요.
query = "Find information about Dria."
result = retriever.invoke(query)
for doc in result:
    print(doc)

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I