Skip to content

Commit c9ec39a

Browse files
authored
feat: add tree of thought prompts (#13)
1 parent 9e4d444 commit c9ec39a

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

apps/chrome-extension/src/pages/Content/prompts.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
QuestionWithContextPrompt,
1313
QuestionWithReasoningPrompt,
1414
SummarizationIntoListPrompt,
15+
TreeOfThoughtPromptV1,
16+
TreeOfThoughtPromptV2,
1517
ZeroShotCoTAPEPrompt,
1618
ZeroShotCoTPrompt,
1719
} from '@rpidanny/llm-prompt-templates/core/general';
@@ -40,6 +42,8 @@ const generalPrompts: IPrompt[] = [
4042
QuestionWithContextPrompt,
4143
ZeroShotCoTPrompt,
4244
ZeroShotCoTAPEPrompt,
45+
TreeOfThoughtPromptV1,
46+
TreeOfThoughtPromptV2,
4347
BasicSummarizationPrompt,
4448
SummarizationIntoListPrompt,
4549
GeneralKnowledgePrompt,

libs/llm-prompt-templates/src/core/general.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,39 @@ export const ZeroShotCoTAPEPrompt: IPrompt = {
5353
Let's work this out in a step by step way to be sure we have the right answer.`,
5454
};
5555

56+
export const TreeOfThoughtPromptV1: IPrompt = {
57+
name: 'Tree of Thought V1',
58+
description:
59+
"The Tree of Thoughts (ToT) framework improves language models' problem-solving abilities by allowing deliberate decision making through exploration and strategic lookahead",
60+
tags: [Tag.TreeOfThought, Tag.Reasoning],
61+
category: PromptCategory.General,
62+
paper: 'https://arxiv.org/abs/2305.10601',
63+
content: `Imagine three different experts are answering this question.
64+
All experts will write down 1 step of their thinking, then share it with the group.
65+
Then all experts will go on to the next step, etc.
66+
If any expert realises they're wrong at any point then they leave. The question is...
67+
68+
{question}
69+
`,
70+
};
71+
72+
export const TreeOfThoughtPromptV2: IPrompt = {
73+
name: 'Tree of Thought V2',
74+
description:
75+
"The Tree of Thoughts (ToT) framework improves language models' problem-solving abilities by allowing deliberate decision making through exploration and strategic lookahead",
76+
tags: [Tag.TreeOfThought, Tag.Reasoning],
77+
category: PromptCategory.General,
78+
paper: 'https://arxiv.org/abs/2305.10601',
79+
content: `Simulate three brilliant, logical experts collaboratively answering a question.
80+
Each one verbosely explains their thought process in real-time, considering the prior explanations of others and openly acknowledging mistakes.
81+
At each step, whenever possible, each expert refines and builds upon the thoughts of others, acknowledging their contributions.
82+
They continue until there is a definitive answer to the question.
83+
For clarity, your entire response should be in a markdown table. The question is...
84+
85+
{question}
86+
`,
87+
};
88+
5689
export const BasicSummarizationPrompt: IPrompt = {
5790
name: 'Basic Summarization',
5891
description: `This prompt asks the LLM to summarize a given text.`,

libs/llm-prompt-templates/src/core/tags.enum.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ export enum Tag {
1515
Transform = 'transform',
1616
Documentation = 'documentation',
1717
ProofRead = 'proofread',
18+
TreeOfThought = 'tree-of-thought',
1819
}

0 commit comments

Comments
 (0)