StackExchangeAPIWrapper#

class langchain_community.utilities.stackexchange.StackExchangeAPIWrapper[source]#

Bases: BaseModel

Wrapper for Stack Exchange API.

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

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param fetch_params: Dict[str, Any] [Optional]#

Additional params to pass to StackApi.fetch.

param max_results: int = 3#

Max number of results to include in output.

param query_type: Literal['all', 'title', 'body'] = 'all'#

Which part of StackOverflows items to match against. One of β€˜all’, β€˜title’, β€˜body’. Defaults to β€˜all’.

param result_separator: str = '\n\n'#

Separator between question,answer pairs.

run(query: str) β†’ str[source]#

Run query through StackExchange API and parse results.

Parameters:

query (str)

Return type:

str

Examples using StackExchangeAPIWrapper