더북(TheBook)
# 예제 텍스트
documents = [
    Document(page_content="뉴턴은 1687년에 만유인력의 법칙을 발표했다."),
    Document(page_content="DNA 이중 나선 구조는 1953년 왓슨과 크릭에 의해 발견되었다."),
    Document(page_content="아인슈타인의 상대성 이론은 1905년과 1915년에 각각 특수 상대성이론과 일반 상대성이론으로 발표되었다."),
]

# OpenAI 임베딩 모델 설정
embeddings = OpenAIEmbeddings()

# FAISS 벡터 저장소 생성
vectorstore = FAISS.from_documents(documents, embeddings)

# 검색을 위한 retriever 생성
retriever = vectorstore.as_retriever()

# 사용자의 질문을 기반으로 검색 수행
query = "DNA 이중 나선 구조가 발견된 연도는?"


신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.