Llama Index - ตอนที่ 2 (QA และการประเมิน)
ตัวอย่างการผลิต
QA
User Case:
#What #What#
· สอบถามความหมาย (** Semantic search*/Top K)
- สรุป
"Where"
- Over documents
- Building a multi-document agent over the LlamaIndex docs
- Over structured data (เช่น JSON)
- Searching Pandas tables
- Text to SQL
"How"
ลิงค์ด้านบนชี้ไปที่: Q&A patterns ด้านล่าง
Q&A ที่ง่ายที่สุด
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("What did the author do growing up?")
print(response)
เลือกแหล่งข้อมูลต่าง ๆ (Route Datasource)
Compare/Contrast Queries
อันนี้ไม่เข้าใจ
Beside the explicit synthesis/routing flows described above, Llama Index can support general multi-document queries as well... It can do this through our in Sub Question Query Engineering class. Given a query, this query engine will generate a "query plan" containing sub-queries against sub-documents before synthesizing the final swerwer...
This query engine can execute number of sub-queries against sub sub-queries against sub sub-queries sub against sub sub sub-queries This makes it especially well-suited for compare/contrast queries across documents as squeries pertaining to a specific document...
Llama Index can also support support change multi-step queries Given a complex query, break it down into an initial subquestions, and sequential generate subques based on returned the final swhere is returned...
For instance, given a question "Who was in the first batch of the accelerator program the author started? ", the module will first decompose the question the question the who was in the first batch of the accelerator program the author started? ", the module will first decompose the question "Who was in the first batch of the accelerator program the author start
Eval
- การประเมินการตอบสนอง
- การประเมินการรับข้อมูล
- การประเมินการตอบสนอง
- ใช้ GPT-4 เพื่อประเมิน
- มิติของการประเมิน · คําตอบที่สร้างกับคําตอบอ้างอิง: ความถูกต้องและความเหมือนของความหมาย · คําตอบที่สร้างกับ retrived contexts: "Faithfulness"
- คําตอบที่สร้างกับQuery: Answer Releevancy
- retrieved contexts and Query: Context Relevency
- สร้างคําตอบอ้างอิง
- ประเมินการรับข้อมูล (retrival)
- วิธีการประเมิน : ranking merics like mean-reciprocal rank (MRR), hit-rate, precision, and more
ใช้ตัวอย่าง
ผนวกรวมเข้ากับเครื่องมืออื่น ๆ
- UpTrain: 1.9K:可试用,但是需要book demo,目测不便宜
- Tonic Validate(Includes Web UI for visualizing results):有商业版本,可试用,之后200美元/月
- DeepEval: 1.6K
- Ragas: 4.4K
- รู้สึกดี
- Llama index -> Ragas -> Lang Smith และเครื่องมืออื่นๆ
- แต่ขยี้มาก, การทํางาน quick start ล้มเหลว, การเตือนความจําร่วมกันของ Quick Module Not Error: No module named's.metrics; 'ragas' is not a package packages is not a package