Skip to content
··4분 읽기

현재 챗봇 업그레이드

Weaviate의 하이브리드 검색과 쿼리 구조화를 테스트하기 위해 챗봇 Sydney를 업그레이드했습니다 — 금융 챗봇을 500개 이상의 기업으로 확장하는 데 필요한 기능입니다.

업데이트 (2026): Sydney는 이 Weaviate 실험 이후 많이 발전했습니다. FAISS, Weaviate 등을 테스트한 후, 프로덕션 버전에는 Supabase pgvector를 선택했습니다. Sydney는 이제 스트리밍 응답과 도구 사용으로 Claude에서 실행됩니다. 아래의 하이브리드 검색과 쿼리 구조화 아이디어가 오늘날 Sydney의 작동 방식에 직접적으로 영향을 주었습니다.

Sydney에게 물어보기 →


2024년 5월 원본 글은 맥락을 위해 아래에 보존됩니다.

최근 글에서 언급했듯이, 저는 자체 평가 금융 챗봇을 작업 중입니다. 그런데 왜 현재 챗봇 Sydney를 업데이트하러 돌아왔을까요? 몇 가지 이유가 있습니다:

  • Weaviate 벡터 저장소를 끝까지 테스트:
    • 금융 챗봇의 주요 벡터 저장소로 Weaviate를 사용하려 하지만, 확장/메모리 크기 문제에 부딪히고 있습니다. 구체적으로, 약 20개 기업의 지난 10년간 10K와 10Q 보고서만으로 weaviate 컬렉션의 크기가 이미 2GB입니다. 현재 접근 방식으로 전체 S&P 500 기업은 약 50+ GB의 컬렉션을 의미합니다. 너무 크고 운영/유지에 많은 비용이 들 것입니다. 그래서 다양한 Product Quantization (PQ) 매개변수를 테스트하고 있습니다.
    • 다른 많은 벡터 저장소를 시도한 후, 빠른 속도에서 메타데이터 필터와 함께 하이브리드 검색을 수행할 수 있는 능력 때문에 Weaviate에 기울고 있습니다.
    • Weaviate의 PQ 작업을 하면서, 프로덕션 환경에서 Weaviate를 어떻게 배포할지 — Weaviate Cloud를 사용할지 AWS/Google Cloud를 사용할지? 배포가 어려울까? 비용은 얼마나 될까? 라는 질문이 있었습니다.
    • 이런 질문들 때문에, 현재 챗봇 Sydney에 Weaviate를 배포하기로 했습니다. 기본적으로 FAISS를 Weaviate로 교체할 것입니다.
    • 현재 버전에서는 Weaviate Cloud를 사용하고 있습니다
  • 쿼리 변환과 쿼리 구조화를 구현하면서, 출력이 사용될 수 있도록 Json 형식인지 확인합니다.
    • 쿼리 변환으로 입력을 독립적으로 답할 수 있는 구체적인 하위 문제 또는 하위 질문 세트로 분해하는 것이 목표입니다.
    • 쿼리 구조화로: 하이브리드 검색에 적합한 검색어/구문뿐만 아니라 필터링에 적합한 메타데이터를 생성하는 것이 매우 중요합니다.
      • 금융 챗봇이 필요에 따라 연도, 산업 등을 올바르게 필터링하기를 원하기 때문에 이것은 매우 중요합니다.
  • 여러 필터를 사용한 하이브리드 검색을 수행하고 콘텐츠뿐만 아니라 메타데이터도 반환하는 방법.

보시다시피 금융 챗봇을 만들기 위해 위의 모든 것이 필요하므로, 먼저 훨씬 작은 규모에서 챗봇 Sydney에 적용해보는 것은 어떨까요 :)

이제 Sydney를 사용해 보실 수 있다는 것을 기쁘게 알립니다. 위의 모든 기능을 갖추고 있습니다. 아래와 같은 질문을 해보시면 관련 답변과 함께 콘텐츠를 가져온 특정 블로그 글 링크를 반환할 것입니다.

  • Chandler가 2020년에 Kevin Rudd에 대해 무엇을 썼나요?
  • Chandler가 2020년부터 현재까지 Ray Dalio에 대해 쓴 모든 것을 알려주세요
  • Chandler가 2022년에 Health Savings Accounts에 대해 무엇을 썼나요?
  • Chandler는 2015년에 무엇을 했나요?

지금은 여기까지입니다. 금융 챗봇 작업으로 돌아가야 합니다 :P

Weaviate나 메타데이터 필터를 사용한 하이브리드 검색을 실험해보신 적이 있다면, 무엇이 효과적이었는지 듣고 싶습니다.

감사합니다,

Chandler

2024년 9월 업데이트

Sydney는 이제 다재다능한 에이전트로 다음을 수행할 수 있습니다:

  • 현재 S&P 500 기업에 대한 질문에 답변하며, 지난 10년간 SEC에 제출한 내용을 포함합니다.
  • 15년간의 블로그 콘텐츠에서 통찰을 제공합니다.

여기에서 확인해보세요.

추신: 아래는 쿼리 변환과 쿼리 구조화에 사용하고 있는 프롬프트 유형의 예시입니다.

"You are a helpful assistant that generates multiple sub-questions related to an input question. "
             "The current year is 2024."
             "The goal is to break down the input into a set of specific sub-problems / sub-questions that can be answered in isolation. "
             "Each specific sub-question will be used to retrieve relevant content from a vector store, using similarity search with score. "
             "Phrase the wording of the questions appropriately for this purpose.\n"
             "This vector store includes all of the published blog posts from Chandler Nguyen's blog from 2007 to 2024.\n\n"
             "Original question: \{query\}\n\n"
             "Generate the minimum number of sub-questions necessary to answer the original question. "
             "Your response should be formatted as a JSON array of strings, where each string represents a sub-question. "
             "Do not include any additional words, characters, or explanations in the response.\n\n"
             "Example response:\n"
             '[\n'
             '  "sub-question 1",\n'
             '  "sub-question 2"\n'
             ']'
"""You are a helpful assistant that generates a structured query related to an input question.
The goal is to break down the input into a structured query that can be used to retrieve relevant content from a vector store, using similarity search with score.
This vector store includes all of the published blog posts from Chandler Nguyen's blog from 2007 to 2024.
Original question: \{query\}

You must generate a response in JSON format as described below without any additional words or characters:
[
    "content_search": Similarity search query used to apply to the content of the Chandler Nguyen published blog posts to find similar documents related to the sub-question(s). Ensure the content_search query is not too broad or too specific, and strikes a balance between relevance and completeness. \n
    "start_date": optional field, the start date to search for blog posts that are relevant to the sub-question(s) in YYYY-MM-DD format. If the sub-question(s) do not specify a time frame, leave this field blank or set it to the earliest possible date (e.g., 2007-01-01) to cover a broader range. \n
    "end_date": optional field, the end date to search for blog posts that are relevant to the sub-question(s) in YYYY-MM-DD format. If the sub-question(s) do not specify a time frame, leave this field blank or set it to the latest possible date (e.g., 2024-12-31) to cover a broader range. \n
]

If the sub-question(s) include multiple years or a specific time range, generate 1 response for each year or time range, enclosed in separate JSON objects within the outer array.

Example responses:

For an open-ended sub-question without a specific time frame:
Sub-questions: ["What are the key insights Chandler wrote about Health Savings Accounts (HSA)?"]
[
    "content_search": "Chandler Nguyen blog posts about Health Savings Accounts",
    "start_date": "2007-01-01",
    "end_date": "2024-12-31"
]

For a sub-question specifying a year:
Sub-questions: ["What blog posts did Chandler write in 2018?", "Which blog posts written by Chandler in 2018 mention Kevin Rudd?"]
[
    "content_search": "Chandler Nguyen blog posts in 2018",
    "start_date": "2018-01-01",
    "end_date": "2018-12-31"
],
[
    "content_search": "Kevin Rudd mentioned in Chandler Nguyen blog posts in 2018",
    "start_date": "2018-01-01",
    "end_date": "2018-12-31"
]

For a sub-question specifying a time range:
Sub-questions: ["What did Chandler write about Ray Dalio in 2020?", "What did Chandler write about Ray Dalio in 2021?", "What did Chandler write about Ray Dalio in 2022?"]
[
    "content_search": "Chandler Nguyen blog posts about Ray Dalio in 2020",
    "start_date": "2020-01-01",
    "end_date": "2020-12-31"
],
[
    "content_search": "Chandler Nguyen blog posts about Ray Dalio in 2021",
    "start_date": "2021-01-01",
    "end_date": "2021-12-31"
],
[
    "content_search": "Chandler Nguyen blog posts about Ray Dalio in 2022",
    "start_date": "2022-01-01",
    "end_date": "2022-12-31"
]
"""

추추신: 프론트엔드가 여전히 매우 느린 것을 알고 있으므로 프론트엔드 개발에 대해 더 배워야 할 것 같습니다.

계속 읽기

나의 여정
연결
언어
환경설정