{ "cells": [ { "cell_type": "raw", "metadata": {}, "source": [ "---\n", "description: An experimental Vegan recipe chatbot\n", "output-file: index.html\n", "title: lv-recipe-chatbot\n", "\n", "---\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Install" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```sh\n", "pip install -e '.[dev]'\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## How to use" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "language": "python" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Running on local URL: http://127.0.0.1:7860\n", "\n", "To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/plain": [] }, "execution_count": null, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#| eval: false\n", "from dotenv import load_dotenv\n", "\n", "load_dotenv() # or load environment vars with different method\n", "\n", "demo = app.create_demo(app.ConversationBot())\n", "demo.launch()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "or \n", "```sh\n", "python3 app.py\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Dev quick-start\n", "\n", "`git clone` the repo \n", "\n", "```sh\n", "cd lv-recipe-chatbot\n", "``` \n", "\n", "Make sure to use the version of python specified in `py_version.txt` \n", "Create a virtual environment.\n", "\n", "```sh\n", "python3 -m venv env\n", "```\n", "\n", "Activate the env and install dependencies.\n", "\n", "```sh\n", "source env/bin/activate\n", "pip install -r requirements.txt\n", "pip install -r requirements/dev.txt\n", "```\n", "\n", "To make the Jupyter environment, git friendly: `nbdev_install_hooks` \n", "If you want to render documentation locally, you will want to [install Quarto](https://nbdev.fast.ai/tutorials/tutorial.html#install-quarto).\n", "\n", "`nbdev_install_quarto` \n", "\n", "Put API secrets in .env\n", "\n", "```sh\n", "cp .env.example .env\n", "```\n", "\n", "Edit .env with your secret key(s). Only `OPEN_AI_KEY` is required.\n", "\n", "Then start the Gradio demo from within the virtual environment. \n", "\n", "```sh\n", "python3 app.py\n", "```\n", "\n", "Preview documentation\n", "\n", "```sh\n", "nbdev_preview\n", "```\n", "\n", "## Dependencies\n", "\n", "If a new dependency for development is helpful for developers, add it to `dev.txt`. \n", "If it is a dependency for the app that is imported in source code, add it to `core.txt`. \n", "Then run:\n", "\n", "```sh\n", "scripts/pin_requirements.sh\n", "```\n", "\n", "This will update our `requirements.txt` to include the dependency as it should be pinned in the environment. \n", "\n", "\n", "## Development\n", "\n", "[quick nbdev tutorial](https://nbdev.fast.ai/tutorials)\n", "\n", "Make changes in `/nbs`. \n", "Update the package files with `nbdev_export` then reimport with `pip install -e '.[dev]'`\n", "\n", "Preview doc `nbdev_preview` \n", "Build docs, test and update README `nbdev_prepare`\n", "\n", "\n", "\n", "## Useful links\n", "\n", "* [Task Matrix (Formerly Visual ChatGPT)](https://github.com/microsoft/TaskMatrix)\n", "* [LangChain](https://python.langchain.com/en/latest/index.html)\n", "* [LLM Prompt Engineering](https://www.promptingguide.ai)\n", "* [OpenAI best practices for prompts](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-openai-api)" ] } ], "metadata": { "kernelspec": { "display_name": "python3", "language": "python", "name": "python3" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }