Skip to content

Commit cc9cb35

Browse files
Pathway-Devpathway-release-manulberkecanrizaizxqfd555-pwpw-ppodhajski
authored and
Manul from Pathway
committed
Synchronize Pathway-labs/realtime-indexer-qa-chat (#5904)
* Initial commit ORIGINAL_AUTHOR=pathway-release-manul <[email protected]> GitOrigin-RevId: 6eb879d * add: readme ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: b8f6565 * add: app code ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: d0e5f99 * add: requirements txt ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 4198d09 * add python-dotenv to requirements ORIGINAL_AUTHOR=pathway-release-manul <[email protected]> GitOrigin-RevId: ec994e8 * correct rag backend host and port ORIGINAL_AUTHOR=pathway-release-manul <[email protected]> GitOrigin-RevId: 6add2a0 * specify extra-index-url for pathway package ORIGINAL_AUTHOR=pathway-release-manul <[email protected]> GitOrigin-RevId: 276f18d * rely on stable version of pathway ORIGINAL_AUTHOR=pathway-release-manul <[email protected]> GitOrigin-RevId: 5babcd1 * fix: restrict responses to context ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 08e7f3f * fix: lint ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: f147cb0 * add: config ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 08296c6 * add: image files ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: f6a7444 * fix: ui, init message, fixes, refactor ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 48e056d * fix: rm comments ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 094dc41 * fix: engine ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: ee4acbf * fix: change folder of config ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 09f31b4 * fix: clear chat memory in state ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: b26abd3 * fix: init ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: c97d741 * fix: theme ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 4b80045 * minor visual improvements ORIGINAL_AUTHOR=Sergey <[email protected]> GitOrigin-RevId: 9039ecb * feat: ui revisions, metadata ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 316bfbd * fix: lint ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: dff6598 * provide more information in status string ORIGINAL_AUTHOR=Sergey <[email protected]> GitOrigin-RevId: 4ebca47 * correct link urls in the sidebar ORIGINAL_AUTHOR=Sergey <[email protected]> GitOrigin-RevId: c46adc3 * Added Dev Container Folder ORIGINAL_AUTHOR=Sergey Kulik <[email protected]> GitOrigin-RevId: b213d5c * pin pathway version until the api is updated ORIGINAL_AUTHOR=Sergey <[email protected]> GitOrigin-RevId: ee07ce6 * add public folders remark ORIGINAL_AUTHOR=Sergey <[email protected]> GitOrigin-RevId: 95d08b1 * unpin pathway version ORIGINAL_AUTHOR=Sergey <[email protected]> GitOrigin-RevId: e87e987 * add a section for last indexed file ORIGINAL_AUTHOR=Sergey <[email protected]> GitOrigin-RevId: 79804b2 * feat: refresh button ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 4fe4e45 * feat: gather endpoint calls in async ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: e29508a * fix: small clean ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: e60fb6e * fix: lint ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 5a0a4fa * feat: add sources ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 6797645 * fix: single call to endpoint instead of 2 ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 1a44303 * feat: get_inputs modified ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 4883491 * fix: err handle in case `path` is missing ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 4af1e0e * fix: issue with retrievals from gdrive ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 1ef1eea * feat: change default prompts ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 95d40b3 * fix: list unique files as sources ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 7c0c041 * fix: title font and texts ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 305febb * feat: change title and icon ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: a32548d * fix: update reqs ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: 09ace67 * fix: . ORIGINAL_AUTHOR=Berke <[email protected]> GitOrigin-RevId: f9e7e11 * deployment: chat-realtime-sharepoint-gdrive (#5717) GitOrigin-RevId: 7747b8a ORIGINAL_AUTHOR=Pawel Podhajski <[email protected]> * fix: system prompt to be more helpful (#5756) * fix: system prompt to be more helpful * fix: pin the llm GitOrigin-RevId: 4df8496 ORIGINAL_AUTHOR=berkecanrizai <[email protected]> * add statuses to streamlit UI (#5757) GitOrigin-RevId: a4047b7 ORIGINAL_AUTHOR=Sergey Kulik <[email protected]> * add: internal versions of apps, app env vars Berke/hosted docindex run mode GitOrigin-RevId: 277d32a ORIGINAL_AUTHOR=berkecanrizai <[email protected]> * feat: add logging to streamlit apps feat: add logs for streamlit apps GitOrigin-RevId: c876465 ORIGINAL_AUTHOR=berkecanrizai <[email protected]> * Merge pull request pathway-labs#1 from pathway-labs/staging feat: add logging to grafana ORIGINAL_AUTHOR=Jan Chorowski <[email protected]> GitOrigin-RevId: 99d80f0 * Merge pull request pathway-labs#2 from pathway-labs/staging fix: log used files ORIGINAL_AUTHOR=Jan Chorowski <[email protected]> GitOrigin-RevId: 759107e * Merge pull request pathway-labs#3 from pathway-labs/staging Add Dockerfile ORIGINAL_AUTHOR=Jan Chorowski <[email protected]> GitOrigin-RevId: cafbf3e * Update Dockerfile ORIGINAL_AUTHOR=Jan Chorowski <[email protected]> GitOrigin-RevId: 986aa60 * feat: docker explaination in readme (pathway-labs#4) Clarify readme instructions --------- Co-authored-by: Jan Chorowski <[email protected]> ORIGINAL_AUTHOR=berkecanrizai <[email protected]> GitOrigin-RevId: 9cca4e8 * Update README.md ORIGINAL_AUTHOR=Adrian Kosowski <[email protected]> GitOrigin-RevId: da304ed --------- Co-authored-by: pathway-release-manul <[email protected]> Co-authored-by: Berke <[email protected]> Co-authored-by: Sergey <[email protected]> Co-authored-by: Sergey Kulik <[email protected]> Co-authored-by: Pawel Podhajski <[email protected]> Co-authored-by: berkecanrizai <[email protected]> Co-authored-by: Jan Chorowski <[email protected]> Co-authored-by: Adrian Kosowski <[email protected]> GitOrigin-RevId: aee4d1e58a33f88a1a3133892b40e66ac82e1b90
1 parent 6b98883 commit cc9cb35

File tree

4 files changed

+92
-54
lines changed

4 files changed

+92
-54
lines changed

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.11
2+
3+
WORKDIR /app
4+
5+
COPY demo/requirements.txt demo/
6+
7+
RUN pip install --pre -U --no-cache-dir -r demo/requirements.txt
8+
9+
COPY . .
10+
11+
EXPOSE 8501
12+
13+
CMD ["streamlit", "run", "demo/app.py", "--server.port", "8501", "--server.fileWatcherType", "none"]

README.md

+41-27
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
21
# Build a chatbot with always updated data sources using Pathway + LlamaIndex + Streamlit
32

4-
## Subtitle: Create a RAG application without a Vector DB, ETL pipelines or separate backend!
3+
## Create a RAG App without a Vector DB or fragmented ETL pipelines!
54

5+
This repository will show you how to build a RAG App that always has up-to-date information from your documents and sources stored in Google Drive, Dropbox, Sharepoint and more.
66

7-
In this post, we explore how to build a RAG application that always has up-to-date information from your documents and sources stored in Google Drive, Dropbox, Sharepoint and more.
7+
The setup guide below describes how to build your **App**. You then connect your App to a public **Pathway Vector Store** sandbox, which is in sync with some public Google Drive and Sharepoint folders. Here, you can upload your own non-confidential files, and try out the App with the sandbox. Finally, we will show you how to quickly spin up your very own Pathway Vector Store which is kept in sync with your own private folders.
88

9+
> ℹ To run the full solution (your very own Pathway Vector Store + App) in a single go in production, with your own private folders, we recommend using this complete [🐋 Dockerized setup 🐋](https://github.com/pathwaycom/llm-app/blob/main/examples/pipelines/demo-document-indexing/README.md) directly.
910
1011
## What is Pathway
1112
Pathway is an open data processing framework. It allows you to easily develop data transformation pipelines and Machine Learning applications that work with live data sources and changing data. Pathway listens to our documents for changes, additions or removals. It handles loading and indexing without the need for an ETL. Specifically, we will use Pathway hosted offering that makes it particularly easy to launch advanced RAG applications with very little overhead.
1213

13-
(Meta note) select one:
14-
- In this demo, you will use Pathway with LlamaIndex with Pathway's LlamaIndex integration which makes it particularly easy to create chatbots that have memory and can access our documents.
15-
16-
- In this demo, you will use LlamaIndex with the Pathway's LlamaIndex integration, and Pathway hosted index solution. Using Pathway and LlamaIndex is a quick way to create powerful chatbots that have memory and can access our documents.
17-
18-
- In this blog, we showcase the integration of LlamaIndex with Pathway's hosted index solution. You can effortlessly develop advanced chatbots with memory capabilities, providing easy real-time access to your documents.
14+
In this repository, we showcase the integration of LlamaIndex with Pathway's Vector Store solution. You can effortlessly develop advanced chatbots with memory capabilities, providing easy real-time access to your documents. The instructions below are intended as a step-by-step tutorial for learning.
1915

2016
## Why Pathway?
2117

22-
Pathway offers an indexing solution that is always up to date without the need for traditional ETL pipelines, which are needed in regular VectorDBs. It can monitor several data sources (files, S3 folders, cloud storage) and provide the latest information to your LLM application.
18+
Pathway is a data processing framework allowing easy building of advanced data processing pipelines. Among others, it offers [Pathway Vector Store](https://pathway.com/developers/user-guide/llm-xpack/vectorstore_pipeline/), a document indexing solution that is always up to date without the need for traditional ETL pipelines, which are needed in regular VectorDBs. It can monitor several data sources (files, S3 folders, cloud storage) and provide the latest information to your LLM application.
2319

2420
This means you do not need to worry about:
2521
- Checking files to see if there are any changes
@@ -30,22 +26,19 @@ These are all handled by Pathway.
3026

3127
## App Overview
3228

33-
This demo consists of three parts. For always up-to-date knowledge and information retrieval from the documents in our folders, Pathway vector store is used.
34-
LlamaIndex provides search capability to OpenAI LLM and combines functionalities such as chat memory, and OpenAI API calls for the app. Finally, Streamlit powers the easy-to-navigate user interface for easy access to the app.
29+
This demo combines three technologies.
30+
* For always up-to-date knowledge and information retrieval from the documents in our folders, **Pathway Vector Store** is used.
31+
* **LlamaIndex** provides search capability to OpenAI LLM and combines functionalities such as chat memory, and OpenAI API calls for the app.
32+
* Finally, **Streamlit** powers the easy-to-navigate user interface for easy access to the app.
3533

36-
37-
## Tutorial: Creating always up-to-date RAG app with Pathway + LlamaIndex
38-
39-
```
40-
Want to jump right in? Check out the app and the [code](https://github.com/pathway-labs/realtime-indexer-qa-chat).
41-
```
34+
## Tutorial: Creating always up-to-date RAG App with Pathway Vector Store + LlamaIndex
4235

4336
## Prerequisites
4437
- An OpenAI API Key (Only needed for OpenAI models)
45-
- Pathway instance (Hosted version is provided free for the demo)
38+
- Running Pathway Vector Store process (a hosted version is provided for the demo, instructoins to self-host one are provided below)
4639

47-
## Adding data to source
48-
First, add example documents to your pipeline by uploading files to Google Drive that is registered to Pathway as a source. Pathway can listen to many sources simultaneously, such as local files, S3 folders, cloud storage and any data stream for data changes. For this demo, a Google Drive folder is provided for you to upload files. There is Pathway Github repository's readme that is provided in the folder. In this demo, we will ask our questions about Pathway our assistant and it will respond based on the available files in the Drive folder.
40+
## Adding new documents
41+
First, add example documents to the vector store by uploading files to Google Drive that is registered to Pathway Vector Store as a source. Pathway can listen to many sources simultaneously, such as local files, S3 folders, cloud storage and any data stream for data changes. For this demo, a public Google Drive folder is provided for you to upload file. It is pre-populated with Pathway Github repository's readme. In this demo, we will ask questions about Pathway to our assistant and it will respond based on the available files in the Drive folder.
4942

5043
See [pathway-io](https://pathway.com/developers/api-docs/pathway-io) for more information on available connectors and how to implement custom connectors.
5144

@@ -60,7 +53,7 @@ from llama_index.query_engine import RetrieverQueryEngine
6053
from llama_index.chat_engine.condense_question import CondenseQuestionChatEngine
6154
```
6255

63-
Then, initialize the retriever with the hosted Pathway instance and create query engine:
56+
Then, initialize the retriever with the chosen Pathway Vector Store instance (for an easy start we point to the managed instance) and create the query engine:
6457

6558
```python
6659
PATHWAY_HOST = "https://api-pathway-indexer.staging.deploys.pathway.com"
@@ -107,7 +100,7 @@ if "messages" not in st.session_state.keys():
107100

108101
When the app is first run, `messages` will not be in the `st.session_state` and it will be initialized.
109102

110-
Then, print the messages both from the user and the assistant. Streamlit works in a way that resembles running a script, the whole file will be running each time there is a change in components, and the session state is the only component that has states. Making it powerful for saving and keeping elements that do not need to be re-initialized. That is why, all messages are printed iteratively.
103+
Then, print messages both from the user and the assistant. Streamlit works in a way that resembles running a script, the whole file will be running each time there is a change in components, and the session state is the only component that has states. Making it powerful for saving and keeping elements that do not need to be re-initialized. That is why, all messages are printed iteratively.
111104

112105
```python
113106
if prompt := st.chat_input("Your question"):
@@ -132,22 +125,43 @@ if st.session_state.messages[-1]["role"] != "assistant":
132125
```
133126

134127

135-
## Running the App
128+
## 1️⃣ Running the App
136129

137130
### On Streamlit Community Cloud
138131

132+
The demo is hosted on Streamlit Community Cloud [here](https://chat-realtime-sharepoint-gdrive.streamlit.app/). This version of the app uses Pathway's [hosted document pipelines](https://cloud.pathway.com/docindex).
139133

140134
### On your local machine
141135

142-
Clone [this repository](change this to tutorial repo or folder) to your machine.
136+
Clone this repository to your machine.
143137
Create a `.env` file under the root folder, this will store your OpenAI API key, demo uses the OpenAI GPT model to answer questions.
144138

145-
You need a Pathway instance for vector search, for local deployment see the [vector store guide](https://pathway.com/developers/showcases/vectorstore_pipeline) and also [Pathway Deployment](https://pathway.com/developers/user-guide/deployment/docker-deployment). For this demo, a free instance is provided that reads documents in [Google Drive](https://drive.google.com/drive/u/2/folders/1cULDv2OaViJBmOfG5WB0oWcgayNrGtVs) and [Sharepoint](https://navalgo.sharepoint.com/:f:/s/ConnectorSandbox/EgBe-VQr9h1IuR7VBeXsRfIBuOYhv-8z02_6zf4uTH8WbQ?e=YmlA05).
139+
You need access to a running Pathway Vector Store pipeline. For this demo, a public instance is provided that reads documents in [Google Drive](https://drive.google.com/drive/u/2/folders/1cULDv2OaViJBmOfG5WB0oWcgayNrGtVs) and [Sharepoint](https://navalgo.sharepoint.com/:f:/s/ConnectorSandbox/EgBe-VQr9h1IuR7VBeXsRfIBuOYhv-8z02_6zf4uTH8WbQ?e=YmlA05). However, it is easy to run our own locally. Please see the [vector store guide](https://pathway.com/developers/showcases/vectorstore_pipeline) and also [Pathway Deployment](https://pathway.com/developers/user-guide/deployment/docker-deployment).
146140

147141
Open a terminal and run `streamlit run ui.py`. This will prompt you a URL, simply click and open the demo.
148142

149143
Congrats! Now you are ready to chat with your documents with updated knowledge provided by Pathway.
150144

145+
### Running with Docker
146+
147+
We provide a Dockerfile to run the application. From the root folder of the repository run
148+
149+
```
150+
docker build -t realtime_chat .
151+
docker run -p 8501:8501 realtime_chat
152+
```
153+
154+
We recommend running in docker when working on a Windows machine.
155+
156+
## 2️⃣ Running a local Pathway Vector Store
157+
158+
OK, so far you have managed to get the RAG App and running and it's working - but it still connects to the public demo folders! Let's fix that - we will now show you how to connect your very own folders, in a private deployment. This means you will need to spin up a light web server which provides the "Pathway Vector Store" service, responsible for the whole document ingestion and indexing pipeline.
159+
160+
The code for the Pathway Vector Store pipeline, along with a Dockerfile is provided in the [Pathway LLM examples repository](https://github.com/pathwaycom/llm-app/tree/main/examples/pipelines/demo-document-indexing). Please follow instructions to run only the vector store pipeline, or to run the pipeline and the Streamlit UI as a joint deployment using `docker compose`.
161+
162+
Note that if you want to create a RAG application connected to your Google Drive, you need to set up a Google Service account, [refer to the instructions here](https://github.com/pathwaycom/llm-app/blob/main/examples/pipelines/demo-question-answering/README.md#create-a-new-project-in-the-google-api-console).
163+
Also, if you are not planning to use local files in your app, you can skip the `binding local volume` part explained in the llm-app instructions linked above.
164+
151165
## Summing Up
152166

153-
In this tutorial, you learned how to create and deploy a simple yet powerful RAG application with always up-to-date knowledge of your documents, without ETL jobs and buffers to check and read documents for any changes. You also learned how to get started with LlamaIndex using Pathway vector store, and how easy it is to get going with hosted Pathway that handles the majority of hurdles for you.
167+
In this tutorial, you learned how to create and deploy a simple yet powerful RAG application with always up-to-date knowledge of your documents, without ETL jobs and buffers to check and read documents for any changes. You also learned how to get started with LlamaIndex using Pathway vector store, and how easy it is to get going with hosted Pathway that handles the majority of hurdles for you.

demo/app.py

+34-25
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import json
22
import logging
33
import os
4+
import uuid
45

56
import pandas as pd
67
import streamlit as st
78
from dotenv import load_dotenv
89
from endpoint_utils import get_inputs
10+
from llama_index.llms.types import ChatMessage, MessageRole
911
from log_utils import init_pw_log_config
12+
from rag import DEFAULT_PATHWAY_HOST, PATHWAY_HOST, chat_engine, vector_client
1013
from streamlit.web.server.websocket_headers import _get_websocket_headers
14+
from traceloop.sdk import Traceloop
1115

1216
logging.basicConfig(
1317
level=logging.INFO,
@@ -50,18 +54,24 @@
5054
)
5155

5256
with st.sidebar:
53-
st.markdown("**Add Your Files**")
54-
st.markdown(htm, unsafe_allow_html=True)
57+
if PATHWAY_HOST == DEFAULT_PATHWAY_HOST:
58+
st.markdown("**Add Your Files**")
5559

56-
st.markdown("\n\n\n\n\n\n\n")
57-
st.markdown("\n\n\n\n\n\n\n")
58-
st.markdown(
59-
"[View code on GitHub.](https://github.com/pathway-labs/chat-realtime-sharepoint-gdrive)"
60-
)
60+
st.markdown(htm, unsafe_allow_html=True)
6161

62-
st.markdown(
63-
"""Pathway pipelines ingest documents from [Google Drive](https://drive.google.com/drive/u/0/folders/1cULDv2OaViJBmOfG5WB0oWcgayNrGtVs) and [Sharepoint](https://navalgo.sharepoint.com/:f:/s/ConnectorSandbox/EgBe-VQr9h1IuR7VBeXsRfIBuOYhv-8z02_6zf4uTH8WbQ?e=YmlA05) simultaneously. It automatically manages and syncs indexes enabling RAG applications."""
64-
)
62+
st.markdown("\n\n\n\n\n\n\n")
63+
st.markdown("\n\n\n\n\n\n\n")
64+
st.markdown(
65+
"[View code on GitHub.](https://github.com/pathway-labs/chat-realtime-sharepoint-gdrive)"
66+
)
67+
st.markdown(
68+
"""Pathway pipelines ingest documents from [Google Drive](https://drive.google.com/drive/u/0/folders/1cULDv2OaViJBmOfG5WB0oWcgayNrGtVs) and [Sharepoint](https://navalgo.sharepoint.com/:f:/s/ConnectorSandbox/EgBe-VQr9h1IuR7VBeXsRfIBuOYhv-8z02_6zf4uTH8WbQ?e=YmlA05) simultaneously. It automatically manages and syncs indexes enabling RAG applications."""
69+
)
70+
else:
71+
st.markdown(f"**Connected to:** {PATHWAY_HOST}")
72+
st.markdown(
73+
"[View code on GitHub.](https://github.com/pathway-labs/chat-realtime-sharepoint-gdrive)"
74+
)
6575

6676
st.markdown(
6777
"""**Ready to build your own?**
@@ -98,12 +108,6 @@
98108

99109

100110
if "messages" not in st.session_state.keys():
101-
import uuid
102-
103-
from llama_index.llms.types import ChatMessage, MessageRole
104-
from rag import chat_engine, vector_client
105-
from traceloop.sdk import Traceloop
106-
107111
if "session_id" not in st.session_state.keys():
108112
session_id = "uuid-" + str(uuid.uuid4())
109113

@@ -145,6 +149,8 @@
145149

146150

147151
df = pd.DataFrame(last_indexed_files, columns=[last_modified_time, "status"])
152+
if df.status.isna().any():
153+
del df["status"]
148154

149155
df.set_index(df.columns[0])
150156
st.dataframe(df, hide_index=True, height=150, use_container_width=True)
@@ -176,15 +182,7 @@
176182
with st.chat_message("assistant"):
177183
with st.spinner("Thinking..."):
178184
response = st.session_state.chat_engine.chat(prompt)
179-
logging.info(
180-
json.dumps(
181-
{
182-
"_type": "llm_response",
183-
"response": str(response),
184-
"session_id": st.session_state.get("session_id", "NULL_SESS"),
185-
}
186-
)
187-
)
185+
188186
sources = []
189187

190188
try:
@@ -213,6 +211,17 @@
213211

214212
sources_text = ", ".join(sources)
215213

214+
logging.info(
215+
json.dumps(
216+
{
217+
"_type": "llm_response",
218+
"response": str(response),
219+
"session_id": st.session_state.get("session_id", "NULL_SESS"),
220+
"sources": sources,
221+
}
222+
)
223+
)
224+
216225
response_text = (
217226
response.response
218227
+ f"\n\nDocuments looked up to obtain this answer: {sources_text}"

demo/rag.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@
1515

1616
Traceloop.init(app_name=os.environ.get("APP_NAME", "PW - LlamaIndex (Streamlit)"))
1717

18-
PATHWAY_HOST = os.environ.get("PATHWAY_HOST", "demo-document-indexing.pathway.stream")
18+
DEFAULT_PATHWAY_HOST = "demo-document-indexing.pathway.stream"
1919

20-
PATHWAY_PORT = 80
20+
PATHWAY_HOST = os.environ.get("PATHWAY_HOST", DEFAULT_PATHWAY_HOST)
21+
22+
PATHWAY_PORT = int(os.environ.get("PATHWAY_PORT", "80"))
2123

2224
vector_client = VectorStoreClient(PATHWAY_HOST, PATHWAY_PORT)
2325

0 commit comments

Comments
 (0)