Aichat is a AI-powered CLI chat and copilot tool that seamlessly integrates with over 10 leading AI platforms, providing a powerful combination of chat-based interaction, context-aware conversations, and AI-assisted shell capabilities, all within a customizable and user-friendly environment.
AIChat is a cutting-edge CLI chat and copilot tool that seamlessly integrates with over 10 leading AI platforms, providing a powerful combination of chat-based interaction, context-aware conversations, and AI-assisted shell capabilities, all within a customizable and user-friendly environment.
* **Converse with Advanced AI:** Access and interact with 10+ leading AI platforms including OpenAI, Claude, Gemini, and more, all within one interface.
* **Streamline Your Workflow:** Generate code, execute shell commands using natural language, and automate tasks with AI assistance.
* **Unleash Your Creativity:** Utilize AI for writing, translation, image analysis, and exploring new ideas.
* **Customize Your Experience:** Configure settings, create custom roles for AI, and personalize your chat interface.
* **Empower Your Terminal:** Integrate AI into your shell for intelligent autocompletion and command suggestions.
* **Context & Session Management:** Maintain context within conversations and manage multiple sessions effortlessly.
- Integrate with 20+ AI platforms
- Support [Chat-REPL](#chat-repl)
- Support [Roles](#defining-roles)
- Support sessions (context-aware conversation)
- Support image analysis (vision)
- [Shell commands](#shell-commands): Execute commands using natural language
@ -49,18 +63,18 @@ Download pre-built binaries for macOS, Linux, and Windows from [GitHub Releases]
## Configuration
Upon first launch, Aichat will guide you through the configuration process. An example configuration file is provided below:
Upon first launch, AIChat will guide you through the configuration process. An example configuration file is provided below:
```
> No config file, create a new one? Yes
> AI Platform: openai
> API Key: <your_api_key_here>
✨ Saved config file to <config-dir>/aichat/config.yaml
✨ Saved config file to <user-config-dir>/aichat/config.yaml
```
Feel free to adjust the configuration according to your needs.
> Get `config.yaml` path with command `aichat --info` or repl command `.info`.
> 💡 Use the `AICHAT_CONFIG_DIR` environment variable to custom the config dir for aichat files.
```yaml
model: openai:gpt-3.5-turbo # Specify the language model to use
@ -93,9 +107,11 @@ clients:
models:
- name: llama3
max_input_tokens: 8192
...
```
Refer to the [config.example.yaml](config.example.yaml) file for a complete list of configuration options. Environment variables can also be used for configuration; see the [Environment Variables](https://github.com/sigoden/aichat/wiki/Environment-Variables) page for details.
Refer to the [config.example.yaml](config.example.yaml) file for a complete list of configuration options.
## Command line
@ -107,9 +123,11 @@ Arguments:
Options:
-m, --model <MODEL> Select a LLM model
--prompt <PROMPT> Use the system prompt
-r, --role <ROLE> Select a role
-s, --session [<SESSION>] Start or join a session
--save-session Forces the session to be saved
--serve [<ADDRESS>] Serve the LLM API and WebAPP
-e, --execute Execute commands in natural language
@ -156,19 +174,19 @@ Simply input what you want to do in natural language, and aichat will prompt and
aichat -e <text>...
```
Aichat is aware of OS and shell you are using, it will provide shell command for specific system you have. For instance, if you ask `aichat` to update your system, it will return a command based on your OS. Here's an example using macOS:
AIChat is aware of OS and shell you are using, it will provide shell command for specific system you have. For instance, if you ask `aichat` to update your system, it will return a command based on your OS. Here's an example using macOS:
> 💡 Run `.info role` to view your current role information.
> 💡 Run `.info session` to view your current session information.
### `.model` - change the current LLM
```
> .model openai:gpt-4
> .model ollama:llama2
> .model ollama:llama3
```
> You can easily enter model name using tab autocompletion.
> Tab autocompletion helps in quickly typing the model names.
### `.role` - let the AI play a role
### `.role` - switch to a specific role
Select a role:
@ -281,26 +305,15 @@ emoji> .exit role
Hello there! How can I assist you today?
```
Show role info:
```
emoji> .info role
name: emoji
prompt: I want you to translate the sentences I write into emojis. I will write the sentence, and you will express it with emojis. I just want you to express it with emojis. I don't want you to reply with anything but emoji. When I need to tell you something in English, I will do it by wrapping it in curly brackets like {like this}.
temperature: null
```
Temporarily use a role to send a message.
Temporarily use a role without switching to it:
```
> ::: .role emoji
hello world
:::
👋🌍
> .role emoji hello
👋
>
```
### `.session` - context-aware conversation
### `.session` - Begin a chat session
By default, aichat behaves in a one-off request/response manner.
@ -321,22 +334,19 @@ temp) .exit session
```
The prompt on the right side is about the current usage of tokens and the proportion of tokens used,
compared to the maximum number of tokens allowed by the model.
### `.prompt` - make a temporary role using a prompt
### `.prompt` - create a temporary role using a prompt
There are situations where setting a system message is necessary, but modifying the `roles.yaml` file is undesirable.
To address this, we leverage the `.prompt` to create a temporary role specifically for this purpose.
$ aichat --serve 0.0.0.0:8080 # to specify a different server address
```
### OpenAI format API
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.
The `roles.yaml` file allows you to define a variety of roles, each with its own unique prompt and behavior. This enables the LLM to adapt to specific tasks and provide tailored responses.
We can define a role like this:
```yaml
- name: shell
- name: emoji
prompt: >
I want you to act as a Linux shell expert.
I want you to answer only with bash code.
Do not provide explanations.
I want you to translate the sentences I write into emojis.
I will write the sentence, and you will express it with emojis.
I don't want you to reply with anything but emoji.
```
Let LLM answer questions in the role of a Linux shell expert.
This enables the LLM to respond as a Linux shell expert.
```
> .role shell
> .role emoji
shell> extract encrypted zipfile app.zip to /tmp/app
mkdir /tmp/app
unzip -P PASSWORD app.zip -d /tmp/app
emoji> fire
🔥
```
For more details about roles, please visit [Role Guide](https://github.com/sigoden/aichat/wiki/Role-Guide).