所有文章 > AI驱动 > 简单易懂的ChatGPT替代品ChatDolphin有效使用指南
简单易懂的ChatGPT替代品ChatDolphin有效使用指南

简单易懂的ChatGPT替代品ChatDolphin有效使用指南

NLP Cloud 开发了一款强大的 OpenAI ChatGPT 替代品,名为ChatDolphin。这些 AI 模型非常有趣,因为它们能够很好地理解用自然语言发出的简单指令,而无需使用少样本学习和复杂的提示工程。让我们看看如何编写此类指令,以充分利用 ChatDolphin 和 ChatGPT

ChatGPT 和 ChatDolphin

ChatGPT 于 2022 年 12 月由 OpenAI 发布,是一种小型生成模型,非常擅长理解人类指令,针对对话和大量详细答案进行了优化。看来 ChatGPT 非常擅长处理许多用例,而不仅仅是对话。与 GPT-3 和 GPT-4 一样,您可以使用 ChatGPT 执行摘要、释义、实体提取等。由于尺寸小,ChatGPT 也比 GPT-3 和 GPT-4 便宜。

2023 年 4 月,NLP Cloud 发布了 ChatDolphin,这是 ChatGPT 的强大替代品。ChatDolphin 是一个内部 NLP Cloud 模型,非常擅长理解人类指令、处理对话,并且行为与 ChatGPT 完全相同。ChatDolphin 也很便宜。

下面,我们将向您展示使用 NLP Cloud 上的文本生成端点和 ChatDolphin 以及 Python 客户端获得的示例。如果您想复制粘贴示例,请不要忘记添加您自己的 API 令牌。要安装 Python 客户端,请首先运行以下命令:pip install nlpcloud

ChatGPT 和 ChatDolphin差异

虽然ChatGPT和ChatDolphin这两个模型在功能上有许多相似之处,但它们在开发背景、特定功能实现以及目标用户群体上存在一些差异。

为了更全面地理解 ChatGPT 和 ChatDolphin 的优势和适用场景,下面我们将通过一个详细的对比表格,展示它们的相同点和不同点。这将有助于揭示每个模型的独特价值,并为选择最适合特定需求的模型提供指导。

特点/模型ChatGPTChatDolphin说明
开发方OpenAINLP CloudChatGPT 由 OpenAI 开发,而 ChatDolphin 由 NLP Cloud 开发。
语言理解✔️✔️两个模型都能理解自然语言指令。
对话生成✔️✔️都擅长生成对话式的文本。
多任务处理✔️✔️都能执行摘要、释义、实体提取等任务。
优化对话和详细答案✔️✔️都针对生成详细和对话式的文本进行了优化。
成本效益✔️✔️与一些大型模型相比,成本较低。
易于集成✔️✔️都可以通过API轻松集成到应用程序中。
快速响应✔️✔️都能提供快速的文本生成响应。
用户基础较广泛可能更特定ChatGPT 可能有更广泛的用户基础,而 ChatDolphin 可能专注于特定用户群体或地区。
更新和迭代频繁可能更专注ChatGPT 可能更频繁地更新和迭代,而 ChatDolphin 可能更专注于特定需求或优化。
语言支持较广泛可能更特定ChatGPT 可能支持更广泛的语言,而 ChatDolphin 可能专注于特定语言或方言的优化。
集成选项多样可能更定制化ChatGPT 可能提供更多样的集成选项,而 ChatDolphin 可能提供更定制化的集成选项。
社区和资源较广泛可能更紧密ChatGPT 可能有更广泛的社区和资源,而 ChatDolphin 可能有更紧密或特定的社区和资源。
应用案例广泛可能更专注ChatGPT 可能有更广泛的应用案例,而 ChatDolphin 可能专注于特定的应用案例或行业。

通过这个对比,我们可以看到 ChatGPT 和 ChatDolphin 在提供高效、智能的对话生成服务方面具有许多共同的优势,同时也各有其独特的特点和优势。这些差异使得它们能够满足不同用户群体和应用场景的特定需求。

小样本学习 VS 简单指令

小样本学习(Few-shot learning)是一种机器学习技术,它使得模型能够在只有少量示例的情况下学习新任务。这种学习方式特别适用于数据稀缺但需要模型快速适应新情况的场景。在自然语言处理(NLP)中,小样本学习通常涉及到在模型的输入中加入少量的示例,以指导模型如何理解和执行特定的任务。

小样本学习的例子

例如,如果要训练一个模型来识别文本中的实体(如人名、地点等),传统的方法是提供大量的标注数据。但在小样本学习中,可能只需要几个标注好的示例,模型就能学会识别这些实体。这种方法降低了数据需求,加快了模型的训练和部署过程。

当第一批大型语言模型(如 GPT-J、OPT、Bloom 等)发布时,很快就发现 – 尽管非常强大 – 但这些模型无法理解用自然语言发出的简单人类指令。

例如,如果你想从一段文本中提取姓名、职位和公司,你需要使用 NLP Cloud 上的 GPT-J 执行如下操作:

import nlpcloud
client = nlpcloud.Client("gpt-j", "your_token", gpu=True)
generation = client.generation("""[Text]: Fred is a serial entrepreneur. Co-founder and CEO of Platform.sh, he previously co-founded Commerce Guys, a leading Drupal ecommerce provider. His mission is to guarantee that as we continue on an ambitious journey to profoundly transform how cloud computing is used and perceived, we keep our feet well on the ground continuing the rapid growth we have enjoyed up until now.
[Name]: Fred
[Position]: Co-founder and CEO
[Company]: Platform.sh
###
[Text]: Microsoft (the word being a portmanteau of "microcomputer software") was founded by Bill Gates on April 4, 1975, to develop and sell BASIC interpreters for the Altair 8800. Steve Ballmer replaced Gates as CEO in 2000, and later envisioned a "devices and services" strategy.
[Name]: Steve Ballmer
[Position]: CEO
[Company]: Microsoft
###
[Text]: Franck Riboud was born on 7 November 1955 in Lyon. He is the son of Antoine Riboud, the previous CEO, who transformed the former European glassmaker BSN Group into a leading player in the food industry. He is the CEO at Danone.
[Name]: Franck Riboud
[Position]: CEO
[Company]: Danone
###
[Text]: David Melvin is working for CITIC CLSA with over 30 years’ experience in investment banking and private equity. He is currently a Senior Adviser of CITIC CLSA.
""",
top_p=0,
length_no_input=True,
end_sequence="###",
remove_end_sequence=True,
remove_input=True)
print(generation["generated_text"])

少量学习在 ChatGPT 和 ChatDolphin 上效果很好,可以让你获得非常先进的结果。但在大多数情况下,少量学习是不必要的,而且不必要地复杂。此外,由于生成式 AI 模型仅允许有限的输入长度,少量示例有时根本不符合要求。

好消息是,经过适当的微调后,大型语言模型可以学习如何理解人类的指令,而无需使用少量学习。这就是 ChatGPT 和 ChatDolphin 的情况。

使用这些模型,您的查询将如下所示:

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Extract name, position, and company, from the following text.

David Melvin working for CITIC CLSA with over 30 years’ experience in investment banking and private equity. He is currently a Senior Adviser of CITIC CLSA.""")
print(generation["generated_text"])

输出:

Name: David Melvin
Position: Senior Adviser
Company: CITIC CLSA

是不是简单多了?现在如果我们想将结果格式化为 JSON 怎么办?这里有一个简单的说明:

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Extract name, position, and company, from the following text. Format the result as JSON.

David Melvin working for CITIC CLSA with over 30 years’ experience in investment banking and private equity. He is currently a Senior Adviser of CITIC CLSA.""")
print(generation["generated_text"])

输出:

{
"name": "David Melvin",
"position": "Senior Adviser",
"company": "CITIC CLSA"
}

请注意,这些模型经过训练可以生成大量回复。如果您需要简短而简洁的回复,您可以在提示中提及(例如“做出简短的回复”。)。

使用ChatGPT替代品ChatDolphin 进行情绪分析

要使用 ChatDolphin 进行情绪分析,您可以通过以下步骤进行:

  1. 准备文本:首先,您需要准备好需要进行情绪分析的文本。
  2. 发送请求:使用 NLP Cloud 的 API 或其他接口发送请求,请求中包含您希望分析的文本。
  3. 指定任务:在请求中明确指出您希望模型进行7情绪分析,这可以通过特定的提示或指令完成。
  4. 接收分析结果:模型将返回文本的情绪分析结果,通常包括正面、负面或中性情绪的判断。
  5. 处理结果:根据模型返回的结果进行后续的处理或决策。

以下是一个使用 Python 和 NLP Cloud 客户端进行情绪分析的示例代码:

import nlpcloud

# 初始化客户端
client = nlpcloud.Client("chatdolphin", "your_token")

# 准备需要进行情绪分析的文本
text_to_analyze = "The reactivity of your team has been amazing, thanks!"

# 发送请求并指定进行情绪分析
generation = client.generation(f"What is the sentiment in the following text? Positive, negative, or neutral? Answer with one word only.\n{ text_to_analyze }")

# 打印情绪分析的结果
print(generation)

在这段代码中,我们创建了一个 NLP Cloud 客户端实例,并向 ChatDolphin 发送了一段文本,请求它分析并返回文本的情绪(正面、负面或中性)。返回的结果将打印出来。

请确保替换 "your_token" 为您自己的 NLP Cloud API 令牌。如果您还没有 API 令牌,您需要在 NLP Cloud 注册账户并获取一个。

注意,实际的情绪分析可能更复杂,涉及到对文本中的情感强度、情绪种类(如快乐、悲伤、愤怒等)的更细致分析。ChatDolphin 能够根据预训练和微调的结果提供基本的情绪分析,但可能需要针对特定应用场景进行进一步的训练和优化。

使用ChatGPT替代品ChatDolphin 生成 HTML 代码

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Generate the HTML code for a a Headline saying "Welcome to AI"""")
print(generation["generated_text"])

输出:

<h1>Welcome to AI</h1>

使用ChatGPT替代品ChatDolphin 进行问答

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Answer this question using the below context: Which plan is recommended for GPT-J? Make a short response.

Context: The main challenge with GPT-J is memory consumption. Using a GPU plan is recommended.""")
print(generation["generated_text"])

输出:

Since the main challenge with GPT-J is memory consumption, using a GPU plan is recommended to address this issue. Therefore, the recommended plan for GPT-J is the GPU plan.

使用ChatGPT替代品ChatDolphin 创建教程

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Create a tutorial about how to make a cake.""")
print(generation["generated_text"])

输出:

Here's a step-by-step guide to making a cake:

Ingredients:

* 2 cups all-purpose flour
* 2 teaspoons baking powder
* 1 teaspoon salt
* 1 cup unsalted butter, at room temperature
* 1 cup granulated sugar
* 2 large eggs
* 2 teaspoons vanilla extract
* 1 cup whole milk, at room temperature

Equipment:

* 9-inch round cake pan
* Rubber spatula
* Whisk
* Measuring cups and spoons
* Mixing bowls

Instructions:

1. Preheat your oven to 350°F (180°C). Grease and flour your 9-inch round cake pan.
2. In a mixing bowl, whisk together flour, baking powder, and salt. Set aside.
3. In another mixing bowl, using an electric mixer, beat together the butter and sugar until light and fluffy. Add the eggs, one at a time, beating well after each addition. Stir in the vanilla extract.
4. Gradually add the dry ingredients to the butter mixture, alternating with the milk and mixing until just combined.
5. Pour the batter into the prepared cake pan.
6. Bake the cake for 30-35 minutes, or until a toothpick inserted into the center comes out clean.
7. Remove the cake from the oven and let it cool in the pan for 5-10 minutes. Then, remove the cake from the pan and let it cool completely on a wire rack.
8. Once the cake is completely cool, you can ice and decorate it if you like. Enjoy!

Note: You can also use other types of flour, such as almond or coconut flour, and substitute other sweetener for the sugar, like honey or maple syrup. You can also add other ingredients like chocolate chips, nuts, or dried fruits to the batter for added flavor and texture.

使用ChatGPT替代品ChatDolphin 纠正语法和拼写

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Correct spelling and grammar mistakes from the following text.

I do not wan to go""")
print(generation["generated_text"])

输出:

I do not wan to go

使用ChatGPT替代品ChatDolphin 进行机器翻译

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Translate the following content to English.

NLP Cloud permet de deployer le NLP en production facilement.""")
print(generation["generated_text"])

输出:

NLP Cloud makes it easy to deploy NLP in production.

使用ChatGPT替代品ChatDolphin 生成推文

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Generate a Tweet about NLP.""")
print(generation["generated_text"])

输出:

NLP is revolutionizing the way we communicate with computers. From voice assistants to chatbots, natural language processing is making interactions with technology more human-like than ever before. Exciting times ahead for this field! #NLP #AI #Technology

使用ChatGPT替代品ChatDolphin 进行意图分类

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""What is the main intent in the following text?

Hello

I spent some time on your documentation but I could not figure how to add a new credit card.
It is a problem because my current card is going to expire soon and I'm affraid that it will cause a service disruption.
How can I update my credit card?

Thanks in advance,

Looking forward to hearing from you,

John Doe""")
print(generation["generated_text"])

输出:

The main intent behind the text is to inquire about the process for updating a credit card in a service.

使用ChatGPT替代品ChatDolphin 进行释义

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Paraphrase the following text.

After a war lasting 20 years, following the decision taken first by President Trump and then by President Biden to withdraw American troops, Kabul, the capital of Afghanistan, fell within a few hours to the Taliban, without resistance.""")
print(generation["generated_text"])


输出:

Following a 20-year war that was initially approved by President Trump and then continued under President Biden's leadership, American soldiers were withdrawn from Afghanistan. As a result, the Taliban was able to easily seize control of Kabul, the capital of Afghanistan, without encountering any resistance.

使用ChatGPT替代品ChatDolphin 进行总结

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Summarize the following text.

For all its whizz-bang caper-gone-wrong energy, and for all its subsequent emotional troughs, this week’s Succession finale might have been the most important in its entire run. Because, unless I am very much wrong, Succession – a show about people trying to forcefully mount a succession – just had its succession. And now everything has to change.
The episode ended with Logan Roy defying his children by selling Waystar Royco to idiosyncratic Swedish tech bro Lukas Matsson. It’s an unexpected twist, like if King Lear contained a weird new beat where Lear hands the British crown to Jack Dorsey for a laugh, but it sets up a bold new future for the show. What will happen in season four? Here are some theories.
Season three of Succession picked up seconds after season two ended. It was a smart move, showing the immediate swirl of confusion that followed Kendall Roy’s decision to undo his father, and something similar could happen here. This week’s episode ended with three of the Roy siblings heartbroken and angry at their father’s grand betrayal. Perhaps season four could pick up at that precise moment, and show their efforts to reorganise their rebellion against him. This is something that Succession undoubtedly does very well – for the most part, its greatest moments have been those heart-thumping scenes where Kendall scraps for support to unseat his dad – and Jesse Armstrong has more than enough dramatic clout to centre the entire season around the battle to stop the Matsson deal dead in its tracks.""")
print(generation["generated_text"])

输出:

The Succession finale had a succession, with Logan Roy selling Waystar Royco to Lukas Matsson, which sets up a bold new future for the show. The third season picked up seconds after the second season ended, and the next season could pick up at the moment where the Roy siblings are heartbroken and angry at their father's betrayal, centering the season around their rebellion against him.

使用ChatGPT替代品ChatDolphin 进行零样本文本分类

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""In one word, what is the main topic in the following text?

After a war lasting 20 years, following the decision taken first by President Trump and then by President Biden to withdraw American troops, Kabul, the capital of Afghanistan, fell within a few hours to the Taliban, without resistance.""")
print(generation["generated_text"])

输出:

war

使用ChatGPT替代品ChatDolphin 提取关键字和关键短语

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Extract the main keywords from the following text.

Since transformer models have a token limit, you might run into some errors when inputting large documents. In that case, you could consider splitting up your document into paragraphs and mean pooling (taking the average of) the resulting vectors.""")
print(generation["generated_text"])

输出:

Token limit, large documents, transformer models, splitting, paragraphs, mean pooling, tokenizing, vectorization.

使用ChatGPT替代品ChatDolphin 进行产品描述和广告生成

import nlpcloud
client = nlpcloud.Client("chatdolphin", "your_token", gpu=True)
generation = client.generation("""Generate a product description out of the following keywords: t-shirt, men, $39""")
print(generation["generated_text"])

输出:

Introducing our premium t-shirt for men, made with high-quality materials and craftsmanship. This $39 t-shirt is designed to provide comfort and style, making it the perfect addition to any man's wardrobe. With a range of colors and sizes to choose from, you're sure to find the perfect t-shirt to suit your style. Whether you're running errands or hanging out with friends, our t-shirt is the perfect choice for any occasion.

如何使用 GPT-J 生成博客文章

import nlpcloud
client = nlpcloud.Client("gpt-j", "your_token", gpu=True)
generation = client.generation("""Generate a whole blog article in HTML format about the following topic: 4 Best Tips to Find a Girlfriend
The article should contain the following keywords: Paris, romance, love""")
print(generation["generated_text"])

输出:

<html>
<head>
<title>4 Best Tips to Find a Girlfriend</title>
<meta charset="UTF-8">
<meta name="description" content="Looking for love in Paris? Follow these four tips to find your perfect girlfriend.">
</head>
<body>
<h1>4 Best Tips to Find a Girlfriend in Paris</h1>
<p>Are you tired of the dating scene in Paris and ready to find a serious relationship? Finding a girlfriend in the City of Love can seem like a daunting task, but with these four tips, you can increase your chances of finding lasting love.</p>
<h2>1. Be Open-Minded</h2>
<p>One of the biggest mistakes people make when looking for a girlfriend is being too picky. Instead of focusing on the little things that might be deal breakers, be open to different types of people and personalities. You never know who you might hit it off with if you keep an open mind.</p>
<h2>2. Join a Social Club or Group</h2>
<p>Joining a social club or group that aligns with your interests can be a great way to meet new people and potentially find a girlfriend. Whether it's a book club, a sports team, or a Language exchange group, there are plenty of options to choose from in Paris. You can also sign up for online dating apps, but the chances of finding a meaningful connection are higher when you have something in common.</p>
<h2>3. Take Romantic Strolls</h2>
<p>Paris is known for its romantic atmosphere, and taking a stroll along the Seine or through the Luxembourg Gardens can be a great way to impress a potential girlfriend. Pack a picnic basket and enjoy a romantic lunch in the park, or take a boat ride down the Seine for a unique date. These memorable experiences can help you build a strong bond with someone special.</p>
<h2>4. Be Patient</h2>
<p>Finding a girlfriend in Paris takes time, just like finding love anywhere else. Don't get discouraged if things don't happen right away. Instead, focus on building genuine connections and getting to know people. The right person will come along when you least expect it, so be patient and keep an open mind.</p>
<p>By following these four tips, you can increase your chances of finding a girlfriend in Paris and experiencing the joys of lasting love. Remember to be open-minded, join social clubs or groups, take romantic strolls, and be patient. Good luck!</p>
<p>If you are looking for a girlfriend, here are some more tips to consider:<br><br>- Have a clear idea of what you want in a partner.<br>- Be confident and approachable.<br>- Show genuine interest in the person you're dating.<br>- Be respectful and treat your date with kindness and attention.</p>
<p>If you enjoyed this article, please like it on social media and share it with your friends. Your support helps us continue to provide valuable content.</p>
<p>For more tips and advice on dating and relationships, check out our blog.</p>
</body>
</html>

如何找到NLP Cloud模型ChatDolphin

幂简集成是国内领先的API集成管理平台,专注于为开发者提供全面、高效、易用的API集成解决方案。幂简API平台可以通过以下两种方式找到所需API:通过关键词搜索NLP Cloud(例如,输入’NLP Cloud‘这类品类词,更容易找到结果)、或者从API Hub分类页进入寻找。

此外,幂简集成博客会编写API入门指南、多语言API对接指南、API测评等维度的文章,让开发者快速使用目标API。

结论

ChatGPT 和 ChatDolphin 可以用于许多,而无需使用小样本学习!

可能性是无穷无尽的!前提是,你的指令必须非常清晰明确,这样模型才能正确理解你想要什么。

本文转载自: ChatGPT替代品ChatDolphin使用指南

#你可能也喜欢这些API文章!
搜索、试用、集成国内外API!
幂简集成API平台已有 4660种API!
API大全
同话题下的热门内容
na
想要系统了解Agentic Workflow,看这25篇论文就够了
na
生成式 AI 在电商领域究竟有多牛,这款产品给出了回答
na
AI Agent 开源和创业项目大盘点,Agent 基础设施正在崛起
na
人工智能(AI) VS 商业智能(BI) 区别与联系是什么?
na
一文说尽大模型技术之一:LLM的架构
na
50+个AI大模型的应用案例,开启脑洞!