小智头像图片
AI教程 2025年01月15日
0 收藏 0 点赞 280 浏览 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

相关推荐

AI绘画-Liblibai简易上手教程​:prompt简易技巧: prompt简易技巧​ 认识prompt​ 好说,你就这么理…

小智头像图片
280

AI绘画-Liblibai简易上手教程​:简明操作流程: 简明操作流程​ 文生图​ 1.定主题:你需要生成一张…

小智头像图片
280

AI绘画-Liblibai简易上手教程​:功能说明: 本简易教程包含三部分​ 1.概念与功能说明(能看懂)​ 2…

小智头像图片
280

AI编程-trae使用教程:IDE 设置: 常规设置​ 在设置中心,你可以修改通用设置,包括修改主题和语言…

小智头像图片
280

AI编程-trae使用教程:源代码管理: 在 Trae 中,你可以使用源代码管理功能(Source Control)来管…

小智头像图片
280

AI编程-trae使用教程:多模态输入​: 你可以在会话中添加图片,例如报错截图、设计稿、参考样式等…

小智头像图片
280

AI编程-trae使用教程:代码自动补全​: Trae 内置原生的 AI 代码补全功能,无需手动开启。在编辑器…

小智头像图片
280

AI编程-trae使用教程:智能问答指南: 侧边对话(Chat 模式)​ 侧边对话(Chat 模式)是编码过程中…

小智头像图片
280
发表评论
暂无评论

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

助力原创内容

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

扫描二维码

手机访问本站

二维码
vip弹窗图片