YouSearchAPIWrapper#

class langchain_community.utilities.you.YouSearchAPIWrapper[source]#

Bases: BaseModel

Wrapper for you.com Search and News API.

To connect to the You.com api requires an API key which you can get at https://api.you.com. You can check out the docs at https://documentation.you.com/api-reference/.

You need to set the environment variable YDC_API_KEY for retriever to operate.

ydc_api_key#

you.com api key, if YDC_API_KEY is not set in the environment

Type:

str, optional

endpoint_type#

you.com endpoints: search, news, rag; web and snippet alias search rag returns {β€˜message’: β€˜Forbidden’} @todo news endpoint

Type:

str, optional

num_web_results#

The max number of web results to return, must be under 20. This is mapped to the count query parameter for the News API.

Type:

int, optional

safesearch#

Safesearch settings, one of off, moderate, strict, defaults to moderate

Type:

str, optional

country#

Country code, ex: β€˜US’ for United States, see api docs for list

Type:

str, optional

search_lang#

(News API) Language codes, ex: β€˜en’ for English, see api docs for list

Type:

str, optional

ui_lang#
(News API) User interface language for the response, ex: β€˜en’ for English,

see api docs for list

Type:

str, optional

spellcheck#

(News API) Whether to spell check query or not, defaults to True

Type:

bool, optional

k#

max number of Documents to return using results()

Type:

int, optional

n_hits#

Alias for num_web_results

Type:

int, optional, deprecated

n_snippets_per_hit#

limit the number of snippets returned per hit

Type:

int, optional

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param country: str | None = None#
param endpoint_type: Literal['search', 'news', 'rag', 'snippet'] = 'search'#
param k: int | None = None#
param n_hits: int | None = None#
param n_snippets_per_hit: int | None = None#
param num_web_results: int | None = None#
param safesearch: Literal['off', 'moderate', 'strict'] | None = None#
param search_lang: str | None = None#
param spellcheck: bool | None = None#
param ui_lang: str | None = None#
param ydc_api_key: str | None = None#
raw_results(query: str, **kwargs: Any) β†’ Dict[source]#

Run query through you.com Search and return hits.

Parameters:
  • query (str) – The query to search for.

  • kwargs (Any) –

Return type:

Dict

Returns: YouAPIOutput

async raw_results_async(query: str, **kwargs: Any) β†’ Dict[source]#

Get results from the you.com Search API asynchronously.

Parameters:
  • query (str) –

  • kwargs (Any) –

Return type:

Dict

results(query: str, **kwargs: Any) β†’ List[Document][source]#

Run query through you.com Search and parses results into Documents.

Parameters:
  • query (str) –

  • kwargs (Any) –

Return type:

List[Document]

async results_async(query: str, **kwargs: Any) β†’ List[Document][source]#
Parameters:
  • query (str) –

  • kwargs (Any) –

Return type:

List[Document]

Examples using YouSearchAPIWrapper