面向開發(fā)者的LLM入門課程-評(píng)估英文版提(3): 英文版提示 3.通過LLM進(jìn)行評(píng)估實(shí)例 langchain.debug = False #為所有不同的示例創(chuàng)建預(yù)測(cè) predictions = qa.apply(example……
哈嘍!伙伴們,我是小智,你們的AI向?qū)?。歡迎來(lái)到每日的AI學(xué)習(xí)時(shí)間。今天,我們將一起深入AI的奇妙世界,探索“面向開發(fā)者的LLM入門課程-評(píng)估英文版提(3)”,并學(xué)會(huì)本篇文章中所講的全部知識(shí)點(diǎn)。還是那句話“不必遠(yuǎn)征未知,只需喚醒你的潛能!”跟著小智的步伐,我們終將學(xué)有所成,學(xué)以致用,并發(fā)現(xiàn)自身的更多可能性。話不多說,現(xiàn)在就讓我們開始這場(chǎng)激發(fā)潛能的AI學(xué)習(xí)之旅吧。
面向開發(fā)者的LLM入門課程-評(píng)估英文版提(3):
英文版提示
3.通過LLM進(jìn)行評(píng)估實(shí)例
langchain.debug = False
#為所有不同的示例創(chuàng)建預(yù)測(cè)
predictions = qa.apply(examples)# 對(duì)預(yù)測(cè)的結(jié)果進(jìn)行評(píng)估,導(dǎo)入QA問題回答,評(píng)估鏈,通過語(yǔ)言模型創(chuàng)建此鏈
from langchain.evaluation.qa import QAEvalChain #導(dǎo)入QA問題回答,評(píng)估鏈#通過調(diào)用chatGPT進(jìn)行評(píng)估
llm = ChatOpenAI(temperature=0)
eval_chain = QAEvalChain.from_llm(llm)#在此鏈上調(diào)用evaluate,進(jìn)行評(píng)估
graded_outputs = eval_chain.evaluate(examples, predictions)#我們將傳入示例和預(yù)測(cè),得到一堆分級(jí)輸出,循環(huán)遍歷它們打印答案
for i, eg in enumerate(examples):
print(f”Example {i}:”)
print(“Question: ” + predictions[i][‘query’])
print(“Real Answer: ” + predictions[i][‘answer’])
print(“Predicted Answer: ” + predictions[i][‘result’])
print(“Predicted Grade: ” + graded_outputs[i][‘results’])
print()
> Entering new RetrievalQA chain…
> Finished chain.
Example 0:
Question: Do the Cozy Comfort Pullover Set have side pockets?
Real Answer: Yes
Predicted Answer: Yes, the Cozy Comfort Pullover Set does have side pockets.
Predicted Grade: CORRECTExample 1:
Question: What collection is the Ultra-Lofty 850 Stretch Down Hooded Jacket from?
Real Answer: The DownTek collection
Predicted Answer: The Ultra-Lofty 850 Stretch Down Hooded Jacket is from the
DownTek collection.
Predicted Grade: CORRECTExample 2:
Question: What is the description of the Women’s Campside Oxfords?
Real Answer: The description of the Women’s Campside Oxfords is that they are an
ultracomfortable lace-to-toe Oxford made of super-soft canvas. They have thick
cushioning and quality construction, providing a broken-in feel from the first
time they are worn.
Predicted Answer: The description of the Women’s Campside Oxfords is: “This
ultracomfortable lace-to-toe Oxford boasts a super-soft canvas, thick cushioning,
and quality construction for a broken-in feel from the first time you put them
on.”
Predicted Grade: CORRECTExample 3:
Question: What are the dimensions of the small and medium sizes of the Recycled
Waterhog Dog Mat, Chevron Weave?
Real Answer: The dimensions of the small size of the Recycled Waterhog Dog Mat,
Chevron Weave are 18″ x 28″. The dimensions of the medium size are 22.5″ x 34.5″.
Predicted Answer: The dimensions of the small size of the Recycled Waterhog Dog
Mat, Chevron Weave are 18″ x 28″. The dimensions of the medium size are 22.5″ x
34.5″.
Predicted Grade: CORRECTExample 4:
Question: What are the features of the Infant and Toddler Girls’ Coastal Chill
Swimsuit, Two-Piece?
Real Answer: The swimsuit has bright colors, ruffles, and exclusive whimsical
prints. It is made of four-way-stretch and chlorine-resistant fabric, which keeps
its shape and resists snags. The fabric is UPF 50+ rated, providing the highest
rated sun protection possible by blocking 98% of the sun’s harmful rays. The
swimsuit also has crossover no-slip straps and a fully lined bottom for a secure
fit and maximum coverage.
Predicted Answer: The features of the Infant and Toddler Girls’ Coastal Chill
Swimsuit, Two-Piece are:– Bright colors and ruffles
– Exclusive whimsical prints
– Four-way-stretch and chlorine-resistant fabric
– UPF 50+ rated fabric for sun protection
– Crossover no-slip straps
– Fully lined bottom for a secure fit and maximum coverage
– Machine washable and line dry for best results
– Imported
Predicted Grade: CORRECTExample 5:
Question: What is the fabric composition of the Refresh Swimwear, V-Neck Tankini
Contrasts?
Real Answer: The Refresh Swimwear, V-Neck Tankini Contrasts is made of 82%
recycled nylon and 18% Lycra? spandex for the body, and 90% recycled nylon with
10% Lycra? spandex for the lining.
Predicted Answer: The fabric composition of the Refresh Swimwear, V-Neck Tankini
Contrasts is 82% recycled nylon with 18% Lycra? spandex for the body, and 90%
recycled nylon with 10% Lycra? spandex for the lining.
Predicted Grade: CORRECTExample 6:
Question: What is the fabric composition of the EcoFlex 3L Storm Pants?
Real Answer: The EcoFlex 3L Storm Pants are made of 100% nylon, exclusive of
trim.
Predicted Answer: The fabric composition of the EcoFlex 3L Storm Pants is 100%
nylon, exclusive of trim.
Predicted Grade: CORRECT
嘿,伙伴們,今天我們的AI探索之旅已經(jīng)圓滿結(jié)束。關(guān)于“面向開發(fā)者的LLM入門課程-評(píng)估英文版提(3)”的內(nèi)容已經(jīng)分享給大家了。感謝你們的陪伴,希望這次旅程讓你對(duì)AI能夠更了解、更喜歡。謹(jǐn)記,精準(zhǔn)提問是解鎖AI潛能的鑰匙哦!如果有小伙伴想要了解學(xué)習(xí)更多的AI知識(shí),請(qǐng)關(guān)注我們的官網(wǎng)“AI智研社”,保證讓你收獲滿滿呦!

微信掃一掃
支付寶掃一掃