小智头像图片
AI教程 2025年01月15日
0 收藏 0 点赞 293 浏览 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写作-百万级提示词拆解:4 步写出“人模同谋”: 别再让大模型“扮演专家”了——它根本不需要角色,只…

小智头像图片
111

Kimi K2 发布并开源,擅长代码与 Agentic 任务: 今天,我们正式发布 Kimi K2 模型,并同步开源。 …

小智头像图片
178

AI写作-小说大纲在小说中的作用: 大纲主要讲两个部分: 一、大纲有什么用。 二、如何写大纲。 我上…

小智头像图片
189

AI写作-小说大纲的写法和新手常见的问题: 对于大纲的问题,相信大家深深浅浅的都有些了解。今天结…

小智头像图片
293

AI写作-小说的基础提纲结构: 很多的新作者在推出了大量的作品后,却是留给读者的是迷茫,包括作者…

小智头像图片
293

AI写作-小说大纲详解: 案例一:第 1-2 章(通过的大纲分章) 涵柔睁开眼睛,发现正被一个脑满肠肥的…

小智头像图片
293

AI写作-小说大纲格式与内容概述: 什么叫大纲?大纲是一本小说的根本。他为小说提供了精神主旨,主要…

小智头像图片
293

AI写作-如何利用日常生活写小说: 一、举例 1.身边之人是熟人,但是是关系平平的同事, 这种的大家…

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

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

助力原创内容

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

扫描二维码

手机访问本站

二维码
vip弹窗图片