Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • Sodium-air fuel cells could power future electric planes
    • Watch this – French startup Moments Lab raises €21 million to scale video discovery with Agentic AI
    • The 37 Best Shows on Apple TV+ Right Now (June 2025)
    • New Footage Confirms Switch 2 Versions of Pokemon Scarlet and Violet Run at 60 FPS
    • Pornhub pulls out of France over age verification law
    • 10 AI Boyfriend Chatbots No Sign Up
    • Tech giants choose Robotiq
    • Breakthrough in bioluminescence for virus detection
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Tuesday, June 3
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»AI Technology News»One-Click LLM Bash Helper
    AI Technology News

    One-Click LLM Bash Helper

    Editor Times FeaturedBy Editor Times FeaturedJanuary 31, 2025No Comments12 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link





    What are LLMs?

    A Massive Language Mannequin (LLM) is a sophisticated AI system designed to carry out complicated pure language processing (NLP) duties like textual content era, summarization, translation, and extra. At its core, an LLM is constructed on a deep neural community structure often called a transformer, which excels at capturing the intricate patterns and relationships in language. A few of the widely known LLMs embrace ChatGPT by OpenAI, LLaMa by Meta, Claude by Anthropic, Mistral by Mistral AI, Gemini by Google and much more. 

    The Energy of LLMs in At this time’s Era:

    1. Understanding Human Language: LLMs have the power to know complicated queries, analyze context, and reply in ways in which sound human-like and nuanced.
    2. Information Integration Throughout Domains: Because of coaching on huge, various information sources, LLMs can present insights throughout fields from science to inventive writing.
    3. Adaptability and Creativity: One of the thrilling facets of LLMs is their adaptability. They’re able to producing tales, writing poetry, fixing puzzles, and even holding philosophical discussions. 

    Drawback-Fixing Potential: LLMs can deal with reasoning duties by figuring out patterns, making inferences, and fixing logical issues, demonstrating their functionality in supporting complicated, structured thought processes and decision-making.

    For builders trying to streamline doc workflows utilizing AI, instruments just like the Nanonets PDF AI provide priceless integration choices. Coupled with Ministral’s capabilities, these can considerably improve duties like doc extraction, guaranteeing environment friendly information dealing with. Moreover, instruments like Nanonets’ PDF Summarizer can additional automate processes by summarizing prolonged paperwork, aligning effectively with Ministral’s privacy-first purposes.

    Automating Day-to-Day Duties with LLMs:

    LLMs can remodel the best way we deal with on a regular basis duties, driving effectivity and liberating up priceless time. Listed below are some key purposes:

    • Electronic mail Composition: Generate customized e-mail drafts rapidly, saving time and sustaining skilled tone.
    • Report Summarization: Condense prolonged paperwork and experiences into concise summaries, highlighting key factors for fast assessment.
    • Buyer Assist Chatbots: Implement LLM-powered chatbots that may resolve widespread points, course of returns, and supply product suggestions primarily based on person inquiries.
    • Content material Ideation: Help in brainstorming and producing inventive content material concepts for blogs, articles, or advertising and marketing campaigns.
    • Knowledge Evaluation: Automate the evaluation of knowledge units, producing insights and visualizations with out handbook enter.
    • Social Media Administration: Craft and schedule partaking posts, work together with feedback, and analyze engagement metrics to refine content material technique.
    • Language Translation: Present real-time translation companies to facilitate communication throughout language obstacles, ideally suited for international groups.

    To additional improve the capabilities of LLMs, we will leverage Retrieval-Augmented Era (RAG). This strategy permits LLMs to entry and incorporate real-time data from exterior sources, enriching their responses with up-to-date, contextually related information for extra knowledgeable decision-making and deeper insights.

    One-Click on LLM Bash Helper

    We are going to discover an thrilling technique to make the most of LLMs by growing an actual time software referred to as One-Click on LLM Bash Helper. This instrument makes use of a LLM to simplify bash terminal utilization. Simply describe what you wish to do in plain language, and it’ll generate the right bash command for you immediately. Whether or not you are a newbie or an skilled person on the lookout for fast options, this instrument saves time and removes the guesswork, making command-line duties extra accessible than ever! 

    The way it works:

    1. Open the Bash Terminal: Begin by opening your Linux terminal the place you wish to execute the command.
    1. Describe the Command: Write a transparent and concise description of the duty you wish to carry out within the terminal. For instance, “Create a file named abc.txt on this listing.”
    1. Choose the Textual content: Spotlight the duty description you simply wrote within the terminal to make sure it may be processed by the instrument.
    1. Press Set off Key: Hit the F6 key in your keyboard as default (may be modified as wanted). This triggers the method, the place the duty description is copied, processed by the instrument, and despatched to the LLM for command era.
    1. Get and Execute the Command: The LLM processes the outline, generates the corresponding Linux command, and pastes it into the terminal. The command is then executed routinely, and the outcomes are displayed so that you can see.

    Construct On Your Personal

    For the reason that One-Click on LLM Bash Helper might be interacting with textual content in a terminal of the system, it is important to run the appliance domestically on the machine. This requirement arises from the necessity to entry the clipboard and seize key presses throughout totally different purposes, which isn’t supported in on-line environments like Google Colab or Kaggle.

    To implement the One-Click on LLM Bash Helper, we’ll must arrange a couple of libraries and dependencies that may allow the performance outlined within the course of. It’s best to arrange a brand new setting after which set up the dependencies. 

    Steps to Create a New Conda Atmosphere and Set up Dependencies

    1. Open your terminal
    2. Create a brand new Conda setting. You may title the setting (e.g., llm_translation) and specify the Python model you wish to use (e.g., Python 3.9):
    conda create -n bash_helper python=3.9
    
    1. Activate the brand new setting:
    conda activate bash_helper
    1. Set up the required libraries: 
    • Ollama: It’s an open-source mission that serves as a robust and user-friendly platform for operating LLMs in your native machine. It acts as a bridge between the complexities of LLM know-how and the will for an accessible and customizable AI expertise. Set up ollama by following the directions at https://github.com/ollama/ollama/blob/main/docs/linux.md and in addition run:
    pip set up ollama
    • To begin ollama and set up LLaMa 3.1 8B as our LLM (one can use different fashions) utilizing ollama, run the next instructions after ollama is put in:
    ollama serve

    Run this in a background terminal. After which execute the next code to put in the llama3.1 utilizing ollama:

    ollama run llama3.1

    Listed below are a few of the LLMs that Ollama helps – one can select primarily based on their necessities

    Mannequin Parameters Measurement Obtain
    Llama 3.2 3B 2.0GB ollama run llama3.2
    Llama 3.2 1B 1.3GB ollama run llama3.2:1b
    Llama 3.1 8B 4.7GB ollama run llama3.1
    Llama 3.1 70B 40GB ollama run llama3.1:70b
    Llama 3.1 405B 231GB ollama run llama3.1:405b
    Phi 3 Mini 3.8B 2.3GB ollama run phi3
    Phi 3 Medium 14B 7.9GB ollama run phi3:medium
    Gemma 2 2B 1.6GB ollama run gemma2:2b
    Gemma 2 9B 5.5GB ollama run gemma2
    Gemma 2 27B 16GB ollama run gemma2:27b
    Mistral 7B 4.1GB ollama run mistral
    Moondream 2 1.4B 829MB ollama run moondream2
    Neural Chat 7B 4.1GB ollama run neural-chat
    Starling 7B 4.1GB ollama run starling-lm
    Code Llama 7B 3.8GB ollama run codellama
    Llama 2 Uncensored 7B 3.8GB ollama run llama2-uncensored
    LLAVA 7B 4.5GB ollama run llava
    Photo voltaic 10.7B 6.1GB ollama run photo voltaic

    • Pyperclip: It’s a Python library designed for cross-platform clipboard manipulation. It means that you can programmatically copy and paste textual content to and from the clipboard, making it simple to handle textual content choices.
    pip set up pyperclip
    • Pynput: Pynput is a Python library that gives a technique to monitor and management enter units, corresponding to keyboards and mice. It means that you can hear for particular key presses and execute capabilities in response. 
    pip set up pynput

    Code sections:

    Create a python file “helper.py” the place all the next code might be added:

    1. Importing the Required Libraries: Within the helper.py file, begin by importing the mandatory libraries:
    import pyperclip
    import subprocess
    import threading
    import ollama
    from pynput import keyboard
    1. Defining the CommandAssistant Class: The CommandAssistant class is the core of the appliance. When initialized, it begins a keyboard listener utilizing pynput to detect keypresses. The listener constantly screens for the F6 key, which serves because the set off for the assistant to course of a process description. This setup ensures the appliance runs passively within the background till activated by the person.
    class CommandAssistant:
        def __init__(self):
            # Begin listening for key occasions
            self.listener = keyboard.Listener(on_press=self.on_key_press)
            self.listener.begin()
    1. Dealing with the F6 Keypress: The on_key_press technique is executed each time a secret is pressed. It checks if the pressed secret is F6. If that’s the case, it calls the process_task_description technique to begin the workflow for producing a Linux command. Any invalid key presses are safely ignored, guaranteeing this system operates easily.
        def on_key_press(self, key):
            strive:
                if key == keyboard.Key.f6:
                    # Set off command era on F6
                    print("Processing process description...")
                    self.process_task_description()
            besides AttributeError:
                go
    
    1. Extracting Job Description: This technique begins by simulating the “Ctrl+Shift+C” keypress utilizing xdotool to repeat chosen textual content from the terminal. The copied textual content, assumed to be a process description, is then retrieved from the clipboard by way of pyperclip. A immediate is constructed to instruct the Llama mannequin to generate a single Linux command for the given process. To maintain the appliance responsive, the command era is run in a separate thread, guaranteeing the principle program stays non-blocking.
        def process_task_description(self):
            # Step 1: Copy the chosen textual content utilizing Ctrl+Shift+C
            subprocess.run(['xdotool', 'key', '--clearmodifiers', 'ctrl+shift+c'])
    
            # Get the chosen textual content from clipboard
            task_description = pyperclip.paste()
    
            # Arrange the command-generation immediate
            immediate = (
                "You're a Linux terminal assistant. Convert the next description of a process "
                "right into a single Linux command that accomplishes it. Present solely the command, "
                "with none extra textual content or surrounding quotes:nn"
                f"Job description: {task_description}"
            )
    
            # Step 2: Run command era in a separate thread
            threading.Thread(goal=self.generate_command, args=(immediate,)).begin()
    
    1. Producing the Command: The generate_command technique sends the constructed immediate to the Llama mannequin (llama3.1) by way of the ollama library. The mannequin responds with a generated command, which is then cleaned to take away any pointless quotes or formatting. The sanitized command is handed to the replace_with_command technique for pasting again into the terminal. Any errors throughout this course of are caught and logged to make sure robustness.
        def generate_command(self, immediate):
            strive:
                # Question the Llama mannequin for the command
                response = ollama.generate(mannequin="llama3.1", immediate=immediate)
                generated_command = response['response'].strip()
    
                # Take away any surrounding quotes (if current)
                if generated_command.startswith("'") and generated_command.endswith("'"):
                    generated_command = generated_command[1:-1]
                elif generated_command.startswith('"') and generated_command.endswith('"'):
                    generated_command = generated_command[1:-1]
                
                # Step 3: Exchange the chosen textual content with the generated command
                self.replace_with_command(generated_command)
            besides Exception as e:
                print(f"Command era error: {str(e)}")
    
    1. Changing Textual content within the Terminal: The replace_with_command technique takes the generated command and copies it to the clipboard utilizing pyperclip. It then simulates keypresses to clear the terminal enter utilizing “Ctrl+C” and “Ctrl+L” and pastes the generated command again into the terminal with “Ctrl+Shift+V.” This automation ensures the person can instantly assessment or execute the urged command with out handbook intervention.
        def replace_with_command(self, command):
            # Copy the generated command to the clipboard
            pyperclip.copy(command)
    
            # Step 4: Clear the present enter utilizing Ctrl+C
            subprocess.run(['xdotool', 'key', '--clearmodifiers', 'ctrl+c'])
    
            subprocess.run(['xdotool', 'key', '--clearmodifiers', 'ctrl+l'])
    
            # Step 5: Paste the generated command utilizing Ctrl+Shift+V
            subprocess.run(['xdotool', 'key', '--clearmodifiers', 'ctrl+shift+v'])
    
    1. Working the Software: The script creates an occasion of the CommandAssistant class and retains it operating in an infinite loop to constantly hear for the F6 key. This system terminates gracefully upon receiving a KeyboardInterrupt (e.g., when the person presses Ctrl+C), guaranteeing clear shutdown and liberating system assets.
    if __name__ == "__main__":
        app = CommandAssistant()
        # Maintain the script operating to hear for key presses
        strive:
            whereas True:
                go
        besides KeyboardInterrupt:
            print("Exiting Command Assistant.")
    

    Save all of the above elements as ‘helper.py’ file and run the appliance utilizing the next command:

    python helper.py

    And that is it! You have now constructed the One-Click on LLM Bash Helper. Let’s stroll by means of how one can use it.

    Workflow

    Open terminal and write the outline of any command to carry out. After which comply with the under steps:

    • Choose Textual content: After writing the outline of the command you have to carry out within the terminal, choose the textual content.
    • Set off Translation: Press the F6 key to provoke the method.
    • View End result: The LLM finds the correct code to execute for the command description given by the person and substitute the textual content within the bash terminal. Which is then routinely executed.

    As on this case, for the outline – “Checklist all of the information on this listing” the command given as output from the LLM was -“ls”.

    For entry to the entire code and additional particulars, please go to this GitHub repo link.

    Listed below are a couple of extra examples of the One-Click on LLM Bash Helper in motion:

    It gave the code “high” upon urgent the set off key (F6) and after execution it gave the next output:

    • Deleting a file with filename

    Suggestions for customizing the assistant

    1. Selecting the Proper Mannequin for Your System: Choosing the right language mannequin first.

          Obtained a Highly effective PC? (16GB+ RAM)

    • Use llama2:70b or mixtral –  They provide wonderful high quality code era however want extra compute energy.
    • Excellent for skilled use or when accuracy is essential

    Working on a Mid-Vary System? (8-16GB RAM)

    • Use llama2:13b or mistral – They provide an incredible steadiness of efficiency and useful resource utilization.
    • Nice for each day use and most era wants

    Working with Restricted Assets? (4-8GB RAM)

    • llama2:7b or phi are good on this vary.
    • They’re quicker and lighter however nonetheless get the job completed

    Though these fashions are beneficial, one can use different fashions in accordance with their wants.

    1. Personalizing Keyboard Shortcut : Need to change the F6 key? One can change it to any key! For instance to make use of ‘T’ for translate, or F2 as a result of it is simpler to achieve. It is tremendous simple to alter – simply modify the set off key within the code, and it is good to go.
    2. Customising the Assistant: Possibly as a substitute of bash helper, one wants assist with writing code in a sure programming language (Java, Python, C++). One simply wants to switch the command era immediate. As an alternative of linux terminal assistant change it to python code author or to the programming language most well-liked.

    Limitations

    1. Useful resource Constraints: Working massive language fashions typically requires substantial {hardware}. For instance, at least 8 GB of RAM is required to run the 7B models, 16 GB to run the 13B models, and 32 GB to run the 33B models.
    2. Platform Restrictions: Using xdotool and particular key mixtures makes the instrument depending on Linux methods and will not work on different working methods with out modifications.
    3. Command Accuracy: The instrument might often produce incorrect or incomplete instructions, particularly for ambiguous or extremely particular duties. In such instances, utilizing a extra superior LLM with higher contextual understanding could also be essential.
    4. Restricted Customization: With out specialised fine-tuning, generic LLMs would possibly lack contextual changes for industry-specific terminology or user-specific preferences.

    For duties like extracting data from paperwork, instruments corresponding to Nanonets’ Chat with PDF have evaluated and used a number of LLMs like Ministral and might provide a dependable technique to work together with content material, guaranteeing correct information extraction with out threat of misrepresentation.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Editor Times Featured
    • Website

    Related Posts

    Inside the tedious effort to tally AI’s energy appetite

    June 3, 2025

    Fueling seamless AI at scale

    May 30, 2025

    This benchmark used Reddit’s AITA to test how much AI models suck up to us

    May 30, 2025

    Designing Pareto-optimal GenAI workflows with syftr

    May 28, 2025

    The AI Hype Index: College students are hooked on ChatGPT

    May 28, 2025

    How to improve AP and invoice tasks

    May 28, 2025

    Comments are closed.

    Editors Picks

    Sodium-air fuel cells could power future electric planes

    June 3, 2025

    Watch this – French startup Moments Lab raises €21 million to scale video discovery with Agentic AI

    June 3, 2025

    The 37 Best Shows on Apple TV+ Right Now (June 2025)

    June 3, 2025

    New Footage Confirms Switch 2 Versions of Pokemon Scarlet and Violet Run at 60 FPS

    June 3, 2025
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    About Us
    About Us

    Welcome to Times Featured, an AI-driven entrepreneurship growth engine that is transforming the future of work, bridging the digital divide and encouraging younger community inclusion in the 4th Industrial Revolution, and nurturing new market leaders.

    Empowering the growth of profiles, leaders, entrepreneurs businesses, and startups on international landscape.

    Asia-Middle East-Europe-North America-Australia-Africa

    Facebook LinkedIn WhatsApp
    Featured Picks

    GLP-1 Meds: Potential Benefits, Risk Factors and Overdose Info

    March 7, 2025

    Robots-Blog | ‘Switch’ by VEX Robotics: Bridging the Gap Between Block Coding and Python

    December 14, 2024

    12 Probiotic Foods That Make for a Healthy, Happy Gut

    September 5, 2024
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    Copyright © 2024 Timesfeatured.com IP Limited. All Rights.
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us

    Type above and press Enter to search. Press Esc to cancel.