![edi1](https://private-user-images.githubusercontent.com/97216551/336011654-1f6d71ee-8bb0-473a-acf4-fe276039d290.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMTcxMzQsIm5iZiI6MTczOTAxNjgzNCwicGF0aCI6Ii85NzIxNjU1MS8zMzYwMTE2NTQtMWY2ZDcxZWUtOGJiMC00NzNhLWFjZjQtZmUyNzYwMzlkMjkwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDEyMTM1NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZlMTQyMDZjNTI0ZDU1MTgyOWYyZTYyMDI4Mzk1MGE4OTI1NjNhYzY2ODIwZDFkYTJmYjAxMGE4ZjNmYjAyYzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.RClJuIc3AdgfqBVPmuzhHuMrJeY_POGespj9LqYtq2Y)
This repository contains a basic chat interface that helps users generate bash code through natural language descriptions. A fine-tuned version of the CodeLlama-7b model trained on a custom dataset is used to generate code, which is then explained by inferencing the microsoft phi3-mini-4k LLM through prompting. The dataset consists of natural language commands and their corresponding Bash script outputs, making it capable of generating Bash scripts from natural language input prompts. The dataset is available on Hugging Face as AnishJoshi/nl2bash-custom The finetuned model is also public on HuggingFace as AnishJoshi/codellama2-finetuned-nl2bash-fin
- Clone the repository:
git clone https://github.com/AnishJoshi13/Bash-Scripting-Assistant
- Navigate to the project directory:
cd Bash-Scripting-Assistant/
- Run the installation script:
./install.sh
-
Create an Inference Endpoint on Hugging Face:
-
goto https://huggingface.co/AnishJoshi/codellama2-finetuned-nl2bash-fin
-
select deploy and follow on screen instructions
-
goto https://huggingface.co/microsoft/Phi-3-mini-4k-instruct
-
select deploy and follow on screen instructions
-
-
Store API URL and HF Token in .env File:
-
Create a .env file in the project root directory.
-
llama_api_url="your api url for the deployed finetuned model" hf_token="your hugging face personal access token" phi3_api_url="your api url for the deployed phi-3-mini-4k-instruct model"
-
To start using the assistant, run:
streamlit run app/chat_interface.py
- Command+Scripts: Provides both single line bash commands and complete script codes
- Code Explanation: Explains the generated bash code line by line.
All contributions are welcome! Please check TODO for future plans
Thanks to these research papers for helping me curate the dataset
-
@inproceedings{LinWZE2018:NL2Bash, author = {Xi Victoria Lin and Chenglong Wang and Luke Zettlemoyer and Michael D. Ernst}, title = {NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System}, booktitle = {Proceedings of the Eleventh International Conference on Language Resources and Evaluation {LREC} 2018, Miyazaki (Japan), 7-12 May, 2018.}, year = {2018} }
-
@article{Fu2021ATransform, title={A Transformer-based Approach for Translating Natural Language to Bash Commands}, author={Quchen Fu and Zhongwei Teng and Jules White and Douglas C. Schmidt}, journal={2021 20th IEEE International Conference on Machine Learning and Applications (ICMLA)}, year={2021}, pages={1241-1244} }
-
@article{fu2023nl2cmd, title={NL2CMD: An Updated Workflow for Natural Language to Bash Commands Translation}, author={Fu, Quchen and Teng, Zhongwei and Georgaklis, Marco and White, Jules and Schmidt, Douglas C}, journal={Journal of Machine Learning Theory, Applications and Practice}, pages={45--82}, year={2023} }
For support, feedback and project collaborations please contact Anish Joshi or Anish Joshi - LinkedIn
A lot of feature addtions can be done so that the assistant is workspace compatible to be used commercially
- Improve UI
- Handle conversation history
- Contextual response generation
- Code verification loop and error correction