Package: gtsystem
GenAI Techne System (gtsystem)A low code Python package for crafting GenAI applications quicklyGenAI Techne is on a mission to help enterprise and professionals excel in the craft of Generative AI. Check out theGenAI Techne Substackwhere you can read more about our mission, read gtsystem documentation, learn from step-by-step tutorials, and influence the roadmap of gtsystem for your use cases.Getting StartedThe get started usinggtsystempackage follow these steps.Step 1.Install gtsystem package usingpip install gtsystemStep 2.Open a Jupyter notebook and try this sample.fromgtsystemimportopenai,bedrock,ollamaprompt='How many faces does a tetrahedron have?'openai.gpt_text(prompt)bedrock.llama_text(prompt)bedrock.claude_text(prompt)ollama.mistral_text(prompt)Features and Notebook SamplesThegtsystempackage source is available in thisrepository on GitHub.You can read more about the vision behind gtsystem on theGenAI Techne substack post.You can learngtsystemAPI by following along thenotebook samplesincluded in thegtsystemrepo. This samples are documented on theGenAI Techne Substack.Evaluate models using one line of code:Refer01-evaluate.ipynbfor single statement prompt evaluations across multiple models including OpenAI GPT, Bedrock hosted Claude or Llama.Render LLM responses:Use02-render.ipynbfor well formatted rendering of the model responses including markdown tables.Load evaluation tasks from Excel:Try03-tasks.ipynbfor automating evaluation tasks - find, list, load prompts by task, including optimal parameter values for temperature and TopP.Instrument speed and size (cost) of response:Reuse04-instrument.ipynbfor instrumenting and comparing multiple models across latency and size of response.Benchmark quality of response:Use05-benchmark.ipynbfor automated benchmarking quality of responses from models like Llama and Claude using GPT-4 as an LLM evaluator.Run models on your laptop:Get06-ollama.ipynbto run models like Mistral, Llama, and CodeLlama locally on your laptop and compare models hosted on Cloud or proprietary model APIs.Installing DependenciesYou can install following dependencies to work withgtsystembased on your needs. Start with ourrequirements.txtor create your own. Then runpip install -r requirements.txtwithin your environment.# GenAI Techne System
gtsystem

# Python capabilities
pandas
markdown
openpyxl

# Jupyter notebook
jupyterlab
ipywidgets

# AWS for Bedrock managed models
boto3
awscli
botocore

# OpenAI for GPT models
openai

# Ollama for LLMs running on your laptop
ollamaAmazon Bedrock SetupTo useAmazon Bedrockhosted models like Llama and Claude follow these steps.Step 1.Login to AWS Console > Launch Identity and Access Management (IAM) > Create a user for Command-Line Interface (CLI) access.ReadBedrock documentationfor more details.Step 2.InstallAWS CLI> Runaws configurein Terminal > Add credentials from Step 1.Ollama SetupTo use Ollama provided LLMs locally on your laptop follow these steps.Step 1.DownloadOllamaNote the memory requirements for each model. 7b models generally require at least 8GB of RAM. 13b models generally require at least 16GB of RAM. 70b models generally require at least 64GB of RAMStep 2.Find model Ollamalibrary> Run commandollama pull <model>in terminal to download the model.Currently gtsystem supports popular models like llama2, mistral, and llava.OpenAI SetupTo use OpenAI models follow these steps.Step 1.Signup forOpenAI APIaccess and get the API key.Step 2.Add OpenAI API Key to your~/.zshrcor~/.bashrcusingexport OPENAI_API_KEY="your-key-here"Basic Python EnvironmentIf you are new to Python then here is how you can get started from scratch.First, you should be running the latest Python on your system with Python package manager upgraded to the latest.python--version# should return Python 3.10.x or higher as on Jan'23pip--version# should return pip 22.3.x or higher as on Jan'23Follow this guide forMac OS Xif you do not have the latest Python. If installing specific version of Python for managing dependencies then followthis threadto install usingpyenvPython version manager. If required upgrade pip to the latest using the following command.pipinstall--user--upgradepipWe will now create a virtual environment for our MLOps setup so that our dependencies are isolated and do not conflict with the system installed packages. We will followthis guidefor creating and managing the virtual environment. First change to the directory where we will develop our application.python-mvenvenvIf you run ls env you will see following folders and files created.binincludelibpyvenv.cfgNow we can activate our virtual environment like so. You will notice that development directory prefixed with the (env) to indicate you are now running in the virtual environment..env/bin/activateYou can confirm that you are not running inside the virtual environment with its own Python.whichpython## should return /Users/.../env/bin/pythonTo leave the virtual environment using deactivate command. Re-enter using same command as earlier.