一、ChatGPT 和 ChatDolphin

在2022年12月,OpenAI推出了ChatGPT,這是一個緊湊型的生成式人工智能模型,它在理解用戶的指令和生成詳盡的對話回復方面表現(xiàn)出色。ChatGPT不僅能夠進行對話,還能執(zhí)行摘要、釋義和實體識別等多種任務。與GPT-3和GPT-4相比,ChatGPT的模型規(guī)模較小,因此在成本上也更為經(jīng)濟。

到了2023年4月,NLP Cloud推出了ChatDolphin,它成為了ChatGPTT的一個強有力的競爭者。ChatDolphin是NLP Cloud自主研發(fā)的模型,它在理解指令和對話處理方面同樣表現(xiàn)出色,并且能夠提供與ChatGPT相似的用戶體驗。此外,ChatDolphin在價格上也具有競爭力。

下面,我們將向您展示使用 NLP Cloud 上的文本生成端點和 ChatDolphin 以及 Python 客戶端獲得的示例。如果您想復制粘貼示例,請不要忘記添加您自己的 API 令牌。要安裝 Python 客戶端,請首先運行以下命令:

pip install nlpcloud

二、ChatGPT 和 ChatDolphin差異

雖然ChatGPT和ChatDolphin這兩個模型在功能上有許多相似之處,但它們在開發(fā)背景、特定功能實現(xiàn)以及目標用戶群體上存在一些差異。

為了更全面地理解 ChatGPT 和 ChatDolphin 的優(yōu)勢和適用場景,下面我們將通過一個詳細的對比表格,展示它們的相同點和不同點。這將有助于揭示每個模型的獨特價值,并為選擇最適合特定需求的模型提供指導。

特點/模型ChatGPTChatDolphin說明
開發(fā)方OpenAINLP CloudChatGPT 由 OpenAI 開發(fā),而 ChatDolphin 由 NLP Cloud 開發(fā)。
語言理解????兩個模型都能理解自然語言指令。
對話生成????都擅長生成對話式的文本。
多任務處理????都能執(zhí)行摘要、釋義、實體提取等任務。
優(yōu)化對話和詳細答案????都針對生成詳細和對話式的文本進行了優(yōu)化。
成本效益????與一些大型模型相比,成本較低。
易于集成????都可以通過API輕松集成到應用程序中。
快速響應????都能提供快速的文本生成響應。
用戶基礎較廣泛可能更特定ChatGPT 可能有更廣泛的用戶基礎,而 ChatDolphin 可能專注于特定用戶群體或地區(qū)。
更新和迭代頻繁可能更專注ChatGPT 可能更頻繁地更新和迭代,而 ChatDolphin 可能更專注于特定需求或優(yōu)化。
語言支持較廣泛可能更特定ChatGPT 可能支持更廣泛的語言,而 ChatDolphin 可能專注于特定語言或方言的優(yōu)化。
集成選項多樣可能更定制化ChatGPT 可能提供更多樣的集成選項,而 ChatDolphin 可能提供更定制化的集成選項。
社區(qū)和資源較廣泛可能更緊密ChatGPT 可能有更廣泛的社區(qū)和資源,而 ChatDolphin 可能有更緊密或特定的社區(qū)和資源。
應用案例廣泛可能更專注ChatGPT 可能有更廣泛的應用案例,而 ChatDolphin 可能專注于特定的應用案例或行業(yè)。

通過這個對比,我們可以看到 ChatGPT 和 ChatDolphin 在提供高效、智能的對話生成服務方面具有許多共同的優(yōu)勢,同時也各有其獨特的特點和優(yōu)勢。這些差異使得它們能夠滿足不同用戶群體和應用場景的特定需求。

三、小樣本學習 VS 簡單指令

小樣本學習(Few-shot learning)是一種機器學習技術,它使得模型能夠在只有少量示例的情況下學習新任務。這種學習方式特別適用于數(shù)據(jù)稀缺但需要模型快速適應新情況的場景。在自然語言處理(NLP)中,小樣本學習通常涉及到在模型的輸入中加入少量的示例,以指導模型如何理解和執(zhí)行特定的任務。

小樣本學習的例子

例如,如果要訓練一個模型來識別文本中的實體(如人名、地點等),傳統(tǒng)的方法是提供大量的標注數(shù)據(jù)。但在小樣本學習中,可能只需要幾個標注好的示例,模型就能學會識別這些實體。這種方法降低了數(shù)據(jù)需求,加快了模型的訓練和部署過程。

當?shù)谝慌笮驼Z言模型(如 GPT-J、OPT、Bloom 等)發(fā)布時,很快就發(fā)現(xiàn) – 盡管非常強大 – 但這些模型無法理解用自然語言發(fā)出的簡單人類指令。

例如,如果你想從一段文本中提取姓名、職位和公司,你需要使用 NLP Cloud 上的 GPT-J 執(zhí)行如下操作:

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 上效果很好,可以讓你獲得非常先進的結果。但在大多數(shù)情況下,少量學習是不必要的,而且不必要地復雜。此外,由于生成式 AI 模型僅允許有限的輸入長度,少量示例有時根本不符合要求。

好消息是,經(jīng)過適當?shù)奈⒄{后,大型語言模型可以學習如何理解人類的指令,而無需使用少量學習。這就是 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

是不是簡單多了?現(xiàn)在如果我們想將結果格式化為 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"
}

請注意,這些模型經(jīng)過訓練可以生成大量回復。如果您需要簡短而簡潔的回復,您可以在提示中提及(例如“做出簡短的回復”。)。

1、使用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>

2、使用ChatGPT替代品ChatDolphin進行情緒分析

要使用 ChatDolphin 進行情緒分析,您可以通過以下步驟進行:

  1. 準備文本:首先,您需要準備好需要進行情緒分析的文本。
  2. 發(fā)送請求:使用 NLP Cloud 的 API 或其他接口發(fā)送請求,請求中包含您希望分析的文本。
  3. 指定任務:在請求中明確指出您希望模型進行7情緒分析,這可以通過特定的提示或指令完成。
  4. 接收分析結果:模型將返回文本的情緒分析結果,通常包括正面、負面或中性情緒的判斷。
  5. 處理結果:根據(jù)模型返回的結果進行后續(xù)的處理或決策。

以下是一個使用 Python 和 NLP Cloud 客戶端進行情緒分析的示例代碼:

import nlpcloud

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

# 準備需要進行情緒分析的文本
text_to_analyze = "The reactivity of your team has been amazing, thanks!"

# 發(fā)送請求并指定進行情緒分析
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)

在這段代碼中,我們創(chuàng)建了一個 NLP Cloud 客戶端實例,并向 ChatDolphin 發(fā)送了一段文本,請求它分析并返回文本的情緒(正面、負面或中性)。返回的結果將打印出來。

請確保替換 "your_token" 為您自己的 NLP Cloud API 令牌。如果您還沒有 API 令牌,您需要在 NLP Cloud 注冊賬戶并獲取一個。

注意,實際的情緒分析可能更復雜,涉及到對文本中的情感強度、情緒種類(如快樂、悲傷、憤怒等)的更細致分析。ChatDolphin 能夠根據(jù)預訓練和微調的結果提供基本的情緒分析,但可能需要針對特定應用場景進行進一步的訓練和優(yōu)化。

3、使用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.

4、使用ChatGPT替代品ChatDolphin創(chuàng)建教程

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.

5、使用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

6、使用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.

7、使用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

8、使用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.

9、使用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.

10、使用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.

11、使用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

12、使用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.

13、使用ChatGPT替代品ChatDolphin進行產(chǎn)品描述和廣告生成

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集成管理平臺,專注于為開發(fā)者提供全面、高效、易用的API集成解決方案。冪簡API平臺可以通過以下兩種方式找到所需API:通過關鍵詞搜索NLP Cloud(例如,輸入’NLP Cloud‘這類品類詞,更容易找到結果)、或者從API Hub分類頁進入尋找。

此外,冪簡集成博客會編寫API入門指南、多語言API對接指南、API測評等維度的文章,讓開發(fā)者快速使用目標API。

六、結論

ChatGPT 和 ChatDolphin 可以用于許多,而無需使用小樣本學習!

可能性是無窮無盡的!前提是,你的指令必須非常清晰明確,這樣模型才能正確理解你想要什么。

本文轉載自: ChatGPT替代品ChatDolphin使用指南

上一篇:

30萬用戶,日均使用4.7小時,蛙蛙寫作如何找到AI產(chǎn)品的PMF?

下一篇:

如何使用GPT-3、GPT-4、ChatGPT、GPT-J和其他生成模型進行小樣本學習
#你可能也喜歡這些API文章!

我們有何不同?

API服務商零注冊

多API并行試用

數(shù)據(jù)驅動選型,提升決策效率

查看全部API→
??

熱門場景實測,選對API

#AI文本生成大模型API

對比大模型API的內容創(chuàng)意新穎性、情感共鳴力、商業(yè)轉化潛力

25個渠道
一鍵對比試用API 限時免費

#AI深度推理大模型API

對比大模型API的邏輯推理準確性、分析深度、可視化建議合理性

10個渠道
一鍵對比試用API 限時免費