mirror of
https://github.com/hwchase17/langchain.git
synced 2026-03-18 11:07:36 +00:00
This is a work in progress PR to track my progres.
## TODO:
- [x] Get results using the specifed searx host
- [x] Prioritize returning an `answer` or results otherwise
- [ ] expose the field `infobox` when available
- [ ] expose `score` of result to help agent's decision
- [ ] expose the `suggestions` field to agents so they could try new
queries if no results are found with the orignial query ?
- [ ] Dynamic tool description for agents ?
- Searx offers many engines and a search syntax that agents can take
advantage of. It would be nice to generate a dynamic Tool description so
that it can be used many times as a tool but for different purposes.
- [x] Limit number of results
- [ ] Implement paging
- [x] Miror the usage of the Google Search tool
- [x] easy selection of search engines
- [x] Documentation
- [ ] update HowTo guide notebook on Search Tools
- [ ] Handle async
- [ ] Tests
### Add examples / documentation on possible uses with
- [ ] getting factual answers with `!wiki` option and `infoboxes`
- [ ] getting `suggestions`
- [ ] getting `corrections`
---------
Co-authored-by: blob42 <spike@w530>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
1.2 KiB
1.2 KiB
SearxNG Search API
This page covers how to use the SearxNG search API within LangChain. It is broken into two parts: installation and setup, and then references to the specific SearxNG API wrapper.
Installation and Setup
- You can find a list of public SearxNG instances here.
- It recommended to use a self-hosted instance to avoid abuse on the public instances. Also note that public instances often have a limit on the number of requests.
- To run a self-hosted instance see this page for more information.
- To use the tool you need to provide the searx host url by:
- passing the named parameter
searx_hostwhen creating the instance. - exporting the environment variable
SEARXNG_HOST.
- passing the named parameter
Wrappers
Utility
You can use the wrapper to get results from a SearxNG instance.
from langchain.utilities import SearxSearchWrapper
Tool
You can also easily load this wrapper as a Tool (to use with an Agent). You can do this with:
from langchain.agents import load_tools
tools = load_tools(["searx-search"], searx_host="https://searx.example.com")
For more information on this, see this page