Skip to main content

kimi逆向api

Project description

revKimi

PyPi

kimi逆向api

安装

pip install revKimi --upgrade

使用

具体用法可查看方法Type Hint

1.初始化

配置文件可由以下两种方式提供:

1. 使用默认的文件对象,只需传入file_path

from revKimi import Chatbot
chatbot = Chatbot(file_path)

file_path为JSON配置文件路径,若不填则默认"./config.json",若无配置文件会自动创建 配置参数寻找方法如下图

2. 使用配置文件对象,需在config参数传入自己的文件对象,传入文件对象须实现__getitem____setitem__方法

from revKimi import Chatbot

chatbot = Chatbot(config=config)

2.提问

resp = chatbot.ask(
    prompt="你好", # 提问内容
    conversation_id=<conversation_id>,# 会话ID(不填则会新建)
    timeout=<timeout>,# 超时时间(默认10秒
use_search = False,  # 是否使用搜索
file = None,  # 文件二进制数据(传入代表上传文件)
)

文件上传说明

请求中的file参数为上传文件的二进制数据,可通过如下方法获取:

with open("test.txt", "rb") as f:
    file = f.read()

响应示例

resp = { 'conversation_id': 'coroksr5cfui11n4gql0', 'text': '你好!很高兴和你交流。有什么我可以帮你的吗?' }


### 3.新建会话
```python
resp = chatbot.create_conversation([name])

4.删除会话

chatbot.delete_conversation(<conversation_id>)

5.获取会话列表

resp = chatbot.get_conversations([size])

6.获取会话历史

resp = chatbot.get_history(<conversation_id>, [last])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

revkimi-0.0.3.tar.gz (352.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

revkimi-0.0.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file revkimi-0.0.3.tar.gz.

File metadata

  • Download URL: revkimi-0.0.3.tar.gz
  • Upload date:
  • Size: 352.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for revkimi-0.0.3.tar.gz
Algorithm Hash digest
SHA256 bc96d50166e3587e1d6e316415cdd70eb2acd302571f62d490cb57aa699eb2be
MD5 347ff2c06bf6c685c2b42ed914263b18
BLAKE2b-256 c53fefdfcc30723327632a24e1b226de1672d5120fde4161f0a5a1301aef9027

See more details on using hashes here.

File details

Details for the file revkimi-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: revkimi-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for revkimi-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 53a440dfe5fa4f2e6429bfb598d045541597cd681ac4128eb8650b617ece4f6d
MD5 1430890835009869cd5deb0187d2ef7e
BLAKE2b-256 e4ea338ac3c86af96de0455fa23ab2d12c571c46e76fd34523d739b8871cd0a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page