LLM based APIs
Project description
Void Terminal
The CLI & python API for the well-known project gpt_academic
.
Installation
- source installation.
bash init.bash
- Pip installation (Not recommended).
pip install void-terminal
Usage (Commandline)
- Chat
vt -a "hello, world!"
- Ask about how to do a linux command
vt -c "List all docker containers currently running on this system"
- Config (For all possible configurations, read
config.py
in the mother project.)
# Warning! This will write configuration into .bashrc and change your ENV variables !! Use with caution !! 警告,该命令会修改你的.bashrc文件,持久修改你的环境变量
vt --set_conf API_KEY "sk-123456789123456789123456789"
vt --set_conf LLM_MODEL "gpt-3.5-turbo"
vt --set_conf DEFAULT_WORKER_NUM "20"
Usage (Python API)
- Chat without interaction
import void_terminal as vt
# For more available configurations (including network proxy, api, using chatglm etc.),
# see config.py of in the mother project:
# https://github.com/binary-husky/gpt_academic.git
vt.set_conf(key="API_KEY", value="sk-xxxxxxxxxxxxxx")
vt.set_conf(key="LLM_MODEL", value="gpt-3.5-turbo")
chat_kwargs = vt.get_chat_default_kwargs()
chat_kwargs['inputs'] = 'Hello, world!'
result = vt.get_chat_handle()(**chat_kwargs)
print('\n*************\n' + result + '\n*************\n' )
- Using mother project's plugin (Example: translate THIS readme file to Chinese)
import void_terminal as vt
from rich.live import Live
from rich.markdown import Markdown
vt.set_conf(key="API_KEY", value="sk-xxxxxxxxxxxxxx")
vt.set_conf(key="LLM_MODEL", value="gpt-3.5-turbo")
plugin = vt.get_plugin_handle('void_terminal.crazy_functions.BatchTranslateMarkdown->TranslateMarkdownToSpecifiedLanguage')
plugin_kwargs = vt.get_plugin_default_kwargs()
plugin_kwargs['main_input'] = './README.md'
my_working_plugin = plugin(**plugin_kwargs)
with Live(Markdown(""), auto_refresh=False) as live:
for cookies, chat, hist, msg in my_working_plugin:
md_str = vt.chat_to_markdown_str(chat)
md = Markdown(md_str)
live.update(md, refresh=True)
- Using mother project's plugin (Example: chat with multiple LLM models)
import void_terminal as vt
from rich.live import Live
from rich.markdown import Markdown
llm_model = "gpt-3.5-turbo&gpt-4"
vt.set_conf(key="API_KEY", value="sk-xxxxxxxxxxxxxx")
vt.set_conf(key="LLM_MODEL", value=llm_model)
plugin = vt.get_plugin_handle('void_terminal.crazy_functions.InquiryMultipleLargeLanguageModels->SimultaneousInquiry')
plugin_kwargs = vt.get_plugin_default_kwargs()
plugin_kwargs['main_input'] = 'Hello, world!'
plugin_kwargs['plugin_kwargs'] = {"advanced_arg": llm_model}
my_working_plugin = plugin(**plugin_kwargs)
with Live(Markdown(""), auto_refresh=False) as live:
for cookies, chat, hist, msg in my_working_plugin:
md_str = vt.chat_to_markdown_str(chat)
md = Markdown(md_str)
live.update(md, refresh=True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
void-terminal-1.0.0.tar.gz
(1.3 MB
view hashes)
Built Distribution
Close
Hashes for void_terminal-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b14405f9424cdcbd0d749451eb1d997c2e37c8611af8aaab563e85f955cf952b |
|
MD5 | 0124069d52b5416c5389e0bf67ec803e |
|
BLAKE2b-256 | 29ae2fd5e93ba4e047c3fa525502730202928ebfe946274ea6818098cfb3589b |