You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, only OpenAI style API is supported. More API styles are coming soon.
54
+
## Usage examples
96
55
97
-
## Usage
98
-
```
99
-
Usage: ell [options] PROMPT
100
-
-h, --help: show this help
101
-
-V, --version: show version
102
-
-m, --model: model name
103
-
-T, --template-path: path to search for templates
104
-
-t, --template: template filename without extension
105
-
-f, --input-file: use file as input prompt
106
-
-r, --record: enter record mode
107
-
-i, --interactive: enter interactive mode
108
-
--api-style: api style
109
-
--api-key: api key
110
-
--api-url: api url
111
-
--api-disable-streaming: disable api response streaming
112
-
-c, --config: config file
113
-
-l, --log-level: log level
114
-
-o, --option: other options, e.g. -o A=b -o C=d,E=f
115
-
PROMPT: prompt to input
116
-
For more information, see https://github.com/simonmysun/ell
117
-
```
56
+
Make sure you have configured correctly.
118
57
119
-
### Examples
120
-
#### Ask a question
58
+
Ask a question:
121
59
122
60
```bash
123
61
ell "What is the capital of France?"
124
62
```
125
63
126
-
#### Specify a template
64
+
Specify a model and use a file as input:
127
65
128
66
```bash
129
-
ell -t default "What is the capital of France?"
67
+
ell -m gpt-4o -f user_prompt.txt
130
68
```
131
69
132
-
#### Specify a model
70
+
Specify a template:
133
71
134
72
```bash
135
-
ell -m gpt-4o"What is the capital of France?"
73
+
ell -t default"What is the capital of France?"
136
74
```
137
75
138
-
#### Record terminal input and output and use as context
76
+
Record terminal input and output and use as context:
139
77
140
78
```bash
141
79
ell -r
142
80
# do random stuff
143
-
ell What does the error mean?
81
+
ell What does the error code mean?
144
82
ell How to fix it?
145
83
```
146
84
147
-
#### Run in interactive mode
85
+
Run in interactive mode:
148
86
149
87
```bash
150
88
ell -i
151
89
```
152
90
153
-
if you were in record mode via `ell -r`, the context of the shell will be used. The two modes can be combined: `ell -r -i`.
91
+
If you were in record mode via `ell -r`, the context of the shell will be used. The two modes can be combined: `ell -r -i`.
92
+
93
+
## Writing Templates
154
94
155
-
### Writing Templates
156
-
Currently, there are two variables that can be used in the templates, except the ones given by users:
95
+
See [Templates](docs/Templates.md).
157
96
158
-
-`$SHELL_CONTEXT`: The context of the shell. This only works when the shell is started with `ell -r`.
159
-
-`$USER_PROMPT`: The prompt text given by the user.
97
+
## Styling
160
98
161
-
For more information, please refer to [templates/default.json].
99
+
See [Styling](docs/Styling.md).
162
100
163
-
More possibilities are coming soon!
101
+
## Plugins
164
102
103
+
See [Plugins](docs/Plugins.md).
165
104
166
105
## Risks to consider
167
106
168
-
- The prompts are sent to LLM backends, so be careful with sensitive information.
169
-
- The output of LLMs is not guaranteed to be correct or safe.
170
-
- In record mode, all your input and output history are written to `/tmp/tmp.xxxx` and are readable by root user.
171
-
- LLM can be tuned or prompted to return deceptive results, e.g. manipulating your terminal
172
-
- Unexpected exit of record mode may cause the history file to remain in `/tmp/`.
173
-
- Password input is not recorded by `script`, so it is safe to type sudo or ssh passwords in terminal.
107
+
See [Risks Consideration](docs/Risks.md).
108
+
109
+
## FAQ
110
+
111
+
-**Q**: Why is it called "ell"?
112
+
-**A**: "ell" is a combination of shell and LLM. It is a shell script to use LLM backends. "shellm" was once considered, but it was dropped because it could be misunderstood as "she llm". "ell" is shorter, easy to type and easy to remember. It does not conflict with any active software. Note that the name "shell" of shell scripts is because it is the outer layer of the operating system exposed to the user. It doesn't indicate that it is a CLI or GUI. Unfortunately it cannot be shortened to "L" which has the same pronunciation because that would conflict with too many things.
113
+
114
+
115
+
-**Q**: Why is it written in Bash?
116
+
-**A**: Because Bash is the most common shell on Unix-like systems and there is just no need to use a more complex language for this.
117
+
118
+
119
+
-**Q**: What is the difference between ell and other similar projects?
120
+
-**A**: ell is written in almost pure Bash, which makes it very lightweight and easy to install. It is also very easy to extend and modify. It is pipe friendly, which means it is designed to be used in combination with other tools.
174
121
175
122
## Similar Projects
176
123
177
-
-https://github.com/kardolus/chatgpt-cli
178
-
- A CLI for ChatGPT written in Go.
179
-
- Cannot bring terminal context to the LLMs.
180
-
- No syntax highlighting.
181
-
- Supports system prompt customization but doesn't support prompt templates.
182
-
-https://github.com/kharvd/gpt-cli
183
-
- A CLI for various LLM backends written in Python.
184
-
- Has syntax highlighting for markdown output.
185
-
- Cannot bring terminal context to the LLMs.
186
-
- Supports system prompt customization but doesn't support prompt templates.
187
-
-https://github.com/JohannLai/gptcli
188
-
- A CLI for OpenAI LLms written in TypeScript.
189
-
- Has plugin system.
190
-
- Support customizing CLI tools
124
+
-https://github.com/kardolus/chatgpt-cli - A CLI for ChatGPT written in Go.
125
+
-https://github.com/kharvd/gpt-cli A CLI for various LLM backends written in Python.
126
+
-https://github.com/JohannLai/gptcli A CLI for OpenAI LLms written in TypeScript.
Ell supports plugins to extend its functionality through a hook system. Currently, the following hooks are available:
4
+
5
+
-`post_input`: Called after the user prompt is received.
6
+
-`pre_llm`: Called before the payload is sent to the language model.
7
+
-`post_llm`: Called after the response is received and decoded from the language model.
8
+
-`pre_output`: Called before the output is sent to the user.
9
+
10
+
Plugins should be placed in the `./plugins` directory related to the ell script, typically located at `~/.ellrc.d/plugins` if you follow the installation instructions in the readme.
11
+
12
+
Each plugin should be a folder containing executable shell scripts. The file name should follow the format `XX_${HOOK_NAME}.sh`, where `XX` is a number that determines the execution order among other plugins. For example, the paginator plugin is placed in `~/.ellrc.d/plugins/paginator/90_pre_output.sh`.
13
+
14
+
Plugin scripts are executed in ascending numerical order and piped to each other.
15
+
16
+
It is recommended to write plugins in a streaming manner.
17
+
18
+
Below is an example of a simple plugin script:
19
+
20
+
```bash
21
+
#!/usr/bin/env bash
22
+
23
+
cat;
24
+
```
25
+
26
+
This plugin will simply pass the input to the next plugin in the chain.
Templates are used to generate the payload sent to the language model. They are written in JSON format and can be customized by users. Templates are where you set the prompt text and other parameters for the language model.
4
+
5
+
Currently, there are two variables that can be used in the templates, except the ones given by users:
6
+
7
+
-`$SHELL_CONTEXT`: The context of the shell. This only works when the shell is started with `ell -r`.
8
+
-`$USER_PROMPT`: The prompt text given by the user.
0 commit comments