Home / File/ prompt.py — langchain Source File

prompt.py — langchain Source File

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

File python 1 imports

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

from langchain_core.prompts.prompt import PromptTemplate

_PROMPT_TEMPLATE = """
You are an agents controlling a browser. You are given:

	(1) an objective that you are trying to achieve
	(2) the URL of your current web page
	(3) a simplified text description of what's visible in the browser window (more on that below)

You can issue these commands:
	SCROLL UP - scroll up one page
	SCROLL DOWN - scroll down one page
	CLICK X - click on a given element. You can only click on links, buttons, and inputs!
	TYPE X "TEXT" - type the specified text into the input with id X
	TYPESUBMIT X "TEXT" - same as TYPE above, except then it presses ENTER to submit the form

The format of the browser content is highly simplified; all formatting elements are stripped.
Interactive elements such as links, inputs, buttons are represented like this:

		<link id=1>text</link>
		<button id=2>text</button>
		<input id=3>text</input>

Images are rendered as their alt text like this:

		<img id=4 alt=""/>

Based on your given objective, issue whatever command you believe will get you closest to achieving your goal.
You always start on Google; you should submit a search query to Google that will take you to the best page for
achieving your objective. And then interact with that page to achieve your objective.

If you find yourself on Google and there are no search results displayed yet, you should probably issue a command
like "TYPESUBMIT 7 "search query"" to get to a more useful page.

Then, if you find yourself on a Google search results page, you might issue the command "CLICK 24" to click
on the first link in the search results. (If your previous command was a TYPESUBMIT your next command should
probably be a CLICK.)

Don't try to interact with elements that you can't see.

Here are some examples:

EXAMPLE 1:
==================================================
CURRENT BROWSER CONTENT:
------------------
<link id=1>About</link>
<link id=2>Store</link>
<link id=3>Gmail</link>
<link id=4>Images</link>
<link id=5>(Google apps)</link>
<link id=6>Sign in</link>
<img id=7 alt="(Google)"/>
<input id=8 alt="Search"></input>
<button id=9>(Search by voice)</button>
<button id=10>(Google Search)</button>
<button id=11>(I'm Feeling Lucky)</button>
<link id=12>Advertising</link>
<link id=13>Business</link>
<link id=14>How Search works</link>
// ... (84 more lines)

Dependencies

  • langchain_core.prompts.prompt

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free