Let's use ChatGPT in Python, it's a hot topic right now!

Let's use ChatGPT in Python, it's a hot topic right now!

The source code is available on the official account: Macho Technology Control, reply: chatgpt

introduce

As many of you already know, ChatGPT is a powerful Natural Language Processing (NLP) tool that has taken the world by storm. It is used in a wide range of applications, from generating human-like text to building chatbots and virtual assistants.

One of the reasons for ChatGPT's popularity is that it is built on top of the powerful open-source GPT-3 language model trained on large amounts of text data. This enables ChatGPT to generate highly realistic and consistent text, making it a valuable tool for anyone involved in NLP.

But what really sets ChatGPT apart is that it's designed for use with one of the most popular programming languages ​​in the world: Python. Anyone with basic knowledge of Python can easily integrate ChatGPT into their projects and start using its powerful features.

In this article, we'll take a closer look at ChatGPT and how to use it in Python. We also discuss some potential applications of ChatGPT and how to use it to your advantage.

image-20230209095358897So I try to use ChatGPT's Python package PyChatGpt !

Install

pip install chatgptpy --upgrade

There are various packages, but I think this is the easiest to use.

insert image description here

try it

After a successful installation, chat.pylet's create the file and actually use it.

chat.py

from pychatgpt import Chat, Options

options = Options()

options.track = True

options.chat_log = "chat_log.txt"
options.id_log = "id_log.txt"

chat = Chat(email="email", password="password", options=options)
chat.cli_chat()

email``passwordCreate an OpenAI account and enter the account's email address and password.

You can only experience the pseudo ChatGPT CLI tool!

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-TU7otFY4-1675907658801)(https://qiita-user-contents.imgix.net/https%3A%2F %2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F905557%2Fde27586c-8955-cd52-3b0a-efd8ad6f9bfc.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s =1006bb2f4caf1de36a8ebe7419d5a350)]

You: 早上好
Chat GPT: 你好! 我是助理。 不客气?


You: 这是关于12月的一个活动,我正在写一篇IT文章,但我还没有太多的时间...
Chat GPT: 这听起来令人生畏--在12月举行的与IT相关的文章写作活动中,时间似乎很有限。 在这种情况下,重要的是首先要确定你要写什么。 准确估计写文章所需的时间也很重要,以便有效利用时间。 你也可以考虑与其他参与者和活动组织者合作,分担任务。
You:鼓励他们!
Chat GPT: 它是好的。 在这种情况下,首先要对自己有信心。 重要的是要确定你能做什么,并为自己做得最好。 牢记你写什么样的文章也很重要。 这样一来,你就会喜欢上写作。 最后,我祝愿你在自己的努力中取得好成绩。 好运!

You:  写一篇关于用Python使用ChatGPT的文章!
Chat GPT:
[省略]
在这篇文章中,我们将详细了解ChatGPT以及如何在Python中使用它。
我们还将讨论ChatGPT的潜在应用,以及如何利用它来做好事。

首先,我们描述ChatGPT的工作原理:它是一个机器学习模型,经过训练可以根据给定的输入生成文本。
这个输入可以是一个单字、一个句子或整个段落,ChatGPT会生成与输入有关的反应。

ChatGPT的主要特点之一是它能够生成类似人类的文本。
这是由于GPT-3语言模型,它是在大量的文本数据上训练出来的。
这使ChatGPT不仅能产生适当的反应,而且能产生高度一致和自然的反应。

在Python中使用ChatGPT是非常容易的。
你需要做的就是安装ChatGPT Python软件包,它可以在Python软件包索引(PyPI)上找到。
一旦软件包安装完毕,你可以通过导入ChatGPT类并创建该类的实例,在你的Python代码中使用ChatGPT。

下面是一个在Python中使用ChatGPT的例子。

Yes. Fucking great.

But unfortunately, because it is not a browser, I can't see the final sample code.
There are other interesting tools, so I'll cover them.

ChatGPT related tools

From here, I will introduce ChatGPT related tools.
To be honest, there are very few good tools.
But I feel strongly that the dawn of development is just that.
Different people are developing their own software with different ideas, so check it out.

command line tool

Auto Submit (★★★★☆)

Rating: ★★★★☆

auto-commit is a CLI tool that reads code diffs and writes commit messages automatically.

only this. It automatically creates commit messages from diffs.
However, the commit message is in English...
Also, sometimes it protects regular commits, sometimes it doesn't, so you need to be aware of that.
★It is four.

insert image description here

Python library

PyChatGPT (★★★★☆)

Rating: ★★★★☆

The package is as shown above.
I personally like it.
However, it can be a bit difficult to use in Japanese.

Chat GPT (★★★☆☆)

Rating: ★★★☆☆

ChatGPT is a library that makes ChatGPT available in Python.
Similar to PyChatGpt .
Personally, I think PyChatGpt is easier to use, so I give it 3 stars.

Node.js library

chatgpt-api (★★★☆☆)

Rating: ★★★☆☆

chatgpt-api is a Node.js library for ChatGPT.

[demo.gif

Dart library

chatgpt_api_dart (★★★☆☆)

Rating: ★★★☆☆

chatg_api_dart is a Dart library for ChatGPT.

VS Code extension

chatgpt-vscode (★☆☆☆☆)

Rating: ★☆☆☆☆

chatgpt-vscode is ChatGPT for VSCode.
Honestly, not much…

Chrome extension

chat-gpt-google-extension (★★☆☆☆)

Rating: ★★☆☆☆

chat-gpt-google-extension is a Chrome extension for ChatGPT.

SNS robot system

wathsapp-gpt (★★☆☆☆)

Rating: ★★☆☆☆

wathsapp-gpt is ChatGPT for WhatsApp.

It is written in Go language.

chatgpt-twitter-bot (★★★☆☆)

Rating: ★★★☆☆

chatgpt-twitter-bot is a ChatGPT that can be used with Twitter Bot.
I think it's generally for shady twitter users.

chatgpt-telegram-bot (★★☆☆☆)

chatgpt-telegram-bot is ChatGPT that can be used with Telegram Bot.

Rating: ★★☆☆☆

Excel, Google Docs, etc.

Document GPT (★★☆☆☆)

Rating: ★★☆☆☆

docGPT is a version of ChatGPT that can be used with Google Docs.
So far, it seems that ChatGPT can even be called from Excel.

[External link picture transfer failed, the source site may have an anti-theft link mechanism, it is recommended to save the picture and upload it directly (img-uFMuoxQ0-1675907658804)(https://qiita-user-contents.imgix.net/https%3A%2F %2Fqiita-image-store.s3.ap-northeast-1.amazonaws.com%2F0%2F905557%2F45cb6344-c090-d814-782b-dc19065343f9.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s =a9b32cd87fb8a49fff66dc55b994fa4a)]

GitHub Actions

chatgpt-action (★★☆☆☆)

Rating: ★★☆☆☆

chatgpt-action enables ChatGPT for GitHub Actions.

It's hard to understand to be honest...

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-vY3ad0Uy-1675907663761)(null)]

This pull request introduces several syntax errors.
In the diff, on line 6, the const keyword should be replaced with import in ...

Same as the comment above, just a little hard to understand. . . But it seems to have great
potential in the future.
Automated reviews like AWS Guru already exist

speaking system

chatgpt-conversation (★★☆☆☆)

Rating: ★★☆☆☆

chatgpt-conversation is designed to be used as if you were talking.

stable DiffusionI'm trying to combine this stuff with when it comes out! whisperThere are so many. . .

desktop application system

ChatGPT desktop application with tauri (grass)

Rating: ★☆☆☆☆

ChatGPT with tauri desktop application is ChatGPT desktop application.

Going around here, it feels like grass...
ChatGPT doesn't matter...

summary system

Awesome (★★★★★)

Rating: ★★★★★

awesome is a repository list about ChatGPT.

There are more and more libraries related to ChatGPT recently, so I put them together.

There's something like awesome-chatgpt-prompts , and something like a recipe for how you want ChatGPT to work.

ChatGPT Related Communities

Discord has a community on ChatGPT.

summarize

In the previous PODCAST, engineers from AI companies such as Google or OpenAI said that in a few years, even if Google and OpenAI do not adjust, they can adjust it by themselves.
The era when artificial intelligence surpasses human beings will finally come.

I hope I can be unemployed within 5 years.

Guess you like

Origin blog.csdn.net/weixin_45755332/article/details/128946750