File size: 4,949 Bytes
adaea7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f3a430
adaea7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5f3a430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adaea7c
 
 
5f3a430
adaea7c
 
5f3a430
adaea7c
5f3a430
 
adaea7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f533eef
adaea7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
{
 "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": [
    "<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->"
   ]
  },
  {
   "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": [
       "<div><iframe src=\"http://127.0.0.1:7860/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "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
}