trajectory_eval_prompt.py — langchain Source File
Architecture documentation for trajectory_eval_prompt.py, a python file in the langchain codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7896ac57_4825_1bd8_af6b_e7965e83417c["trajectory_eval_prompt.py"] 9444498b_8066_55c7_b3a2_1d90c4162a32["langchain_core.messages"] 7896ac57_4825_1bd8_af6b_e7965e83417c --> 9444498b_8066_55c7_b3a2_1d90c4162a32 16c7d167_e2e4_cd42_2bc2_d182459cd93c["langchain_core.prompts.chat"] 7896ac57_4825_1bd8_af6b_e7965e83417c --> 16c7d167_e2e4_cd42_2bc2_d182459cd93c style 7896ac57_4825_1bd8_af6b_e7965e83417c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Prompt for trajectory evaluation chain."""
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage
from langchain_core.prompts.chat import (
ChatPromptTemplate,
HumanMessagePromptTemplate,
)
EVAL_TEMPLATE = """An AI language model has been given access to the following set of tools to help answer a user's question.
The tools given to the AI model are:
[TOOL_DESCRIPTIONS]
{tool_descriptions}
[END_TOOL_DESCRIPTIONS]
The question the human asked the AI model was:
[QUESTION]
{question}
[END_QUESTION]{reference}
The AI language model decided to use the following set of tools to answer the question:
[AGENT_TRAJECTORY]
{agent_trajectory}
[END_AGENT_TRAJECTORY]
The AI language model's final answer to the question was:
[RESPONSE]
{answer}
[END_RESPONSE]
Let's to do a detailed evaluation of the AI language model's answer step by step.
We consider the following criteria before giving a score from 1 to 5:
i. Is the final answer helpful?
ii. Does the AI language use a logical sequence of tools to answer the question?
iii. Does the AI language model use the tools in a helpful way?
iv. Does the AI language model use too many steps to answer the question?
v. Are the appropriate tools used to answer the question?""" # noqa: E501
EXAMPLE_INPUT = """An AI language model has been given access to the following set of tools to help answer a user's question.
The tools given to the AI model are:
[TOOL_DESCRIPTIONS]
Tool 1:
Name: Search
Description: useful for when you need to ask with search
Tool 2:
Name: Lookup
Description: useful for when you need to ask with lookup
Tool 3:
Name: Calculator
Description: useful for doing calculations
Tool 4:
Name: Search the Web (SerpAPI)
Description: useful for when you need to answer questions about current events
[END_TOOL_DESCRIPTIONS]
// ... (87 more lines)
Dependencies
- langchain_core.messages
- langchain_core.prompts.chat
Source
Frequently Asked Questions
What does trajectory_eval_prompt.py do?
trajectory_eval_prompt.py is a source file in the langchain codebase, written in python.
What does trajectory_eval_prompt.py depend on?
trajectory_eval_prompt.py imports 2 module(s): langchain_core.messages, langchain_core.prompts.chat.
Where is trajectory_eval_prompt.py in the architecture?
trajectory_eval_prompt.py is located at libs/langchain/langchain_classic/evaluation/agents/trajectory_eval_prompt.py (directory: libs/langchain/langchain_classic/evaluation/agents).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free