binary-husky / gpt_academic

为GPT/GLM等LLM大语言模型提供实用化交互接口,特别优化论文阅读/润色/写作体验,模块化设计,支持自定义快捷按钮&函数插件,支持Python和C++等项目剖析&自译解功能,PDF/LaTex论文翻译&总结功能,支持并行问询多种LLM模型,支持chatglm3等本地模型。接入通义千问, deepseekcoder, 讯飞星火, 文心一言, llama2, rwkv, claude2, moss等。
https://github.com/binary-husky/gpt_academic/wiki/online
GNU General Public License v3.0
63.66k stars 7.88k forks source link

[Feature]: Friendly to gradio_client remote access #1083

Open c2j opened 1 year ago

c2j commented 1 year ago

Class | 类型

程序主体

Feature Request | 功能请求

I want to integrate get_academic backend with my chatbot, so I use gradio client to connect the server by api, I think fn_index is the internet call order, but it may change in future if the source code refactored, So I want to fix them.

>>>from gradio_client import Client
>>>client = Client("http://192.168.1.4:22387")
>>>client.view_api()
Client.predict() Usage Info
---------------------------
Named API endpoints: 0

Unnamed API endpoints: 42

 - predict(显示隐藏功能区, fn_index=0) -> (value_10, 输入区2, value_17, value_72, 高级参数输入区)
    Parameters:
     - [Checkboxgroup] 显示隐藏功能区: List[str] 
    Returns:
     - [Textbox] value_10: str 
     - [Textbox] 输入区2: str 
     - [Button] value_17: str 
     - [Button] value_72: str 
     - [Textbox] 高级参数输入区: str 

 - predict(local_llm_maxlength, 更换llm模型请求源, parameter_10, 输入区2, topp_nucleus_sampling, temperature, 当前模型gpt35turbo, system_prompt, 高级参数输入区, fn_index=1) -> (当前模型gpt35turbo, value_19)
    Parameters:
     - [Slider] local_llm_maxlength: int | float (numeric value between 256 and 8192) 
     - [Dropdown] 更换llm模型请求源: str (Option from: ['gpt-3.5-turbo-16k', 'gpt-3.5-turbo', 'azure-gpt-3.5', 'api2d-gpt-3.5-turbo', 'gpt-4', 'api2d-gpt-4', 'chatglm', 'moss', 'newbing', 'stack-claude']) 
     - [Textbox] parameter_10: str 
     - [Textbox] 输入区2: str 
     - [Slider] topp_nucleus_sampling: int | float (numeric value between 0 and 1.0) 
     - [Slider] temperature: int | float (numeric value between 0 and 2.0) 
     - [Chatbot] 当前模型gpt35turbo: str (filepath to JSON file) 
     - [Textbox] system_prompt: str 
     - [Textbox] 高级参数输入区: str 
    Returns:
     - [Chatbot] 当前模型gpt35turbo: str (filepath to JSON file) 
     - [Markdown] value_19: str 
...
binary-husky commented 1 year ago

Thank you, it is likely that we could change API for better UI and more inputs

I advice using child project void-terminal with Python API.

https://github.com/binary-husky/void-terminal

void-terminal provides same service without gradio or any UI

binary-husky commented 1 year ago

As for the gradio_client access, any suggestions?