- ell Bash में लिखा गया LLM के लिए एक कमांड-लाइन इंटरफ़ेस है, जो टर्मिनल से LLM से सवाल पूछने और साथ में टर्मिनल context भेजने की सुविधा देता है
- यह pipe input, file input और standard input को support करता है, इसलिए मौजूदा Unix tool flow के साथ इस्तेमाल किया जा सकता है, और interactive mode में context बनाए रखते हुए chat की जा सकती है
- templates के ज़रिए function calling और LLM provider-विशिष्ट features को support करता है, और इसमें sensitive information हटाने की सुविधा भी शामिल है
- इसे इस्तेमाल करने के लिए bash 4.1 या उससे ऊपर, coreutils या OS X utilities, jq, और curl चाहिए; record mode इस्तेमाल करने पर perl और util-linux का
script कमांड अतिरिक्त रूप से चाहिए
- Google
gemini-1.5-flash और OpenAI gpt-4o-mini के configuration examples दिए गए हैं, और इसे लगभग pure Bash implementation होने के कारण हल्का, install, extend और modify करने में आसान बताया गया है
ell की मुख्य सुविधाएँ
- ell Bash में लिखा गया LLM के लिए एक कमांड-लाइन इंटरफ़ेस है
- इससे टर्मिनल से LLM से सवाल पूछे जा सकते हैं, और इसे pipes के साथ आसानी से इस्तेमाल करने के लिए डिज़ाइन किया गया है
- टर्मिनल का context LLM को भेजकर उसके बाद सवाल पूछा जा सकता है
- टर्मिनल के अंदर LLM के साथ chat की जा सकती है
- templates के ज़रिए function calling और अतिरिक्त features को support करता है
- इसमें sensitive information हटाने की सुविधा शामिल है, और संबंधित आइटम के रूप में #14 लिंक किया गया है
आवश्यकताएँ और इंस्टॉलेशन
- बेसिक उपयोग के लिए ये tools चाहिए
- bash 4.1 या उससे ऊपर
- coreutils या OS X utilities
- JSON parsing के लिए jq
- HTTPS requests के लिए curl
- अगर record mode इस्तेमाल नहीं किया जाता, तो ये tools अनिवार्य नहीं हैं
- PCRE के लिए perl
- टर्मिनल input और output रिकॉर्ड करने के लिए util-linux का
script कमांड
- इंस्टॉलेशन का तरीका repository को
~/.ellrc.d में clone करना और उस path को PATH में जोड़ना है
git clone --depth 1 https://github.com/simonmysun/ell.git ~/.ellrc.d
echo 'export PATH="${HOME}/.ellrc.d:${PATH}"' >> ~/.bashrc
कॉन्फ़िगरेशन का तरीका
- configuration document Configuration में है
- Google
gemini-1.5-flash इस्तेमाल करने का उदाहरण ~/.ellrc में नीचे दिए गए values सेट करता है
ELL_API_STYLE=gemini
ELL_LLM_MODEL=gemini-1.5-flash
ELL_TEMPLATE=default-gemini
ELL_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ELL_API_URL=https://generativelanguage.googleapis.com/v1beta/models/
- OpenAI
gpt-4o-mini इस्तेमाल करने का उदाहरण नीचे दी गई settings का उपयोग करता है
ELL_API_STYLE=openai
ELL_LLM_MODEL=gpt-4o-mini
ELL_TEMPLATE=default-openai
ELL_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ELL_API_URL=https://api.openai.com/v1/chat/completions
उपयोग के उदाहरण
- साधारण सवाल command argument के रूप में दिया जाता है
ell "What is the capital of France?"
- model तय करके file को input के रूप में इस्तेमाल किया जा सकता है
ell -m gpt-4o -f user_prompt.txt
- standard input भी support किया जाता है
cat somecode.py | ell -f -
- template में डाले बिना तुरंत अतिरिक्त prompt जोड़ा जा सकता है
(cat somecode.py; echo "Explain this code") | ell -f -
- record mode टर्मिनल input और output को रिकॉर्ड करता है और बाद के सवालों के लिए context के रूप में इस्तेमाल करता है
ell -r
# do random stuff
ell What does the error code mean?
ell How to fix it?
- interactive mode को
-i से चलाया जाता है, और interactive mode में context-based chat के लिए record mode अपने-आप enable हो जाता है
ell -i
- template तय करते हुए record mode और interactive mode को साथ में शुरू किया जा सकता है
ell -r -i -t ctf-gemini
ell -r -i -t ctf-openai
templates, styling, plugins
- templates लिखने का document Templates में है
- ell में LLM provider के plugin support का उपयोग करने वाली सुविधा templates के रूप में लागू की गई है
- styling document Styling में है
- plugins document Plugins में है
- यहाँ Plugin से मतलब उन scripts से है जिन्हें ell कॉल कर सकता है, और जिनका उपयोग ell की functionality बढ़ाने के लिए किया जा सकता है
- LLM provider द्वारा supported plugins इस category में शामिल नहीं हैं; उस feature के लिए template document देखना चाहिए
नाम और implementation का चयन
ell नाम shell और LLM के संयोजन से बना है
shellm नाम पर भी विचार किया गया था, लेकिन उसे she llm समझे जाने की संभावना के कारण छोड़ दिया गया
ell को छोटा, टाइप करने में आसान, याद रखने में आसान, और सक्रिय software से टकराव न करने वाला नाम बताया गया है
- इसे Bash में लिखने का कारण यह बताया गया है कि Bash Unix-आधारित systems में सबसे आम shell है, और इस उपयोग के लिए किसी अधिक जटिल भाषा की ज़रूरत नहीं है
- समान projects से अंतर के रूप में यह बताया गया है कि यह लगभग pure Bash में लिखा गया है, इसलिए हल्का है और install करना आसान है, और extend तथा modify करना भी आसान है
- यह pipe-friendly है, इसलिए इसे दूसरे tools के साथ मिलाकर इस्तेमाल करने के लिए डिज़ाइन किया गया है
संबंधित दस्तावेज़ और लाइसेंस
- ध्यान देने योग्य जोखिम Risks Consideration में व्यवस्थित हैं
- contributions issues या pull request के ज़रिए स्वीकार किए जाते हैं
- लाइसेंस MIT License है, और विस्तृत जानकारी LICENSE फ़ाइल में है
1 टिप्पणियां
Hacker News की राय
सोच रहा/रही हूँ कि क्या ell एक tool के तौर पर standard input pipe ले सकता है
https://llm.datasette.io/ tool में इसे अक्सर
cat somecode.py | llm -m claude-3.5-sonnet "Explain this code"की तरह इस्तेमाल करते हैं, और instructions को system prompt के रूप में अलग करकेcat somecode.py | llm -m claude-3.5-sonnet --system "Explain this code"की तरह भी इस्तेमाल करते हैंइस तरह LLM में content को pipe कर पाना दिलचस्प उपयोग संभव बनाता है, जैसे web page scrape करके सवालों के जवाब दिलवाना: https://simonwillison.net/2024/Jun/17/cli-language-models/#f...
llmcommand-line tool, Claude 3 Opus reviews, और काफी सस्ते 3.5 Sonnet के बारे में जानने के बाद LLM रोज़ इस्तेमाल करने लगा/लगीpipe feature सच में बहुत काम आता है, और इसे
curl | llm -m claude-3.5-sonnet -s 'How long does the main content of this article take to read? First count words, then convert using a slow and fast common reading speed.'की तरह web articles का reading time estimate करने के लिए इस्तेमाल करता/करती हूँword count उम्मीद से ज़्यादा बार गलत होता है, लेकिन आम तौर पर order of magnitude सही रहता है, इसलिए काफी है
हाल में सबसे ज़्यादा इस्तेमाल होने वाली मेरी shell scripts में से एक का नाम
qहै, जिसमेंllm -s "Answer in as few words as possible. Use a brief style with short replies." -m claude-3.5-sonnet "$*"रखा है, ताकि किसी भी terminal से बेझिझक बेवकूफी भरे सवाल पूछ सकूँq How do I run Docker with a different entrypoint to that in the container?जैसे छोटे सवाल पूछ सकता/सकती हूँ, या here-document से Perl code क्या करता है यह पूछने वाले लंबे सवाल भी कर सकता/सकती हूँ, और अच्छा यह है कि context terminal में बचा रहता हैcat somecode.py | ell -f -की तरह इस्तेमाल कर सकते हैंअगर template में डाले बिना तुरंत एक और prompt जोड़ना हो, तो
(cat somecode.py; echo "Explain this code") | ell -f -की तरह कर सकते हैंREADME में यह शामिल करना चाहिए था, और अगर मैंने
llmऔर उससे जुड़ा article पहले देखा होता, तो ell बनाने की motivation शायद काफी कम हो जातीllmमें claude-3.5-sonnet model को local तौर पर इस्तेमाल करने के लिए कैसे configure करें। plugin docs पढ़कर भी पता नहीं चल पायाshell से कुछ ऐसा ही करने की कोशिश करने वाला एक project भी है। कौन सा बेहतर है, पक्का नहीं
demo
source code
शुरू में लगा था कि यह
.bash_historyजैसी किसी जगह से पढ़कर user input पाने वाली संरचना है, लेकिन देखने पर पता चला कि यह terminal output को context के रूप में इस्तेमाल नहीं कर पाताफिर भी response processing में awk का इस्तेमाल पसंद आया, और लगता है ell भी
jqऔरperldependencies घटाने के लिए awk इस्तेमाल कर सकता हैइसे README के related projects section में जोड़ने का प्लान है
मैंने भी एक मिलता-जुलता tool बनाया था जिसे अब maintain नहीं करता/करती: https://github.com/llimllib/gpt-bash-cli/
सुझाव के तौर पर, conversations को text file की बजाय SQLite database में store करना बेहतर होगा, जिसे users data handle करने के लिए ज्यादा आसानी से इस्तेमाल कर सकें, और
~/.ellrcdकी जगह XDG directories इस्तेमाल करेंसाथ ही, मैं हर execute होने वाले program को API key access नहीं देना चाहता/चाहती, इसलिए environment variables की बजाय system secret store को prefer करता/करती हूँ
यह मान लेना मुश्किल है कि सबके पास SQLite होगा, लेकिन इसे plugin के रूप में optional बनाया जा सकता है
XDG directories और system secret store मौजूदा तरीके से काफी बेहतर लगते हैं, इसलिए उनका usage सीखकर integrate करने की सोच रहा/रही हूँ
arbitrary scripts और programs को API keys जैसे secrets runtime पर कम से कम झंझट के साथ पढ़ पाने चाहिए, और disk पर plaintext में store नहीं होने चाहिए
लगता है
keyringrecommend किया गया था, लेकिन क्या यही “GNU/Linux तरीका” है, या encrypted filesystem में store करना भी option है, चाहे वह FUSE-based हो या न हो?[1]: https://github.com/llimllib/gpt-bash-cli/blob/841682affe2d0e...
LLM keys इतनी critical नहीं हैं, और अपने system पर चलने वाले programs पर भरोसा करना ही पड़ता है
Poetry keyring access मांगता है इसलिए मैं उसे इस्तेमाल नहीं करता/करती; कई सालों से open bug है और असल में उसे access की जरूरत भी नहीं है
निजी तौर पर मुझे text file कहीं बेहतर लगती है
इसी तरह के टूल के तौर पर https://autocomplete.sh बनाया था
https://github.com/closedloop-technologies/autocomplete-sh
मैं चाहता था कि terminal में tab-आधारित autocomplete बस अपने-आप काम करता हुआ लगे
LLM response को
bash_completionजिस format की उम्मीद करता है, उसमें ठीक से ढालना काफ़ी मुश्किल था, लेकिन एक बार चल गया तो OpenAI, grok, Claude, Ollama जैसे local models तक सबको wrap कर सकाइसे और smart बनाने के लिए password हटाई हुई recent history, सेट किए गए environment variables, और संबंधित commands के
--helpoutput भी context window में डालेहाल ही में Boston के आसपास इसका प्रचार शुरू किया है और लगता है लोगों को पसंद आ रहा है
autocomplete के बारे में भी सोचा था, लेकिन मेरा idea Copilot के ज़्यादा करीब था और इस script का user experience बेहतर लगता है
history को context में डालने वाला हिस्सा ell जैसे history mode को जोड़ने पर सच में मददगार होगा
password cleanup अच्छा idea है, इसे plugin के तौर पर जोड़ने वाला हूँ
यह shell के साथ बहुत अच्छी तरह integrate होता है, और सीधे bash में लिखने का चुनाव bold है, लेकिन portability बनाए रखने में कारगर है
जानना चाहूँगा कि क्या यह Fish shell में भी काम करता है, और update या remove कैसे करते हैं
अच्छा लग रहा है। मैं कई machines पर काम करता हूँ, इसलिए shell में लिखे हुए जैसे हल्के tools हमेशा आकर्षित करते हैं
जिज्ञासा है कि
: "${ELL_LOG_LEVEL:=2}";जैसी command colon से क्यों शुरू होती है, क्या समझा सकते हैं? मुझे लगा था colon सिर्फ no-op command के तौर पर ही उपयोगी होता है[1]: https://github.com/simonmysun/ell/blob/main/ell.sh#L19C1-L19...
:मूल रूप से उस line के result के रूप में bash से कुछ भी न करवाता हैइसलिए
: "${ELL_LOG_LEVEL:=2}";बिना output के, सिर्फ तबELL_LOG_LEVELको 2 से initialize करता है जब वह अभी set न होयह यहाँ से सीखा: https://stackoverflow.com/a/28085062/2485717
सिर्फ pure bash और Unix tools इस्तेमाल करने वाला approach दिलचस्प है
मिलते-जुलते goal वाला Plandex[1] बनाया था; dependency-free, terminal-based, context के तौर पर pipe input support समान हैं, लेकिन Go में लिखकर static binary में compile करने का बिल्कुल अलग रास्ता चुना
Plandex ज़्यादा high-level है और coding पर केंद्रित है, जबकि ell बहुत lightweight और general-purpose LLM tool लगता है, और Simon Willison का
llm[2] काफी याद आता हैrecording feature savvy[3] की भी याद दिलाता है
1 - https://github.com/plandex-ai/plandex
2 - https://github.com/simonw/llm
3 - https://github.com/getsavvyinc/savvy-cli
Simon Willison के
llmtool के बारे में नहीं जानता था, लेकिन लगा था उन्होंने ऐसा software बनाया होगाllmLLM को ज़्यादा गहराई से manipulate करने वाली features support करता है, और ell में वे features नहीं हैं; इसकी जगह यह सबसे common और basic interface इस्तेमाल करते हुए pagination या syntax highlighting जैसे user experience improvements को जितना हो सके हल्का रखना चाहता हैजिन users को LLM manipulation ज़्यादा चाहिए, उन्हें
simonw/llmकी ओर guide करने के लिए README में mention करना चाहिएREADME में “Risks” link टूटा हुआ है
मैं चाहता हूँ कि
ell -rअपने-आप on हो जाए, औरfixनाम का alias file changes तक शामिल करते हुए fix का proposal देउदाहरण के लिए
main.ccमें typo हो औरgcc main.ccचलाने के बादfixचलाएँ, तो ell file के लिए diff के रूप में fix suggest करे, approve करने पर changes apply करे और फिरgccदोबारा चलाने का suggestion दे, और approve करने पर चला दे तो अच्छा होगाell -rको.bashrcमें add किया जा सकता है, लेकिन यह user की existing settings से conflict करेगा या कोई और समस्या होगी, इस पर भरोसा नहीं हैpatch confirmation को छोड़ दें तो templates और plugins से संभव लगता है, लेकिन actual changes apply करना technical तौर पर भी और user interface design के लिहाज़ से भी मुश्किल है
क्या-क्या संभव है, यह देखूँगा
ell -rको auto-run करना हो तो बस.bashrcमें add कर देंएक बार try करूँगा, और personally मैं इस काम के लिए aichat[0] इस्तेमाल करता हूँ
यह कहना दिलचस्प है कि ऐसी चीज़ों के लिए bash से ज़्यादा complex language की ज़रूरत नहीं, लेकिन
jq/curl/perlकी ज़रूरत होना क्या उल्टा संकेत नहीं देता?[0] https://github.com/sigoden/aichat
original idea सब कुछ Bash में handle करने का था, लेकिन लिखे हुए कारणों की वजह से यह संभव नहीं था
awk इस्तेमाल करें तो
jqऔरperlहटाए जा सकते हैं, लेकिन code की simplicity और readability की काफ़ी बलि देनी पड़ेगीsyntax highlighter implementation को मैं अपनी ज़िद की lower bound मानता हूँ, और Bash में उससे ज़्यादा complex चीज़ें बनाना नहीं चाहता
ऐसे features support नहीं करूँगा या सिर्फ external plugin के तौर पर support करूँगा
Linux पर मैंने एक छोटा bash script बना रखा है जो latest binary download करके
/home/me/binमें extract कर देता हैदिलचस्प है, लेकिन डेमो वीडियो में सामान्य LLM error दिखती है
यह समझाता है कि
1<>इस्तेमाल करने पर मौजूदा फ़ाइल overwrite हो सकती है, और इससे बचने के लिए-aoption से append करने को कहता है, फिरbash ls 1<> output.txtका example देता है, लेकिन example explanation से मेल नहीं खाता और गलत हैजहां तक मुझे पता है, सबसे करीब का behavior
ls >> output.txtहैइस context में
1<> output.txtका कोई meaningful invocation है या नहीं, पक्का नहीं; शायद इसे 3 जैसे custom file descriptor से bind करके फिरtee --appendइस्तेमाल करने जैसा कुछ हो सकता हैअसल में जब पहले record किया था तो यह इतना खराब नहीं था, और script वही रखते हुए दोबारा record करते समय भी बहुत ज्यादा बदलाव नहीं किया था
पुराने version के लिए पहली बार record किया गया वीडियो यहां है: https://github.com/simonmysun/ell/blob/d4fc5468157fa6adc8f9f...
दुर्भाग्य से LLM stable नहीं होते
संदर्भ के लिए, गलती वाले वीडियो के links ये हैं:
https://github.com/user-attachments/assets/1355ad08-6fbf-4c0...
https://github.com/simonmysun/ell/blob/553d38f60ad104893b2a3...
Charmbracelet के mods मुझे बहुत पसंद हैं
इसे कई महीनों से इस्तेमाल कर रहा हूं; यह अच्छी तरह काम करता है, काफी customizable है, और output भी साफ-सुथरा है
https://github.com/charmbracelet/mods
ell का interactive इस्तेमाल terminal output को record करने के लिए
scriptपर निर्भर करता हैside effects वाले plugin के जरिए past conversations को manage करने का support दिया जा सकता है, लेकिन यह ell के idea और philosophy से मेल खाता है या नहीं, इस पर सोचना होगा
मैंने similar projects खोजे थे, लेकिन HN users ने जो ऐसे मजबूत real-world tools बताए, वे नहीं मिले