Skip to content

Commit

Permalink
Merge pull request #7 from bobmayuze/main
Browse files Browse the repository at this point in the history
Fixed getting started guidance for people to try out
  • Loading branch information
hwchase17 authored Aug 9, 2023
2 parents fd09337 + 033e566 commit cd43e03
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
```
Expand Down
7 changes: 7 additions & 0 deletions web_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
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():
Expand Down

0 comments on commit cd43e03

Please sign in to comment.