Kendi Kendine Sorgulama ve Kaynak Gösterme
Doğal dili üstveri filtrelerine dönüştüren kendi kendine sorgulayan getiriciler ve kullanıcıların güvenip doğrulayabileceği kaynak gösteren yanıtlarla RAG'ı daha ileri taşıyın.
Kendi Kendine Sorgulama ve Kaynak Gösterme, CoddyKit'te ücretsiz bir LLM Apps in Production (RAG + Vector DB + Caching) dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, LLM Apps in Production (RAG + Vector DB + Caching) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. LLM Apps in Production (RAG + Vector DB + Caching) kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
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.
Sıkça Sorulan Sorular
“Kendi Kendine Sorgulama ve Kaynak Gösterme” dersi ücretsiz mi?
Evet — “Kendi Kendine Sorgulama ve Kaynak Gösterme” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve LLM Apps in Production (RAG + Vector DB + Caching) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. LLM Apps in Production (RAG + Vector DB + Caching) kursu toplamda 4 dersten oluşur.
“Kendi Kendine Sorgulama ve Kaynak Gösterme” dersinde ne öğreneceğim?
Doğal dili üstveri filtrelerine dönüştüren kendi kendine sorgulayan getiriciler ve kullanıcıların güvenip doğrulayabileceği kaynak gösteren yanıtlarla RAG'ı daha ileri taşıyın. LLM Apps in Production (RAG + Vector DB + Caching) ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
LLM Apps in Production (RAG + Vector DB + Caching) öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te LLM Apps in Production (RAG + Vector DB + Caching), başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Kendi Kendine Sorgulama ve Kaynak Gösterme” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu LLM Apps in Production (RAG + Vector DB + Caching) dersinde kod yazıp çalıştırabilir miyim?
Evet. Her LLM Apps in Production (RAG + Vector DB + Caching) dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Sorgu Yeniden Yazma ve Yeniden Sıralama
- Çok Aşamalı ve Ajan Tabanlı RAG Kalıpları
- Karmaşık Belge Yapılarını Ele Alma
- Kendi Kendine Sorgulama ve Kaynak Gösterme