Skip to content

Instantly share code, notes, and snippets.

@Shamik-07
Last active January 18, 2025 11:33
Show Gist options
  • Save Shamik-07/edf63d0bdfe5f8e28a01877c28815e79 to your computer and use it in GitHub Desktop.
Save Shamik-07/edf63d0bdfe5f8e28a01877c28815e79 to your computer and use it in GitHub Desktop.
Langchain LLM App Development L3_Chains MultiPromptRouterTemplate
MULTI_PROMPT_ROUTER_TEMPLATE = """Given a raw text input to a
language model select the model prompt best suited for the input.
You will be given the names of the available prompts and a
description of what the prompt is best suited for.
You may also revise the original input if you think that revising
it will ultimately lead to a better response from the language model.
<< FORMATTING >>
Return a string snippet enclosed by triple backticks a JSON object formatted to look like below:
```json
{{{{
“destination”: string \ name of the prompt to use or “default”
“next_inputs”: string \ a potentially modified version of the original input
}}}}
```
REMEMBER: “destination” MUST be one of the candidate prompt
names specified below OR it can be “default” if the input is not
well suited for any of the candidate prompts.
REMEMBER: “next_inputs” can just be the original input
if you don’t think any modifications are needed.
<< CANDIDATE PROMPTS >>
{destinations}
<< INPUT >>
{{input}}
<< OUTPUT (remember to include the ```json```)>>"“”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment