安装模块
pip install HunYuanGPT --upgrade
获取cookie
-
你需要一个拥有腾讯混元大模型体验资格的账号。
-
打开腾讯混元助手
-
打开浏览器开发者模式,切换到
network选项卡,随便发送一条信息,找到一个有效的的请求,获取cookie字段的值。
使用聊天机器人
从命令行运行
$ python -m HunYuanGPT -h
_ _ __ __ _____ _____ _______
| | | | \ \ / / / ____| __ \__ __|
| |__| |_ _ _ _\ \_/ / _ __ _ _ __ | | __| |__) | | |
| __ | | | | '_ \ / | | |/ _` | '_ \| | |_ | ___/ | |
| | | | |_| | | | | || |_| | (_| | | | | |__| | | | |
|_| |_|\__,_|_| |_|_| \__,_|\__,_|_| |_|\_____|_| |_|
Type /help for help.
Alt + Enter to send a message.
usage: __main__.py [-h] [--cookie_file_path COOKIE_FILE_PATH] [--no_stream]
options:
-h, --help show this help message and exit
--cookie_file_path COOKIE_FILE_PATH
The path to the cookie file.
--no_stream Whether to use streaming mode.
在代码中运行
from HunYuanGPT import ChatBot
bot = ChatBot(cookie="xxxxxxxx")
# Streaming output
for rsp in bot.ask_stream("你好!你叫什么名字?"):
print(rsp, end="", flush=True)
# Normal output
print(bot.ask("你好!你叫什么名字?"))
# Generate images
# Images are named numerically by default and are saved in the./images folder.
# Of course, you can specify these parameters.
bot.get_image("赛博朋克风格的上海街头", path="./", name="img")
其他用法
# Switch to conversation with chatId "xxxxxx"
bot.change_conversation(chatId="xxxxxx")
# Set the name of conversation with chatId "xxxxxx" to "xxx"
bot.set_conversation_name(name="xxx", chatId="xxxxxx")
# Get the history of conversation with chatId "xxxxxx"
bot.get_conversation(chatId="xxxxxx")
# Get chatId and titles of all conversations
bot.get_all_conversations()
# Clear all conversations
bot.clear_all_conversations()
# Repeat the last reply
bot.repeat_last_reply()
# Forget the history and continue the conversation
bot.restart_conversation()
Metadata
Release files for HunYuanGPT 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| HunYuanGPT-0.1.0.tar.gz | 17.4 kB | Without provenance | Details for HunYuanGPT-0.1.0.tar.gz |
Release files / HunYuanGPT-0.1.0.tar.gz
| Download URL | HunYuanGPT-0.1.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8549131ae111415d62e81c61f6cb66e727b57a85e8529bcdefd0f8e917b9d735
|
|
BLAKE2b-256 checksum How to use checksums |
2b8dde54254595ef99c305877bf05e2e0a25351ed076f694fc344c935b18dd2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for HunYuanGPT 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.