0Pricing
LLM Apps in Production (RAG + Vector DB + Caching) · 강의

자기 질의 및 인용

자연어를 메타데이터 필터로 변환하는 자기 질의 검색기로 RAG를 한 단계 발전시키고, 답변에 출처를 인용하여 사용자가 내용을 신뢰하고 검증할 수 있도록 합니다.

자기 질의 및 인용은(는) CoddyKit의 무료 LLM Apps in Production (RAG + Vector DB + Caching) 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 LLM Apps in Production (RAG + Vector DB + Caching) 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. LLM Apps in Production (RAG + Vector DB + Caching) 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

When Questions Carry Filters

Users ask things like give me 2023 reports about pricing. That sentence contains a filter (year 2023) and a semantic query (pricing).

A self-querying retriever automatically separates the two.

How Self-Querying Works

An LLM reads the question and emits a structured query: the semantic search string plus a metadata filter. The retriever then applies both to the vector store.

Describing Your Metadata

You tell the retriever what fields exist so it knows what it can filter on.

from langchain.chains.query_constructor.schema import AttributeInfo

fields = [
    AttributeInfo(name='year', description='Publication year', type='integer'),
    AttributeInfo(name='topic', description='Document topic', type='string')
]

Building the Retriever

Combine the LLM, the store, a content description, and the field info into a self-query retriever.

from langchain.retrievers.self_query.base import SelfQueryRetriever

retriever = SelfQueryRetriever.from_llm(
    llm, vectorstore,
    'Company reports', fields
)

Seeing It in Action

Now a natural-language question is split into a filter and a search automatically — no manual filter code.

docs = retriever.invoke(
    'pricing reports from 2023'
)

Why Citations Matter

In production, users must be able to verify answers. Unsourced answers are hard to trust and hide hallucinations. Citations link each claim back to its document.

Carrying Source Metadata

Citations rely on each chunk storing where it came from — file name, page, or URL — in its metadata. Set this at load time.

doc.metadata['source'] = 'policy.pdf#p3'

Prompting for Citations

Number the context chunks and ask the model to cite the numbers it used. This is simple and reliable.

ctx = '\n'.join(
    f'[{i}] {d.page_content}'
    for i, d in enumerate(docs)
)
# 'Cite sources like [1] after each claim.'

Mapping Numbers to Sources

After generation, map the cited numbers back to real source metadata so the UI can show clickable references.

sources = {i: d.metadata['source']
           for i, d in enumerate(docs)}

Verifying Citations

Models sometimes cite wrong or nonexistent sources. A safety check confirms each cited chunk actually supports the claim, flagging unsupported statements.

Putting It Together

Self-querying gets the right documents using filters in the question; citations make the resulting answer transparent. Together they raise both precision and trust in advanced RAG.

Quick Check

Test your advanced RAG knowledge.

Recap

You learned two advanced RAG techniques:

  • Self-querying turns natural language into metadata filters plus a semantic query
  • Describe your fields so the LLM knows what to filter
  • Citations link claims to sources for trust
  • Carry source metadata, prompt for citations, and verify them

Filtering and citing together make RAG both precise and trustworthy.

자주 묻는 질문

“자기 질의 및 인용” 강의는 무료인가요?

네 — “자기 질의 및 인용” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 LLM Apps in Production (RAG + Vector DB + Caching) 강의 전체를 잠금 해제할 수 있습니다. LLM Apps in Production (RAG + Vector DB + Caching) 강의에는 총 4개의 강의가 포함되어 있습니다.

“자기 질의 및 인용”에서 뭘 배우나요?

자연어를 메타데이터 필터로 변환하는 자기 질의 검색기로 RAG를 한 단계 발전시키고, 답변에 출처를 인용하여 사용자가 내용을 신뢰하고 검증할 수 있도록 합니다. 브라우저에서 직접 실행하는 실습 코드로 LLM Apps in Production (RAG + Vector DB + Caching)을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

LLM Apps in Production (RAG + Vector DB + Caching)을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 LLM Apps in Production (RAG + Vector DB + Caching)은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“자기 질의 및 인용” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 LLM Apps in Production (RAG + Vector DB + Caching) 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 LLM Apps in Production (RAG + Vector DB + Caching) 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 질의 재작성과 재순위화
  2. 다단계 및 에이전트 기반 RAG 패턴
  3. 복잡한 문서 구조 처리하기
  4. 자기 질의 및 인용
← LLM Apps in Production (RAG + Vector DB + Caching)(으)로 돌아가기