小智头像图片
AI教程 2025年01月12日
0 收藏 0 点赞 154 浏览 4508 个字
摘要 :

面向开发者的LLM入门课程-推断英文版: 推断英文版 1.情感倾向分析 lamp_review = “”” Needed a nice lamp for my bedroom, and this one had additi……

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

面向开发者的LLM入门课程-推断英文版

面向开发者的LLM入门课程-推断英文版:

推断英文版

1.情感倾向分析

lamp_review = “””
Needed a nice lamp for my bedroom, and this one had
additional storage and not too high of a price point.
Got it fast. The string to our lamp broke during the
transit and the company happily sent over a new one.
Came within a few days as well. It was easy to put
together. I had a missing part, so I contacted their
support and they very quickly got me the missing piece!
Lumina seems to me to be a great company that cares
about their customers and products!!
“””

prompt = f”””
What is the sentiment of the following product review,
which is delimited with triple backticks?
Review text: “`{lamp_review}“`
“””
response = get_completion(prompt)
print(response)

The sentiment of the product review is positive.

prompt = f”””
What is the sentiment of the following product review,
which is delimited with triple backticks?
Give your answer as a single word, either “positive”
or “negative”.
Review text: “`{lamp_review}“`
“””
response = get_completion(prompt)
print(response)

positive

2.识别情感类型

prompt = f”””
Identify a list of emotions that the writer of the
following review is expressing. Include no more than
five items in the list. Format your answer as a list of
lower-case words separated by commas.
Review text: “`{lamp_review}“`
“””
response = get_completion(prompt)
print(response)

satisfied, pleased, grateful, impressed, happy

3.识别愤怒

prompt = f”””
Is the writer of the following review expressing anger?
The review is delimited with triple backticks.
Give your answer as either yes or no.
Review text: “`{lamp_review}“`
“””
response = get_completion(prompt)
print(response)

No

4.商品信息提取

prompt = f”””
Identify the following items from the review text:
– Item purchased by reviewer
– Company that made the item
The review is delimited with triple backticks.
Format your response as a JSON object with
“Item” and “Brand” as the keys.
If the information isn’t present, use “unknown”
as the value.
Make your response as short as possible.
Review text: “`{lamp_review}“`
“””
response = get_completion(prompt)
print(response)

{
“Item”: “lamp”,
“Brand”: “Lumina”
}

5.综合情感推断和信息提取

prompt = f”””
Identify the following items from the review text:
– Sentiment (positive or negative)
– Is the reviewer expressing anger? (true or false)
– Item purchased by reviewer
– Company that made the item
The review is delimited with triple backticks.
Format your response as a JSON object with
“Sentiment”, “Anger”, “Item” and “Brand” as the keys.
If the information isn’t present, use “unknown”
as the value.
Make your response as short as possible.
Format the Anger value as a boolean.
Review text: “`{lamp_review}“`
“””
response = get_completion(prompt)
print(response)

{
“Sentiment”: “positive”,
“Anger”: false,
“Item”: “lamp”,
“Brand”: “Lumina”
}

6.推断讨论主题

story = “””
In a recent survey conducted by the government,
public sector employees were asked to rate their level
of satisfaction with the department they work at.
The results revealed that NASA was the most popular
department with a satisfaction rating of 95%.
One NASA employee, John Smith, commented on the findings,
stating, “I’m not surprised that NASA came out on top.
It’s a great place to work with amazing people and
incredible opportunities. I’m proud to be a part of
such an innovative organization.”
The results were also welcomed by NASA’s management team,
with Director Tom Johnson stating, “We are thrilled to
hear that our employees are satisfied with their work at NASA.
We have a talented and dedicated team who work tirelessly
to achieve our goals, and it’s fantastic to see that their
hard work is paying off.”
The survey also revealed that the
Social Security Administration had the lowest satisfaction
rating, with only 45% of employees indicating they were
satisfied with their job. The government has pledged to
address the concerns raised by employees in the survey and
work towards improving job satisfaction across all departments.
“””

prompt = f”””
Determine five topics that are being discussed in the
following text, which is delimited by triple backticks.
Make each item one or two words long.
Format your response as a list of items separated by commas.
Give me a list which can be read in Python.
Text sample: “`{story}“`
“””
response = get_completion(prompt)
print(response)

survey, satisfaction rating, NASA, Social Security Administration, job satisfaction

response.split(sep=’,’)

[‘survey’,
‘ satisfaction rating’,
‘ NASA’,
‘ Social Security Administration’,
‘ job satisfaction’]

7.为特定主题制作新闻提醒

topic_list = [
“nasa”, “local government”, “engineering”,
“employee satisfaction”, “federal government”
]

prompt = f”””
Determine whether each item in the following list of
topics is a topic in the text below, which
is delimited with triple backticks.
Give your answer as list with 0 or 1 for each topic.
List of topics: {“, “.join(topic_list)}
Text sample: “`{story}“`
“””
response = get_completion(prompt)
print(response)

[1, 0, 0, 1, 1]

topic_dict = {topic_list[i] : eval(response)[i] for i in
range(len(eval(response)))}
print(topic_dict)
if topic_dict[‘nasa’] == 1:
print(“ALERT: New NASA story!”)

{‘nasa’: 1, ‘local government’: 0, ‘engineering’: 0, ’employee satisfaction’: 1,
‘federal government’: 1}
ALERT: New NASA story!

面向开发者的LLM入门课程-文本翻译
面向开发者的LLM入门课程-文本翻译:文本翻译 文本翻译是大语言模型的典型应用场景之一。相比于传统统计机器翻译系统,大语言模型翻...

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

微信打赏二维码 微信扫一扫

支付宝打赏二维码 支付宝扫一扫

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

相关推荐
03-12

DeepSeek企业级部署实战指南: 对于个人开发者或尝鲜者而言,本地想要部署 DeepSeek 有很多种方案…

小智头像图片
83
03-12

如何使用DeepSeek助你增强求职竞争力: 职场篇 常见的简历问题 1. 格式混乱或排版不专业 • 问题:…

小智头像图片
194
03-12

DeepSeek官方提示词:让你的API应用和官方一样强: 本文讨论了DeepSeek官方关于让API应用和官方一…

小智头像图片
90
03-12

关于 DeepSeek 的研究和思考 (Archerman Capital): 关于这几天很火的 DeepSeek, 我们 (Archerman …

小智头像图片
109

AI教程DeepSeek提示词之代码解释: 代码解释​ ​ 对代码进行解释,来帮助理解代码内容。​ ​ ​ 请解…

小智头像图片
110

AI教程DeepSeek提示词之代码改写: 代码改写​ ​ 对代码进行修改,来实现纠错、注释、调优等。​ ​ …

小智头像图片
154

AI教程DeepSeek提示词之代码生成: 代码生成​ ​ 让模型生成一段完成特定功能的代码。​ ​ 用户提示…

小智头像图片
154

AI教程DeepSeek提示词之散文写作: 散文写作​ ​ 让模型根据提示词创作散文。​ ​ 用户提示词: 以孤…

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

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

助力原创内容

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

扫描二维码

手机访问本站

二维码
vip弹窗图片