langchain/docs/ecosystem/searx.md
blob42 3ecdea8be4
SearxNG meta search api helper (#854)
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>
2023-02-15 23:03:57 -08:00

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:
    1. passing the named parameter searx_host when creating the instance.
    2. exporting the environment variable SEARXNG_HOST.

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