llama-index
140 строк · 3.8 Кб
1"""Subclasses from base prompt."""
2
3from llama_index.legacy.prompts.base import PromptTemplate
4
5# deprecated, kept for backward compatibility
6
7"""Summary prompt.
8
9PromptTemplate to summarize the provided `context_str`.
10
11Required template variables: `context_str`
12"""
13SummaryPrompt = PromptTemplate
14
15"""Tree Insert prompt.
16
17PromptTemplate to insert a new chunk of text `new_chunk_text` into the tree index.
18More specifically, this prompt has the LLM select the relevant candidate
19child node to continue tree traversal.
20
21Required template variables: `num_chunks`, `context_list`, `new_chunk_text`
22"""
23TreeInsertPrompt = PromptTemplate
24
25"""Tree select prompt.
26
27PromptTemplate to select a candidate child node out of all child nodes
28provided in `context_list`, given a query `query_str`. `num_chunks` is
29the number of child nodes in `context_list`.
30
31Required template variables: `num_chunks`, `context_list`, `query_str`
32
33"""
34TreeSelectPrompt = PromptTemplate
35
36"""Tree select multiple prompt.
37
38PromptTemplate to select multiple candidate child nodes out of all
39child nodes provided in `context_list`, given a query `query_str`.
40`branching_factor` refers to the number of child nodes to select, and
41`num_chunks` is the number of child nodes in `context_list`.
42
43Required template variables: `num_chunks`, `context_list`, `query_str`,
44`branching_factor`
45"""
46TreeSelectMultiplePrompt = PromptTemplate
47
48"""Refine prompt.
49
50PromptTemplate to refine an existing answer `existing_answer`
51given a context `context_msg`, and a query `query_str`.
52
53Required template variables: `query_str`, `existing_answer`, `context_msg`
54"""
55RefinePrompt = PromptTemplate
56
57"""Question Answer prompt.
58
59PromptTemplate to answer a question `query_str` given a context `context_str`.
60
61Required template variables: `context_str`, `query_str`
62"""
63QuestionAnswerPrompt = PromptTemplate
64
65"""Keyword extract prompt.
66
67PromptTemplate to extract keywords from a text `text` with a maximum of
68`max_keywords` keywords.
69
70Required template variables: `text`, `max_keywords`
71"""
72KeywordExtractPrompt = PromptTemplate
73
74"""Query keyword extract prompt.
75
76PromptTemplate to extract keywords from a query `query_str` with a maximum
77of `max_keywords` keywords.
78
79Required template variables: `query_str`, `max_keywords`
80"""
81QueryKeywordExtractPrompt = PromptTemplate
82
83"""Schema extract prompt.
84
85PromptTemplate to extract schema from unstructured text `text`.
86
87Required template variables: `text`, `schema`
88"""
89SchemaExtractPrompt = PromptTemplate
90
91"""Text to SQL prompt.
92
93PromptTemplate to translate a natural language query into SQL in the dialect
94`dialect` given a schema `schema`.
95
96Required template variables: `query_str`, `schema`, `dialect`
97"""
98TextToSQLPrompt = PromptTemplate
99"""Table context prompt.
100
101PromptTemplate to generate a table context given a table schema `schema`,
102as well as unstructured text context `context_str`, and
103a task `query_str`.
104This includes both a high-level description of the table
105as well as a description of each column in the table.
106"""
107TableContextPrompt = PromptTemplate
108
109"""Refine Table context prompt.
110
111PromptTemplate to refine a table context given a table schema `schema`,
112as well as unstructured text context `context_msg`, and
113a task `query_str`.
114This includes both a high-level description of the table
115as well as a description of each column in the table.
116
117"""
118RefineTableContextPrompt = PromptTemplate
119
120"""Define the knowledge graph triplet extraction prompt."""
121KnowledgeGraphPrompt = PromptTemplate
122
123"""Simple Input prompt.
124
125Required template variables: `query_str`.
126"""
127SimpleInputPrompt = PromptTemplate
128
129"""Pandas prompt. Convert query to python code.
130
131Required template variables: `query_str`, `df_str`, `instruction_str`.
132"""
133PandasPrompt = PromptTemplate
134
135
136"""Choice select prompt. Select from a list of choices.
137
138Required template variables: `context_str`, `query_str`.
139"""
140ChoiceSelectPrompt = PromptTemplate
141