在问 https://www.zaiwen.top/ API。在问api python client,类似openai client,集成langchain,方便大家学习课程,开发应用。
- 不需要代理
- 不需要api key
- 兼容修改后的接口
sequenceDiagram
participant 用户
participant 在问
participant OpenAI
用户->>+在问: 发送请求
在问->>+在问: 添加key,修改请求
在问->>+OpenAI: 发送请求
OpenAI->>+在问: 返回响应
在问->>+在问: 修改响应
在问->>+用户: 返回响应
url从浏览器查看
import requests
# 在问url and api
url = "https://www.13042332817.top"
# url = "https://www.gaosijiaoyu.cn"
resource = "/message"
input_message = {"message": [{"role": "user", "content": "你好"}], "mode": "v3.5", "key": None}
response = requests.post(url + resource, json=input_message)
text = response.text
print(text)
from zaiwen.get_completion import get_completion
prompt = f"""
你好
"""
response = get_completion(prompt, url="https://www.13042332817.top")
print(response)
需要安装langchain
$ pip install langchain
from zaiwen.zaiwen_llm import ZaiWenLLM
llm = ZaiWenLLM(url="https://www.13042332817.top")
print(llm('你好'))
print(llm)
$ pip install zaiwen
1. 流式传输
2. 更多API例子,chat 模式
3. langchain 集成例子
4. 实现转发服务,兼容现有openai应用,只修改base url即可
4.1 用户=>转发服务=>在问
4.2 用户=>转发服务=>openai