feat: 02_10 wip
Browse files- README.md +2 -3
- app/app.py +0 -12
README.md
CHANGED
@@ -2,10 +2,9 @@
|
|
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 |
-
In
|
7 |
|
8 |
-
In this lab, we will implement adding OpenAI's embedding model and index the documents we chunked in the previous section into a Vector Database. We will be using [Chroma](https://www.trychroma.com/) as the vector database of choice. Chroma is a lightweight embedding database that can live in memory, similar to SQLite.
|
9 |
|
10 |
## Exercises
|
11 |
|
|
|
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 |
+
## Lab5: Putting it All Together
|
6 |
+
In Lab 2, we created the basic scaffold of our Chat with PDF App. In Lab 3, we added PDF uploading and processing functionality. In Lab 4, we added the capability to indexing documents into a vector database. Now we have all the required pieces together, it's time for us to assemble our RAG (retrieval-augmented generation) system using Langchain.
|
7 |
|
|
|
8 |
|
9 |
## Exercises
|
10 |
|
app/app.py
CHANGED
@@ -92,18 +92,12 @@ def create_search_engine(*, docs: List[Document], embeddings: Embeddings) -> Vec
|
|
92 |
client_settings=client_settings
|
93 |
)
|
94 |
search_engine._client.reset()
|
95 |
-
##########################################################################
|
96 |
-
# Exercise 1b:
|
97 |
-
# Now we have defined our encoder model and initialized our search engine
|
98 |
-
# client, please create the search engine from documents
|
99 |
-
##########################################################################
|
100 |
search_engine = Chroma.from_documents(
|
101 |
client=client,
|
102 |
documents=docs,
|
103 |
embedding=embeddings,
|
104 |
client_settings=client_settings
|
105 |
)
|
106 |
-
##########################################################################
|
107 |
|
108 |
return search_engine
|
109 |
|
@@ -136,15 +130,9 @@ async def on_chat_start():
|
|
136 |
await msg.update()
|
137 |
|
138 |
# Indexing documents into our search engine
|
139 |
-
##########################################################################
|
140 |
-
# Exercise 1a:
|
141 |
-
# Add OpenAI's embedding model as the encoder. The most standard one to
|
142 |
-
# use is text-embedding-ada-002.
|
143 |
-
##########################################################################
|
144 |
embeddings = OpenAIEmbeddings(
|
145 |
model="text-embedding-ada-002"
|
146 |
)
|
147 |
-
##########################################################################
|
148 |
try:
|
149 |
search_engine = await cl.make_async(create_search_engine)(
|
150 |
docs=docs,
|
|
|
92 |
client_settings=client_settings
|
93 |
)
|
94 |
search_engine._client.reset()
|
|
|
|
|
|
|
|
|
|
|
95 |
search_engine = Chroma.from_documents(
|
96 |
client=client,
|
97 |
documents=docs,
|
98 |
embedding=embeddings,
|
99 |
client_settings=client_settings
|
100 |
)
|
|
|
101 |
|
102 |
return search_engine
|
103 |
|
|
|
130 |
await msg.update()
|
131 |
|
132 |
# Indexing documents into our search engine
|
|
|
|
|
|
|
|
|
|
|
133 |
embeddings = OpenAIEmbeddings(
|
134 |
model="text-embedding-ada-002"
|
135 |
)
|
|
|
136 |
try:
|
137 |
search_engine = await cl.make_async(create_search_engine)(
|
138 |
docs=docs,
|