AI教程 2025年01月15日
0 收藏 0 点赞 218 浏览 4861 个字
摘要 :

面向开发者的LLM入门课程-检查结果英文版: 1.检查有害信息 final_response_to_customer = f””” The SmartX ProPhone has a 6.1-inch display, 128GB……

哈喽!伙伴们,我是小智,你们的AI向导。欢迎来到每日的AI学习时间。今天,我们将一起深入AI的奇妙世界,探索“面向开发者的LLM入门课程-检查结果英文版”,并学会本篇文章中所讲的全部知识点。还是那句话“不必远征未知,只需唤醒你的潜能!”跟着小智的步伐,我们终将学有所成,学以致用,并发现自身的更多可能性。话不多说,现在就让我们开始这场激发潜能的AI学习之旅吧。

面向开发者的LLM入门课程-检查结果英文版

面向开发者的LLM入门课程-检查结果英文版:

1.检查有害信息

final_response_to_customer = f”””
The SmartX ProPhone has a 6.1-inch display, 128GB storage,
12MP dual camera, and 5G. The FotoSnap DSLR Camera
has a 24.2MP sensor, 1080p video, 3-inch LCD, and
interchangeable lenses. We have a variety of TVs, including
the CineView 4K TV with a 55-inch display, 4K resolution,
HDR, and smart TV features. We also have the SoundMax
Home Theater system with 5.1 channel, 1000W output, wireless
subwoofer, and Bluetooth. Do you have any specific questions
about these products or any other products we offer?
“””
response = openai.Moderation.create(
input=final_response_to_customer
)
moderation_output = response[“results”][0]
print(moderation_output)

{
“categories”: {
“harassment”: false,
“harassment/threatening”: false,
“hate”: false,
“hate/threatening”: false,
“self-harm”: false,
“self-harm/instructions”: false,
“self-harm/intent”: false,
“sexual”: false,
“sexual/minors”: false,
“violence”: false,
“violence/graphic”: false
},
“category_scores”: {
“harassment”: 3.4429521e-09,
“harassment/threatening”: 9.538529e-10,
“hate”: 6.0008998e-09,
“hate/threatening”: 3.5339007e-10,
“self-harm”: 5.6997046e-10,
“self-harm/instructions”: 3.864466e-08,
“self-harm/intent”: 9.3394e-10,
“sexual”: 2.2777907e-07,
“sexual/minors”: 2.6869095e-08,
“violence”: 3.5471032e-07,
“violence/graphic”: 7.8637696e-10
},
“flagged”: false
}

2.检查是否符合产品信息

# 这是一段电子产品相关的信息
system_message = f”””
You are an assistant that evaluates whether
customer service agent responses sufficiently
answer customer questions, and also validates that
all the facts the assistant cites from the product
information are correct.
The product information and user and customer
service agent messages will be delimited by
3 backticks, i.e. “`.
Respond with a Y or N character, with no punctuation:
Y – if the output sufficiently answers the question
AND the response correctly uses product information
N – otherwise
Output a single letter only.
“””
#这是顾客的提问
customer_message = f”””
tell me about the smartx pro phone and
the fotosnap camera, the dslr one.
Also tell me about your tvs”””
product_information = “””{ “name”: “SmartX ProPhone”, “category”: “Smartphones
and Accessories”, “brand”: “SmartX”, “model_number”: “SX-PP10”, “warranty”: “1
year”, “rating”: 4.6, “features”: [ “6.1-inch display”, “128GB storage”, “12MP
dual camera”, “5G” ], “description”: “A powerful smartphone with advanced camera
features.”, “price”: 899.99 } { “name”: “FotoSnap DSLR Camera”, “category”:
“Cameras and Camcorders”, “brand”: “FotoSnap”, “model_number”: “FS-DSLR200”,
“warranty”: “1 year”, “rating”: 4.7, “features”: [ “24.2MP sensor”, “1080p
video”, “3-inch LCD”, “Interchangeable lenses” ], “description”: “Capture
stunning photos and videos with this versatile DSLR camera.”, “price”: 599.99 } {
“name”: “CineView 4K TV”, “category”: “Televisions and Home Theater Systems”,
“brand”: “CineView”, “model_number”: “CV-4K55”, “warranty”: “2 years”, “rating”:
4.8, “features”: [ “55-inch display”, “4K resolution”, “HDR”, “Smart TV” ],
“description”: “A stunning 4K TV with vibrant colors and smart features.”,
“price”: 599.99 } { “name”: “SoundMax Home Theater”, “category”: “Televisions and
Home Theater Systems”, “brand”: “SoundMax”, “model_number”: “SM-HT100”,
“warranty”: “1 year”, “rating”: 4.4, “features”: [ “5.1 channel”, “1000W output”,
“Wireless subwoofer”, “Bluetooth” ], “description”: “A powerful home theater
system for an immersive audio experience.”, “price”: 399.99 } { “name”: “CineView
8K TV”, “category”: “Televisions and Home Theater Systems”, “brand”: “CineView”,
“model_number”: “CV-8K65”, “warranty”: “2 years”, “rating”: 4.9, “features”: [
“65-inch display”, “8K resolution”, “HDR”, “Smart TV” ], “description”:
“Experience the future of television with this stunning 8K TV.”, “price”: 2999.99
} { “name”: “SoundMax Soundbar”, “category”: “Televisions and Home Theater
Systems”, “brand”: “SoundMax”, “model_number”: “SM-SB50”, “warranty”: “1 year”,
“rating”: 4.3, “features”: [ “2.1 channel”, “300W output”, “Wireless subwoofer”,
“Bluetooth” ], “description”: “Upgrade your TV’s audio with this sleek and
powerful soundbar.”, “price”: 199.99 } { “name”: “CineView OLED TV”, “category”:
“Televisions and Home Theater Systems”, “brand”: “CineView”, “model_number”: “CVOLED55”, “warranty”: “2 years”, “rating”: 4.7, “features”: [ “55-inch display”,
“4K resolution”, “HDR”, “Smart TV” ], “description”: “Experience true blacks and
vibrant colors with this OLED TV.”, “price”: 1499.99 }”””
q_a_pair = f”””
Customer message: “`{customer_message}“`
Product information: “`{product_information}“`
Agent response: “`{final_response_to_customer}“`
Does the response use the retrieved information correctly?
Does the response sufficiently answer the question?
Output Y or N
“””
#判断相关性
messages = [
{‘role’: ‘system’, ‘content’: system_message},
{‘role’: ‘user’, ‘content’: q_a_pair}
]
response = get_completion_from_messages(messages, max_tokens=1)
print(response)

Y

another_response = “life is like a box of chocolates”
q_a_pair = f”””
Customer message: “`{customer_message}“`
Product information: “`{product_information}“`
Agent response: “`{another_response}“`
Does the response use the retrieved information correctly?
Does the response sufficiently answer the question?
Output Y or N
“””
messages = [
{‘role’: ‘system’, ‘content’: system_message},
{‘role’: ‘user’, ‘content’: q_a_pair}
]
response = get_completion_from_messages(messages)
print(response)

N

面向开发者的LLM入门课程-端到端实现问答系统
面向开发者的LLM入门课程-端到端实现问答系统:端到端实现问答系统 在我们的探索之旅中,我们将实现一个完整的问答系统,一种能理解...

嘿,伙伴们,今天我们的AI探索之旅已经圆满结束。关于“面向开发者的LLM入门课程-检查结果英文版”的内容已经分享给大家了。感谢你们的陪伴,希望这次旅程让你对AI能够更了解、更喜欢。谨记,精准提问是解锁AI潜能的钥匙哦!如果有小伙伴想要了解学习更多的AI知识,请关注我们的官网“AI智研社”,保证让你收获满满呦!

微信扫一扫

支付宝扫一扫

版权: 转载请注明出处:https://www.ai-blog.cn/2587.html

相关推荐
01-15

面向开发者的LLM入门课程-路由链: 路由链 到目前为止,我们已经学习了大语言模型链和顺序链。但是…

215
01-15

面向开发者的LLM入门课程-顺序链: 顺序链 当只有一个输入和一个输出时,简单顺序链(SimpleSequen…

218
01-15

面向开发者的LLM入门课程-简单顺序链: 简单顺序链 顺序链(SequentialChains)是按预定义顺序执行…

218
01-15

面向开发者的LLM入门课程-大语言模型链: 模型链 链(Chains)通常将大语言模型(LLM)与提示(Pro…

218
01-15

面向开发者的LLM入门课程-对话储存英文版提示: 英文版提示 1.对话缓存储存 from langchain.chains…

218
01-15

面向开发者的LLM入门课程-对话摘要缓存储存: 对话摘要缓存储存 对话摘要缓存储存,使用 LLM 对到…

218
01-15

面向开发者的LLM入门课程-对话字符缓存储存: 对话字符缓存储存 使用对话字符缓存记忆,内存将限制…

218
01-15

面向开发者的LLM入门课程-对话缓存窗口储存: 对话缓存窗口储存 随着对话变得越来越长,所需的内存…

218
发表评论
暂无评论

还没有评论呢,快来抢沙发~

助力原创内容

快速提升站内名气成为大牛

扫描二维码

手机访问本站