Home / File/ prompts.py — langchain Source File

prompts.py — langchain Source File

Architecture documentation for prompts.py, a python file in the langchain codebase. 1 imports, 0 dependents.

File python 1 imports

Entity Profile

Dependency Diagram

graph LR
  633993ba_feb4_eb20_24dc_c674b40d3419["prompts.py"]
  4b3dcc0f_d872_0044_39ec_2d289f87f9e6["langchain_core.prompts.prompt"]
  633993ba_feb4_eb20_24dc_c674b40d3419 --> 4b3dcc0f_d872_0044_39ec_2d289f87f9e6
  style 633993ba_feb4_eb20_24dc_c674b40d3419 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from langchain_core.prompts.prompt import PromptTemplate

_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question, in its original language.

Chat History:
{chat_history}
Follow Up Input: {question}
Standalone question:"""  # noqa: E501
CONDENSE_QUESTION_PROMPT = PromptTemplate.from_template(_template)

prompt_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.

{context}

Question: {question}
Helpful Answer:"""  # noqa: E501
QA_PROMPT = PromptTemplate(
    template=prompt_template, input_variables=["context", "question"]
)

Dependencies

  • langchain_core.prompts.prompt

Frequently Asked Questions

What does prompts.py do?
prompts.py is a source file in the langchain codebase, written in python.
What does prompts.py depend on?
prompts.py imports 1 module(s): langchain_core.prompts.prompt.
Where is prompts.py in the architecture?
prompts.py is located at libs/langchain/langchain_classic/chains/conversational_retrieval/prompts.py (directory: libs/langchain/langchain_classic/chains/conversational_retrieval).

Analyze Your Own Codebase

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

Try Supermodel Free