Home / Function/ from_llm_and_api_docs() — langchain Function Reference

from_llm_and_api_docs() — langchain Function Reference

Architecture documentation for the from_llm_and_api_docs() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d039a841_651f_0d79_5787_6e56936ae26f["from_llm_and_api_docs()"]
  b9a82d83_700a_c3c4_a4fd_29ab9cbe4112["APIChain"]
  d039a841_651f_0d79_5787_6e56936ae26f -->|defined in| b9a82d83_700a_c3c4_a4fd_29ab9cbe4112
  0393cea2_16ff_2ed6_ebe5_2e7f4968843e["langchain_community()"]
  0393cea2_16ff_2ed6_ebe5_2e7f4968843e -->|calls| d039a841_651f_0d79_5787_6e56936ae26f
  style d039a841_651f_0d79_5787_6e56936ae26f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/api/base.py lines 361–382

        def from_llm_and_api_docs(
            cls,
            llm: BaseLanguageModel,
            api_docs: str,
            headers: dict | None = None,
            api_url_prompt: BasePromptTemplate = API_URL_PROMPT,
            api_response_prompt: BasePromptTemplate = API_RESPONSE_PROMPT,
            limit_to_domains: Sequence[str] | None = (),
            **kwargs: Any,
        ) -> APIChain:
            """Load chain from just an LLM and the api docs."""
            get_request_chain = LLMChain(llm=llm, prompt=api_url_prompt)
            requests_wrapper = TextRequestsWrapper(headers=headers)
            get_answer_chain = LLMChain(llm=llm, prompt=api_response_prompt)
            return cls(
                api_request_chain=get_request_chain,
                api_answer_chain=get_answer_chain,
                requests_wrapper=requests_wrapper,
                api_docs=api_docs,
                limit_to_domains=limit_to_domains,
                **kwargs,
            )

Subdomains

Frequently Asked Questions

What does from_llm_and_api_docs() do?
from_llm_and_api_docs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/api/base.py.
Where is from_llm_and_api_docs() defined?
from_llm_and_api_docs() is defined in libs/langchain/langchain_classic/chains/api/base.py at line 361.
What calls from_llm_and_api_docs()?
from_llm_and_api_docs() is called by 1 function(s): langchain_community.

Analyze Your Own Codebase

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

Try Supermodel Free