Home / Function/ _run() — langchain Function Reference

_run() — langchain Function Reference

Architecture documentation for the _run() function in tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  2ca892f8_801d_f665_c823_eced16c2ea0d["_run()"]
  d1cd17ae_5381_3dd6_4d26_fee4a361375b["ExaSearchResults"]
  2ca892f8_801d_f665_c823_eced16c2ea0d -->|defined in| d1cd17ae_5381_3dd6_4d26_fee4a361375b
  e812ff94_a0ea_6298_d40c_2217749bbadd["_run()"]
  e812ff94_a0ea_6298_d40c_2217749bbadd -->|calls| 2ca892f8_801d_f665_c823_eced16c2ea0d
  e812ff94_a0ea_6298_d40c_2217749bbadd["_run()"]
  2ca892f8_801d_f665_c823_eced16c2ea0d -->|calls| e812ff94_a0ea_6298_d40c_2217749bbadd
  style 2ca892f8_801d_f665_c823_eced16c2ea0d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/exa/langchain_exa/tools.py lines 101–161

    def _run(
        self,
        query: str,
        num_results: int = 10,
        text_contents_options: TextContentsOptions  # noqa: FBT001
        | dict[str, Any]
        | bool
        | None = None,
        highlights: HighlightsContentsOptions | bool | None = None,  # noqa: FBT001
        include_domains: list[str] | None = None,
        exclude_domains: list[str] | None = None,
        start_crawl_date: str | None = None,
        end_crawl_date: str | None = None,
        start_published_date: str | None = None,
        end_published_date: str | None = None,
        use_autoprompt: bool | None = None,  # noqa: FBT001
        livecrawl: Literal["always", "fallback", "never"] | None = None,
        summary: bool | dict[str, str] | None = None,  # noqa: FBT001
        type: Literal["neural", "keyword", "auto"] | None = None,  # noqa: A002
        run_manager: CallbackManagerForToolRun | None = None,
    ) -> list[dict] | str:
        # TODO: rename `type` to something else, as it is a reserved keyword
        """Use the tool.

        Args:
            query: The search query.
            num_results: The number of search results to return (1 to 100). Default: 10
            text_contents_options: How to set the page content of the results. Can be True or a dict with options like max_characters.
            highlights: Whether to include highlights in the results.
            include_domains: A list of domains to include in the search.
            exclude_domains: A list of domains to exclude from the search.
            start_crawl_date: The start date for the crawl (in YYYY-MM-DD format).
            end_crawl_date: The end date for the crawl (in YYYY-MM-DD format).
            start_published_date: The start date for when the document was published (in YYYY-MM-DD format).
            end_published_date: The end date for when the document was published (in YYYY-MM-DD format).
            use_autoprompt: Whether to use autoprompt for the search.
            livecrawl: Option to crawl live webpages if content is not in the index. Options: "always", "fallback", "never"
            summary: Whether to include a summary of the content. Can be a boolean or a dict with a custom query.
            type: The type of search, 'keyword', 'neural', or 'auto'.
            run_manager: The run manager for callbacks.

        """  # noqa: E501
        try:
            return self.client.search_and_contents(
                query,
                num_results=num_results,
                text=text_contents_options,
                highlights=highlights,
                include_domains=include_domains,
                exclude_domains=exclude_domains,
                start_crawl_date=start_crawl_date,
                end_crawl_date=end_crawl_date,
                start_published_date=start_published_date,
                end_published_date=end_published_date,
                use_autoprompt=use_autoprompt,
                livecrawl=livecrawl,
                summary=summary,
                type=type,
            )  # type: ignore[call-overload, misc]
        except Exception as e:
            return repr(e)

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does _run() do?
_run() is a function in the langchain codebase, defined in libs/partners/exa/langchain_exa/tools.py.
Where is _run() defined?
_run() is defined in libs/partners/exa/langchain_exa/tools.py at line 101.
What does _run() call?
_run() calls 1 function(s): _run.
What calls _run()?
_run() is called by 1 function(s): _run.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free