Home / File/ prompt.py — langchain Source File

prompt.py — langchain Source File

Architecture documentation for prompt.py, a python file in the langchain codebase.

Entity Profile

Source Code

PREFIX = """Respond to the human as helpfully and accurately as possible. You have access to the following tools:"""  # noqa: E501
FORMAT_INSTRUCTIONS = """Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).

Valid "action" values: "Final Answer" or {tool_names}

Provide only ONE action per $JSON_BLOB, as shown:

```
{{{{
  "action": $TOOL_NAME,
  "action_input": $INPUT
}}}}
```

Follow this format:

Question: input question to answer
Thought: consider previous and subsequent steps
Action:
```
$JSON_BLOB
```
Observation: action result
... (repeat Thought/Action/Observation N times)
Thought: I know what to respond
Action:
```
{{{{
  "action": "Final Answer",
  "action_input": "Final response to human"
}}}}
```"""  # noqa: E501
SUFFIX = """Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:.
Thought:"""  # noqa: E501

Frequently Asked Questions

What does prompt.py do?
prompt.py is a source file in the langchain codebase, written in python.
Where is prompt.py in the architecture?
prompt.py is located at libs/langchain/langchain_classic/agents/structured_chat/prompt.py (directory: libs/langchain/langchain_classic/agents/structured_chat).

Analyze Your Own Codebase

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

Try Supermodel Free