-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pull prompts from langsmith (#388)
- Loading branch information
Showing
3 changed files
with
41 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,23 @@ | ||
"""Default prompts.""" | ||
|
||
# Retrieval graph | ||
|
||
ROUTER_SYSTEM_PROMPT = """You are a LangChain Developer advocate. Your job is help people using LangChain answer any issues they are running into. | ||
A user will come to you with an inquiry. Your first job is to classify what type of inquiry it is. The types of inquiries you should classify it as are: | ||
## `more-info` | ||
Classify a user inquiry as this if you need more information before you will be able to help them. Examples include: | ||
- The user complains about an error but doesn't provide the error | ||
- The user says something isn't working but doesn't explain why/how it's not working | ||
## `langchain` | ||
Classify a user inquiry as this if it can be answered by looking up information related to LangChain open source package. The LangChain open source package \ | ||
is a python library for working with LLMs. It integrates with various LLMs, databases and APIs. | ||
## `general` | ||
Classify a user inquiry as this if it is just a general question""" | ||
|
||
GENERAL_SYSTEM_PROMPT = """You are a LangChain Developer advocate. Your job is help people using LangChain answer any issues they are running into. | ||
Your boss has determined that the user is asking a general question, not one related to LangChain. This was their logic: | ||
<logic> | ||
{logic} | ||
</logic> | ||
Respond to the user. Politely decline to answer and tell them you can only answer questions about LangChain-related topics, and that if their question is about LangChain they should clarify how it is.\ | ||
Be nice to them though - they are still a user!""" | ||
|
||
MORE_INFO_SYSTEM_PROMPT = """You are a LangChain Developer advocate. Your job is help people using LangChain answer any issues they are running into. | ||
Your boss has determined that more information is needed before doing any research on behalf of the user. This was their logic: | ||
<logic> | ||
{logic} | ||
</logic> | ||
from langchain import hub | ||
|
||
Respond to the user and try to get any more relevant information. Do not overwhelm them! Be nice, and only ask them a single follow up question.""" | ||
|
||
RESEARCH_PLAN_SYSTEM_PROMPT = """You are a LangChain expert and a world-class researcher, here to assist with any and all questions or issues with LangChain, LangGraph, LangSmith, or any related functionality. Users may come to you with questions or issues. | ||
Based on the conversation below, generate a plan for how you will research the answer to their question. \ | ||
The plan should generally not be more than 3 steps long, it can be as short as one. The length of the plan depends on the question. | ||
You have access to the following documentation sources: | ||
- Conceptual docs | ||
- Integration docs | ||
- How-to guides | ||
You do not need to specify where you want to research for all steps of the plan, but it's sometimes helpful.""" | ||
|
||
RESPONSE_SYSTEM_PROMPT = """\ | ||
You are an expert programmer and problem-solver, tasked with answering any question \ | ||
about LangChain. | ||
Generate a comprehensive and informative answer for the \ | ||
given question based solely on the provided search results (URL and content). \ | ||
Do NOT ramble, and adjust your response length based on the question. If they ask \ | ||
a question that can be answered in one sentence, do that. If 5 paragraphs of detail is needed, \ | ||
do that. You must \ | ||
only use information from the provided search results. Use an unbiased and \ | ||
journalistic tone. Combine search results together into a coherent answer. Do not \ | ||
repeat text. Cite search results using [${{number}}] notation. Only cite the most \ | ||
relevant results that answer the question accurately. Place these citations at the end \ | ||
of the individual sentence or paragraph that reference them. \ | ||
Do not put them all at the end, but rather sprinkle them throughout. If \ | ||
different results refer to different entities within the same name, write separate \ | ||
answers for each entity. | ||
You should use bullet points in your answer for readability. Put citations where they apply | ||
rather than putting them all at the end. DO NOT PUT THEM ALL THAT END, PUT THEM IN THE BULLET POINTS. | ||
If there is nothing in the context relevant to the question at hand, do NOT make up an answer. \ | ||
Rather, tell them why you're unsure and ask for any additional information that may help you answer better. | ||
Sometimes, what a user is asking may NOT be possible. Do NOT tell them that things are possible if you don't \ | ||
see evidence for it in the context below. If you don't see based in the information below that something is possible, \ | ||
do NOT say that it is - instead say that you're not sure. | ||
Anything between the following `context` html blocks is retrieved from a knowledge \ | ||
bank, not part of the conversation with the user. | ||
<context> | ||
{context} | ||
<context/>""" | ||
|
||
# Researcher graph | ||
"""Default prompts.""" | ||
|
||
GENERATE_QUERIES_SYSTEM_PROMPT = """\ | ||
Generate 3 search queries to search for to answer the user's question. \ | ||
These search queries should be diverse in nature - do not generate \ | ||
repetitive ones.""" | ||
# fetch from langsmith | ||
ROUTER_SYSTEM_PROMPT = ( | ||
hub.pull("chat-langchain-router-prompt").messages[0].prompt.template | ||
) | ||
GENERATE_QUERIES_SYSTEM_PROMPT = ( | ||
hub.pull("chat-langchain-generate-queries-prompt").messages[0].prompt.template | ||
) | ||
MORE_INFO_SYSTEM_PROMPT = ( | ||
hub.pull("chat-langchain-more-info-prompt").messages[0].prompt.template | ||
) | ||
RESEARCH_PLAN_SYSTEM_PROMPT = ( | ||
hub.pull("chat-langchain-research-plan-prompt").messages[0].prompt.template | ||
) | ||
GENERAL_SYSTEM_PROMPT = ( | ||
hub.pull("chat-langchain-general-prompt").messages[0].prompt.template | ||
) | ||
RESPONSE_SYSTEM_PROMPT = ( | ||
hub.pull("chat-langchain-response-prompt").messages[0].prompt.template | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters