Home / Function/ get_prompt() — langchain Function Reference

get_prompt() — langchain Function Reference

Architecture documentation for the get_prompt() function in prompt_selector.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  7364e094_5d8f_1e3b_1f6e_6903bf72fca4["get_prompt()"]
  f4ac9342_1643_b06f_2c74_6eb4fe4793e9["ConditionalPromptSelector"]
  7364e094_5d8f_1e3b_1f6e_6903bf72fca4 -->|defined in| f4ac9342_1643_b06f_2c74_6eb4fe4793e9
  184757ca_fae8_734c_6890_c224e91650bb["get_prompt()"]
  184757ca_fae8_734c_6890_c224e91650bb -->|calls| 7364e094_5d8f_1e3b_1f6e_6903bf72fca4
  184757ca_fae8_734c_6890_c224e91650bb["get_prompt()"]
  7364e094_5d8f_1e3b_1f6e_6903bf72fca4 -->|calls| 184757ca_fae8_734c_6890_c224e91650bb
  style 7364e094_5d8f_1e3b_1f6e_6903bf72fca4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/prompt_selector.py lines 29–41

    def get_prompt(self, llm: BaseLanguageModel) -> BasePromptTemplate:
        """Get default prompt for a language model.

        Args:
            llm: Language model to get prompt for.

        Returns:
            Prompt to use for the language model.
        """
        for condition, prompt in self.conditionals:
            if condition(llm):
                return prompt
        return self.default_prompt

Subdomains

Calls

Called By

Frequently Asked Questions

What does get_prompt() do?
get_prompt() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/prompt_selector.py.
Where is get_prompt() defined?
get_prompt() is defined in libs/langchain/langchain_classic/chains/prompt_selector.py at line 29.
What does get_prompt() call?
get_prompt() calls 1 function(s): get_prompt.
What calls get_prompt()?
get_prompt() is called by 1 function(s): get_prompt.

Analyze Your Own Codebase

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

Try Supermodel Free