Package: chatify
ChatifyChatify is a python package that enables ipython magic commands to Jupyter notebooks that provide LLM-driven enhancements to markdown and code cells.  This package is currently in thealphastage: expect broken things, crashes, bad (wrong, misleading) answers, and other serious issues.  That said, we think Chatify is pretty neat even in this early form, and we're excited about its future!BackgroundThis tool was originally created to supplement theNeuromatch Academymaterials.  A "Chatify-enhanced" version of the Neuromatch computational neuroscience course may be foundhere, and an enhanced version of the deep learning course may be foundhere.Installing and enabling ChatifyTo install and enable chatify in any Jupyter (iPython) notebook, add the following two cells to the top of your notebook (and run them):%pipinstalldavosimportdavosdavos.config.suppress_stdout=Truesmugglechatify%load_extchatifyNo further setup is required.  To interact with Chatify about any code in the notebook, simply insert the%%explainmagic command at the top of the code cell and then run it (shift + enter) to access the Chatify interface.  To disable Chatify and run the code block as usual, just delete the%%explaincommand and re-run the cell (e.g., by pressing shift + enter again).Why those two cells?The first cell installs and enables theDavoslibrary, which is used to safely manage Python dependencies in Jupyter notebooks. Importing Davos provides access to thesmugglekeyword.  Thesmugglekeyword is like a safer and more robust version ofimport; if the requested package isn't available in the current environment, it will be automatically installed and imported. Importantly, any newly installed packages are automatically isolated in a virtual environment.  This prevents Chatify or its dependencies from interfering with other packages that might be installed on your system.Thesmugglestatement in the second cell is what actually installs, configures, and imports Chatify, and the%load_extline loads and enables the Chatify extension (accessed by adding the%%explainmagic command to the top of any code cell in the notebook).If you don't care about protecting your runtime environment from potential side effects of installing Chatify (note: this isnot recommendedand maybreak other aspects of your setup!), you can replace those two cells above with the following:!pipinstall-qqqchatifyimportchatify%load_extchatifyNote: the quiet (-qqq) flags are optional, but including them will avoid cluttering up your notebook with installation-related messages.  It's probably fine to use this "direct/unsafe install" method if you're running Chatify in a Colab notebook, inside of a container, or in a dedicated virtual environment, but you shouldn't install the unsafe version of Chatify locally. GPU-friendly libraries are notoriously finicky, and since Chatify will mess with some of those libraries it's reasonably likely that your other GPU libraries will stop working correctly if you don't isolate Chatify's effects on your system.I like to live on the wild side-- give me the bleeding edge version!Psst...if you really want to see our lack of quality control on full display, we can tell you the secret password 🤫. Step this way...that's right. Don't mind those animals, pay no attention...🐯🦁🦎...🦌🐘🐬🦕...to install Chatify directly from GitHub (even though this is not recommended!!), with no safety checks or guarantees whatsoever, you can add and run this cell to the top of your notebook:!pipinstall-qqqchatifygit+https://github.com/ContextLab/chatify.gitimportchatify%load_extchatifyYou should really only do this in a fully protected (containerized, virtual)
environment or on Colab, since it could break other stuff on your system. Don't
say we didn't warn you!Customizing ChatifyChatify is designed to work by default in the free tiers ofColaboratoryandKagglenotebooks, and to operate without requiring any additional costs or setup beyond installing and enabling Chatify itself. There's some server magic that happens behind the scenes to make that happen.  In addition to Colaboratory and Kaggle notebooks, Chatify also supports a variety of other systems and setups, including running locally or on other cloud-based systems (e.g., if you don't want our servers to see what you're doing 🕵️).  For setups with additional resources, it is possible to switch to better-performing or lower-cost models.  Chatify works in CPU-only environments, but it is GPU-friendly (for both CUDA-enabled and Metal-enabled systems).  We support any text-generation model onHugging Face, Meta'sLlama 2models, and OpenAI'sChatGPTmodels (e.g., ChatGPT-3.5 and ChatGPT-4).  Models that run on Hugging Face or OpenAI's servers require either aHugging Face API keyor anOpenAI API key, respectively.Once you have your API key(s), if needed, create aconfig.yamlfile in the directory where you launch your notebook.  For the OpenAI configuration, replace<OPANAI API KEY>with your actual OpenAI API key (with no quotes) and then create aconfig.yamlfile with the following contents:OpenAI configurationIf you have an OpenAI API key, adding this config.yaml file to your local directory (after adding your API key) will substantially improve your experience by generating higher quality responses:cache_config:cache:Falsecaching_strategy:exact# alternative: similaritycache_db_version:0.1url:<URL># ignore thisfeedback:Falsemodel_config:open_ai_key:<OPENAI API KEY>model:open_ai_modelmodel_name:gpt-4max_tokens:2500chain_config:chain_type:defaultprompts_config:prompts_to_use:[tutor,tester,inventer,experimenter]Llama 2 configurationIf you're running your notebook on a well-resourced machine, you can use this config file to get good performance for free, and without using our servers!  The 7B and 13B variants of llama 2 both run on the free tier of Google Colaboratory and Kaggle, but the 13B is substantially slower (therefore we recommend the 7B variant if you're using Colaboratory or Kaggle notebooks). Note that using this configuration requires installing the "HuggingFace" dependencies (pip install chatify[hf]).cache_config:cache:Falsecaching_strategy:exact# alternative: similaritycache_db_version:0.1url:<URL># ignore thisfeedback:Falsemodel_config:model:llama_modelmodel_name:TheBloke/Llama-2-70B-Chat-GGML# can also replace "70B" with either "7B" or "13B" on this line and the nextweights_fname:llama-2-70b-chat.ggmlv3.q5_1.binmax_tokens:2500n_gpu_layers:40n_batch:512chain_config:chain_type:defaultprompts_config:prompts_to_use:[tutor,tester,inventer,experimenter]Hugging Face configuration (local)If you're running your notebook on a well-resourced machine, you can use this config file to get good performance for free, and without using our servers! For most models this will require lots of RAM. It's a nice way to explore a wide variety of models.  Note that using this configuration requires installing the "HuggingFace" dependencies (pip install chatify[hf]).cache_config:cache:Falsecaching_strategy:exact# alternative: similaritycache_db_version:0.1url:<URL># ignore thisfeedback:Falsemodel_config:model:huggingface_modelmodel_name:TheBloke/Llama-2-70B-Chat-GGML# replace with any text-generation model on Hugging Face!max_tokens:2500n_gpu_layers:40n_batch:512chain_config:chain_type:defaultprompts_config:prompts_to_use:[tutor,tester,inventer,experimenter]After saving yourconfig.yamlfile, follow the "Installing and enabling Chatify" instructions.What do I do if I have questions or problems?We'd love to hear from you 🤩!  If you're using Chatify as part of one of the NMA courses, please consider filling out ourfeedback surveyto help us improve and/or better understand the experience. For more general problems, please submit anissue. And for other questions, comments, concerns, etc., just send us anemail.I want to help!Yay-- welcome 🎉!  This is averynew project (in the "alpha" phase) and we're looking for all the help we can get!  If you're new around here and want to explore/contribute, here's how:Forkthis repository so that you can work with your own "copy" of the code baseTake a look at ourProject Boardand/or the list of openissuesto get a sense of the current project status, todo list, etc.Feel free to add your own issues/tasks, comment on existing issues, etc.Current priorities and suggested tasks to start withIn general, we've broken down tasks into"coding" tasks(which require some amount of coding, likely in Python) and"non-coding" tasks(which donotrequire coding).If you have questions, ideas, etc., also please check out thediscussion board!=======
History0.2.1 (August, 2023)Preparing for a release on pip0.2.0 (July, 2023)Lots of GUI improvementsDefault model is now run on a proxy server (still does not require and setup or API key)0.1.1 (July, 2023)More models are now supported!Everything now runs locally (no need for an OpenAI API key)0.1.0 (July, 2023)Initial package version.