1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# AIChat: All-in-one AI CLI Tool
[](https://github.com/sigoden/aichat/actions/workflows/ci.yaml)
[](https://crates.io/crates/aichat)
[](https://discord.gg/mr3ZZUB9hG)
AIChat is an all-in-one AI CLI tool featuring Chat-REPL, Shell Assistant, RAG, AI Tools & Agents, and More.
## Install
### Package Managers
- **Rust Developers:** `cargo install aichat`
- **Homebrew/Linuxbrew Users:** `brew install aichat`
- **Pacman Users**: `pacman -S aichat`
- **Windows Scoop Users:** `scoop install aichat`
- **Android Termux Users:** `pkg install aichat`
### Pre-built Binaries
Download pre-built binaries for macOS, Linux, and Windows from [GitHub Releases](https://github.com/sigoden/aichat/releases), extract them, and add the `aichat` binary to your `$PATH`.
## Get Started
Upon its first launch after installation, AIChat will guide you through the initialization of the configuration file.

You can tailor AIChat to your preferences by editing the configuration file.
The [config.example.yaml](https://github.com/sigoden/aichat/blob/main/config.example.yaml) file provides a comprehensive list of all configuration options with detailed explanations.
## Features
### Multi-Platform Support
Effortlessly connect with over 20 leading LLM platforms through a unified interface:
- **OpenAI:** GPT-4/GPT-3.5 (paid, chat, embedding, vision, function-calling)
- **Gemini:** Gemini-1.5/Gemini-1.0 (free, paid, chat, embedding, vision, function-calling)
- **Claude:** Claude-3.5/Claude-3 (paid, chat, vision, function-calling)
- **Ollama:** (free, local, chat, embedding, vision, function-calling)
- **Groq:** Llama-3.1/Gemma2 (free, chat, function-calling)
- **Azure-OpenAI:** GPT-4/GPT-3.5 (paid, chat, embedding, vision, function-calling)
- **VertexAI:** Gemini/Claude/Mistral (paid, chat, embedding, vision, function-calling)
- **Bedrock:** Llama3.1/Claude3.5/Mistral/Command-R+ (paid, chat, embedding, function-calling)
- **Mistral:** (paid, chat, embedding, function-calling)
- **AI21:** (paid, chat, function-calling)
- **Cohere:** Command-R/Command-R+ (paid, chat, embedding, reranker, function-calling)
- **Perplexity:** Llama-3/Mixtral (paid, chat, online)
- **Cloudflare:** (free, chat, embedding)
- **OpenRouter:** (paid, chat, function-calling)
- **Ernie:** (paid, chat, embedding, reranker, function-calling)
- **Qianwen:** Qwen (paid, chat, embedding, vision, function-calling)
- **Moonshot:** (paid, chat, function-calling)
- **Deepseek:** (paid, chat, function-calling)
- **ZhipuAI:** GLM-4 (paid, chat, embedding, vision, function-calling)
- **LingYiWanWu:** Yi-Large (paid, chat, vision, function-calling)
- **Jina:** (free, paid, embedding, reranker)
- **VoyageAI:** (paid, embedding, reranker)
- **OpenAI-Compatible Platforms**
### CMD & REPL
AIChat supports both CMD and REPL modes to meet the needs and tastes of different users.
| CMD | REPL |
| --------------------------- | ---------------------- |
| `-m, --model <model>` | `.model <model>` |
| `-r, --role <role>` | `.role <role>` |
| ` --prompt <prompt>` | `.prompt <text>` |
| `-s, --session [<session>]` | `.session [<session>]` |
| `-a, --agent <agent>` | `.agent <agent>` |
| `-R, --rag <rag>` | `.rag <rag>` |
| `-f, --file <file/url>` | `.file <file/url>` |
| ` --info` | `.info` |
```sh
aichat # Enter REPL
aichat Tell a joke # Generate response
aichat -r role1 # Enter REPL with the role 'role1'
aichat -r role1 hello world # Generate response with role 'role1'
aichat -e install neovim # Execute command
aichat -c fibonacci in js # Generate code
cat data.toml | aichat -c to json > data.json # Pipe Input/Output
output=$(aichat -S $input) # Run in the script
aichat -f data.txt # Use local file
aichat -f image.png Recognize text # Use image file
aichat -f dir/file1 -f dir/file2 Summarize # Use multi files
aichat -f dir/ Summarize # Use local dir
aichat -f https://example.com/readme Summarize # Use website
```
### Shell Assistant
Supercharge your command line experience. Simply describe your desired actions in natural language, and let AIChat translate your requests into precise shell commands.

**OS-Aware Intelligence:** AIChat tailors commands to your specific operating system and shell environment.
### Prompt & Role
Define custom roles to tailor LLM behaviors, enhancing interactions and boosting productivity.

### Session Management
Maintain context-aware conversations through sessions, ensuring continuity in interactions.

### RAG
Integrate external documents into your AI conversations for more accurate and contextually relevant responses.

### Function Calling
Function calling supercharges LLMs by connecting them to external tools and data sources. This unlocks a world of possibilities, enabling LLMs to go beyond their core capabilities and tackle a wider range of tasks.
We have created a new repository [https://github.com/sigoden/llm-functions](https://github.com/sigoden/llm-functions) to help you make the most of this feature.
#### AI Tools
Integrate external tools to automate tasks, retrieve information, and perform actions directly within your workflow.

#### AI Agents
While tools excel at specific tasks, agents offer a more sophisticated approach to problem-solving and user interaction.
Agent = Prompt (Role) + Tools (Function Callings) + Knowndge (RAG). It's also known as OpenAI's GPTs.

### Local Server
AIChat comes with a built-in lightweight http server.
```
$ aichat --serve
Chat Completions API: http://127.0.0.1:8000/v1/chat/completions
Embeddings API: http://127.0.0.1:8000/v1/embeddings
Rerank API: http://127.0.0.1:8000/v1/rerank
LLM Playground: http://127.0.0.1:8000/playground
LLM Arena: http://127.0.0.1:8000/arena?num=2
```
#### Proxy LLM APIs
AIChat offers the ability to function as a proxy server for all LLMs. This allows you to interact with different LLMs using the familiar OpenAI API format, simplifying the process of accessing and utilizing these LLMs.
Test with curl:
```sh
curl -X POST -H "Content-Type: application/json" -d '{
"model":"claude:claude-3-opus-20240229",
"messages":[{"role":"user","content":"hello"}],
"stream":true
}' http://127.0.0.1:8000/v1/chat/completions
```
#### LLM Playground
The LLM Playground is a webapp that allows you to interact with any LLM supported by AIChat directly in your browser.

#### LLM Arena
The LLM Arena is a web-based platform where you can compare different LLMs side-by-side.

## Custom Themes
AIChat supports custom dark and light themes, which highlight response text and code blocks.

## Documentation
- [Configuration Guide](https://github.com/sigoden/aichat/wiki/Configuration-Guide)
- [Command-Line Guide](https://github.com/sigoden/aichat/wiki/Command-Line-Guide)
- [Chat-REPL Guide](https://github.com/sigoden/aichat/wiki/Chat-REPL-Guide)
- [Role Guide](https://github.com/sigoden/aichat/wiki/Role-Guide)
- [RAG Guide](https://github.com/sigoden/aichat/wiki/RAG-Guide)
- [Environment Variables](https://github.com/sigoden/aichat/wiki/Environment-Variables)
- [Custom Theme](https://github.com/sigoden/aichat/wiki/Custom-Theme)
- [Custom REPL Prompt](https://github.com/sigoden/aichat/wiki/Custom-REPL-Prompt)
- [FAQ](https://github.com/sigoden/aichat/wiki/FAQ)
## License
Copyright (c) 2023-2024 aichat-developers.
AIChat is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
See the LICENSE-APACHE and LICENSE-MIT files for license details.
|