feat: 01_06b
Browse files- README.md +21 -21
- app/app.py +11 -1
README.md
CHANGED
@@ -2,33 +2,33 @@
|
|
2 |
This is the repository for the LinkedIn Learning course `Hands-On AI: Building and Deploying LLM-Powered Apps`. The full course is available from [LinkedIn Learning][lil-course-url].
|
3 |
|
4 |
_See the readme file in the main branch for updated instructions and information._
|
5 |
-
##
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
The branches are structured to correspond to the videos in the course. The naming convention is `CHAPTER#_MOVIE#`. As an example, the branch named `02_03` corresponds to the second chapter and the third video in that chapter.
|
10 |
-
Some branches will have a beginning and an end state. These are marked with the letters `b` for "beginning" and `e` for "end". The `b` branch contains the code as it is at the beginning of the movie. The `e` branch contains the code as it is at the end of the movie. The `main` branch holds the final state of the code when in the course.
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
Add changes to git using this command: git add .
|
21 |
-
Commit changes using this command: git commit -m "some message"
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
2. Clone this repository into your local machine using the terminal (Mac), CMD (Windows), or a GUI tool like SourceTree.
|
27 |
-
3. [Course-specific instructions]
|
28 |
|
|
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
[lil-thumbnail-url]: http://
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
This is the repository for the LinkedIn Learning course `Hands-On AI: Building and Deploying LLM-Powered Apps`. The full course is available from [LinkedIn Learning][lil-course-url].
|
3 |
|
4 |
_See the readme file in the main branch for updated instructions and information._
|
5 |
+
## Lab1: Introduction to Chainlit
|
6 |
+
We will be using [Chainlit](https://docs.chainlit.io/get-started/overview) as the frontend framework to develop our LLM Powered applications. Chainlit is an open-source Python package that makes it incredibly fast to build Chat GPT like applications with your own business logic and data.
|
7 |
|
8 |
+
In this lab, we will put up a very simple Chainlit application that echos a user's query.
|
|
|
|
|
9 |
|
10 |
+
For example, if user says
|
11 |
|
12 |
+
```
|
13 |
+
hello
|
14 |
+
```
|
15 |
|
16 |
+
Our Chainlit app will respond with
|
|
|
|
|
|
|
17 |
|
18 |
+
```
|
19 |
+
Received: hello
|
20 |
+
```
|
|
|
|
|
21 |
|
22 |
+
The learning objective is to familiarize with Chainlit's framework and to launch the application.
|
23 |
|
24 |
+
## Exercises
|
25 |
|
26 |
+
We have created some template code in `app/app.py` in the `app folder`.
|
|
|
27 |
|
28 |
+
1. Please go through [Chainlit's documentation](https://docs.chainlit.io/get-started/pure-python) and answer the questions in `app/app.py`
|
29 |
+
|
30 |
+
2. Please lanuch the application by running the following command on the Terminal:
|
31 |
+
|
32 |
+
```bash
|
33 |
+
chainlit run app/app.py -w
|
34 |
+
```
|
app/app.py
CHANGED
@@ -1,9 +1,19 @@
|
|
1 |
import chainlit as cl
|
2 |
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
async def main(message: cl.Message):
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
response = message.content
|
8 |
|
9 |
await cl.Message(content=response).send()
|
|
|
1 |
import chainlit as cl
|
2 |
|
3 |
|
4 |
+
##############################################################################
|
5 |
+
# Exercise 1a:
|
6 |
+
# Please add the proper decorator to this main function so Chainlit will call
|
7 |
+
# this function when it receives a message
|
8 |
+
##############################################################################
|
9 |
async def main(message: cl.Message):
|
10 |
|
11 |
+
##############################################################################
|
12 |
+
# Exercise 1b:
|
13 |
+
# Please get the content of the chainlit Message and send it back as a
|
14 |
+
# response
|
15 |
+
#
|
16 |
+
##############################################################################
|
17 |
response = message.content
|
18 |
|
19 |
await cl.Message(content=response).send()
|