- Built-in support for LLM
- Built-in support for search engine
- Customizable pretty UI interface
- Shareable, cached search results
There are two default supported search engines: Bing and Google.
To use the Bing Web Search API, please visit this link to obtain your Bing subscription key. You also need to replace the search_with_google
function in rag_chain.py
with search_with_bing
in search_with_lepton.py
. Change the service keys accordingly.
You have three options for Google Search: you can use the SearchApi Google Search API from SearchApi, Serper Google Search API from Serper, or opt for the Programmable Search Engine provided by Google. I have implemented Programmable Search Engine in rag_chain.py
. But you could change it to other ones (see section Bing Search).
Note
I don't get access to powerful GPUs :( so I use the NVIDIA AI Foundation Endpoints. But I recommend you replace it with ollama if you insist to have everthing set up locally.
Set up your service keys starting line 23 in rag_chain.py
like this:
# ===========================================================
# set service keys
NVAPI_KEY = 'nvapi-xxx'
SEARCH_API_KEY_GOOGLE = "xxx"
SEARCH_ID_GOOGLE = "xxx" # cx parameter
Running the following commands to set up the environment.
pip install langchain
pip install loguru
pip install --upgrade --quiet langchain-nvidia-ai-endpoints
pip install fastapi
pip install "uvicorn[standard]"
- Build web
cd web && npm install && npm run build
- Run server
python search_with_langchain.py
- Visit your local conversational search engine at http://localhost:8080/ !
- prettier/prettier
If you have encounter something like
Error: Delete `␍` prettier/prettier
during build, visit web/.eslintrc.json
and add a line to turn prettier/prettier off like this. (That's how I get around this anyway.)
"rules": {
"unused-imports/no-unused-imports": "error",
"prettier/prettier": "off"
}