mirror of
https://github.com/langchain-ai/web-explorer.git
synced 2026-07-01 20:14:34 -04:00
Merge pull request #7 from bobmayuze/main
Fixed getting started guidance for people to try out
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
## Web Explorer
|
||||
# Web Explorer
|
||||
|
||||
This is a lightweight app using the [Web Research Retriever](https://github.com/langchain-ai/langchain/pull/8102).
|
||||
|
||||
## Setup
|
||||
You only need to supply a few things.
|
||||
|
||||
In `settings()` function, supply:
|
||||
@@ -12,14 +13,21 @@ In `settings()` function, supply:
|
||||
|
||||
To use `st.secrets` set enviorment variables in `.streamlit/secrets.toml` file.
|
||||
|
||||
Or, simply set all API keys and remove `st.secrets`:
|
||||
Or, simply add environemnt variables and remove `st.secrets`:
|
||||
```
|
||||
export GOOGLE_API_KEY=xxx
|
||||
export GOOGLE_CSE_ID=xxx
|
||||
export OPENAI_API_KEY=xxx
|
||||
import os
|
||||
os.environ["GOOGLE_API_KEY"] = "YOUR_API_KEY"
|
||||
os.environ["GOOGLE_CSE_ID"] = "YOUR_CSE_ID"
|
||||
os.environ["OPENAI_API_BASE"] = "https://api.openai.com/v1"
|
||||
os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY"
|
||||
|
||||
```
|
||||
|
||||
Run:
|
||||
For `GOOGLE_API_KEY` , you could get it from [this link](https://console.cloud.google.com/apis/api/customsearch.googleapis.com/credentials).
|
||||
|
||||
For `GOOGLE_CSE_ID` , you could get it from [this link](https://programmablesearchengine.google.com/)
|
||||
|
||||
## Run
|
||||
```
|
||||
streamlit run web_explorer.py
|
||||
```
|
||||
|
||||
@@ -3,6 +3,13 @@ from langchain.callbacks.base import BaseCallbackHandler
|
||||
from langchain.chains import RetrievalQAWithSourcesChain
|
||||
from langchain.retrievers.web_research import WebResearchRetriever
|
||||
|
||||
import os
|
||||
|
||||
os.environ["GOOGLE_API_KEY"] = "YOUR_API_KEY" # Get it at https://console.cloud.google.com/apis/api/customsearch.googleapis.com/credentials
|
||||
os.environ["GOOGLE_CSE_ID"] = "YOUR_CSE_ID" # Get it at https://programmablesearchengine.google.com/
|
||||
os.environ["OPENAI_API_BASE"] = "https://api.openai.com/v1"
|
||||
os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY" # Get it at https://beta.openai.com/account/api-keys
|
||||
|
||||
st.set_page_config(page_title="Interweb Explorer", page_icon="🌐")
|
||||
|
||||
def settings():
|
||||
|
||||
Reference in New Issue
Block a user