From 02d64a7ae419b3922108419fde96d37cc1435e58 Mon Sep 17 00:00:00 2001 From: Arnav Mahalpure <100768252+AranavMahalpure@users.noreply.github.com> Date: Mon, 14 Oct 2024 22:56:40 +0530 Subject: [PATCH] Update welcome_to_llmware_windows.sh This pull request introduces a Bash script for setting up the LLMWare environment and running selected examples. The script handles the installation of core and optional dependencies, moves selected example scripts to the root directory for easy execution, and provides informative feedback throughout the process. It also includes basic error handling to ensure smooth execution. --- welcome_to_llmware_windows.sh | 106 +++++++++++++++++----------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/welcome_to_llmware_windows.sh b/welcome_to_llmware_windows.sh index 504ac0f3..5234f99c 100644 --- a/welcome_to_llmware_windows.sh +++ b/welcome_to_llmware_windows.sh @@ -1,66 +1,66 @@ -#! /bin/bash +#!/bin/bash -# Welcome to LLMWare script - handles some basic setup for first-time cloning of the repo +# Welcome to the LLMWare script - handles basic setup for first-time cloning of the repo # Windows version +# Function to handle errors +function error_exit { + echo "Error: $1" + exit 1 +} + # Install core dependencies -pip3 install -r ./llmware/requirements.txt +echo "Installing core dependencies..." +pip3 install -r ./llmware/requirements.txt || error_exit "Failed to install core dependencies." + +# Install optional dependencies (optional step) +echo "Installing optional dependencies..." +pip3 install -r ./llmware/requirements_extras.txt || echo "Optional dependencies installation skipped or failed." -# Note: this step is optional but adds many commonly-used optional dependencies (including in several examples) -pip3 install -r ./llmware/requirements_extras.txt +# Move selected examples into root path for easy execution from the command line +echo "Moving selected examples to the root path..." +declare -a examples=( + "examples/Getting_Started/welcome_example.py" + "fast_start/rag/*.py" + "examples/UI/gguf_streaming_chatbot.py" + "examples/SLIM-Agents/agent-llmfx-getting-started.py" + "examples/SLIM-Agents/using_slim_extract_model.py" + "examples/SLIM-Agents/using_slim_summary.py" + "examples/Models/bling_fast_start.py" + "examples/Models/dragon_gguf_fast_start.py" + "examples/Prompts/document_summarizer.py" + "examples/Use_Cases/web_services_slim_fx.py" + "examples/Use_Cases/invoice_processing.py" + "examples/Models/using-whisper-cpp-sample-files.py" + "examples/Parsing/parsing_microsoft_ir_docs.py" + "examples/Models/chat_models_gguf_fast_start.py" + "examples/Models/gguf_streaming.py" +) -# Move selected examples into root path for easy execution from command line -scp ./examples/Getting_Started/welcome_example.py . -scp ./fast_start/rag/*.py . -scp ./examples/UI/gguf_streaming_chatbot.py . -scp ./examples/SLIM-Agents/agent-llmfx-getting-started.py . -scp ./examples/SLIM-Agents/using_slim_extract_model.py . -scp ./examples/SLIM-Agents/using_slim_summary.py . -scp ./examples/Models/bling_fast_start.py . -scp ./examples/Models/dragon_gguf_fast_start.py . -scp ./examples/Prompts/document_summarizer.py . -scp ./examples/Use_Cases/web_services_slim_fx.py . -scp ./examples/Use_Cases/invoice_processing.py . -scp ./examples/Models/using-whisper-cpp-sample-files.py . -scp ./examples/Parsing/parsing_microsoft_ir_docs.py . -scp ./examples/Models/chat_models_gguf_fast_start.py . -scp ./examples/Models/gguf_streaming.py . +for example in "${examples[@]}"; do + cp "$example" . || error_exit "Failed to copy $example." +done echo "Welcome Steps Completed" -echo "1. Installed Core Dependencies" -echo "2. Installed Several Optional Dependencies Useful for Running Examples" -echo "3. Moved selected Getting Started examples into /root path" -echo " -- welcome_example.py" -echo " -- example-1-create_first_library.py" -echo " -- example-2-build_embeddings.py" -echo " -- example-3-prompts_and_models.py" -echo " -- example-4-rag-text-query.py" -echo " -- example-5-rag-semantic-query.py" -echo " -- example-6-rag-multi-step-query.py" -echo " -- gguf_streaming.py" -echo " -- bling_fast_start.py" -echo " -- using_slim_extract_model.py" -echo " -- using_slim_summary.py" -echo " -- dragon_gguf_fast_start.py" -echo " -- invoice_processing.py" -echo " -- gguf_streaming_chatbot.py" -echo " -- agent-llmfx-getting-started.py" -echo " -- whisper-cpp-sample-files.py" -echo " -- web_services_slim_fx.py" -echo " -- parsing_microsoft_ir_docs.py" -echo " -- document_summarizer.py" -echo " -- chat_models_gguf_fast_start.py ." +echo "1. Installed Core Dependencies" +echo "2. Installed Several Optional Dependencies Useful for Running Examples" +echo "3. Moved selected Getting Started examples into /root path" + +echo "Selected examples:" +for example in "${examples[@]}"; do + echo " -- $(basename "$example")" +done echo "" -echo "To run an example from command-line: py welcome_example.py" -echo "To run gguf_streaming_chatbot.py: streamlit run gguf_streaming_chatbot.py" -echo "Note: check the /examples folder for 100+ additional examples" -echo "Note: on first time use, models will be downloaded and cached locally" -echo "Note: open up the examples and edit for more configuration options" +echo "To run an example from the command line: py welcome_example.py" +echo "To run gguf_streaming_chatbot.py: streamlit run gguf_streaming_chatbot.py" +echo "Note: Check the /examples folder for 100+ additional examples." +echo "Note: On first-time use, models will be downloaded and cached locally." +echo "Note: Open up the examples and edit for more configuration options." echo "" -echo "Running welcome_example.py" -py welcome_example.py +echo "Running welcome_example.py..." +py welcome_example.py || error_exit "Failed to run welcome_example.py." -# keeps bash console open (may be in separate window) -bash +# Keeps the bash console open (may be in a separate window) +exec bash