You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7dc76a2
Browse filesBrowse the repository at this point in the historyBrowse files
return f"Error: Variable '{{variable_name}}' not found"
264
+
available = [k for k in _locals.keys() if not k.startswith("_")]
265
+
if available:
266
+
return f"Error: Variable '{{variable_name}}' not found. Available variables: {{available}}. You must create and assign a variable BEFORE calling FINAL_VAR on it."
267
+
return f"Error: Variable '{{variable_name}}' not found. No variables have been created yet. You must create and assign a variable in a REPL block BEFORE calling FINAL_VAR on it."
268
+
269
+
def SHOW_VARS():
270
+
available = {{k: type(v).__name__ for k, v in _locals.items() if not k.startswith("_")}}
271
+
if not available:
272
+
return "No variables created yet. Use ```repl``` blocks to create variables."
available = [k for k in _locals.keys() if not k.startswith("_")]
148
+
if available:
149
+
return f"Error: Variable '{{name}}' not found. Available variables: {{available}}. You must create and assign a variable BEFORE calling FINAL_VAR on it."
150
+
return f"Error: Variable '{{name}}' not found. No variables have been created yet. You must create and assign a variable in a REPL block BEFORE calling FINAL_VAR on it."
151
+
152
+
def SHOW_VARS():
153
+
available = {{k: type(v).__name__ for k, v in _locals.items() if not k.startswith("_")}}
154
+
if not available:
155
+
return "No variables created yet. Use ```repl``` blocks to create variables."
return f"Error: Variable '{{variable_name}}' not found"
224
+
available = [k for k in _locals.keys() if not k.startswith("_")]
225
+
if available:
226
+
return f"Error: Variable '{{variable_name}}' not found. Available variables: {{available}}. You must create and assign a variable BEFORE calling FINAL_VAR on it."
227
+
return f"Error: Variable '{{variable_name}}' not found. No variables have been created yet. You must create and assign a variable in a REPL block BEFORE calling FINAL_VAR on it."
228
+
229
+
def SHOW_VARS():
230
+
available = {{k: type(v).__name__ for k, v in _locals.items() if not k.startswith("_")}}
231
+
if not available:
232
+
return "No variables created yet. Use ```repl``` blocks to create variables."
return f"Error: Variable '{{variable_name}}' not found"
223
+
available = [k for k in _locals.keys() if not k.startswith("_")]
224
+
if available:
225
+
return f"Error: Variable '{{variable_name}}' not found. Available variables: {{available}}. You must create and assign a variable BEFORE calling FINAL_VAR on it."
226
+
return f"Error: Variable '{{variable_name}}' not found. No variables have been created yet. You must create and assign a variable in a REPL block BEFORE calling FINAL_VAR on it."
227
+
228
+
def SHOW_VARS():
229
+
available = {{k: type(v).__name__ for k, v in _locals.items() if not k.startswith("_")}}
230
+
if not available:
231
+
return "No variables created yet. Use ```repl``` blocks to create variables."
Copy file name to clipboardExpand all lines: rlm/utils/prompts.py
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,8 @@
10
10
1. A `context` variable that contains extremely important information about your query. You should check the content of the `context` variable to understand what you are working with. Make sure you look through it sufficiently as you answer your query.
11
11
2. A `llm_query` function that allows you to query an LLM (that can handle around 500K chars) inside your REPL environment.
12
12
3. A `llm_query_batched` function that allows you to query multiple prompts concurrently: `llm_query_batched(prompts: List[str]) -> List[str]`. This is much faster than sequential `llm_query` calls when you have multiple independent queries. Results are returned in the same order as the input prompts.
13
-
4. The ability to use `print()` statements to view the output of your REPL code and continue your reasoning.
13
+
4. A `SHOW_VARS()` function that returns all variables you have created in the REPL. Use this to check what variables exist before using FINAL_VAR.
14
+
5. The ability to use `print()` statements to view the output of your REPL code and continue your reasoning.
14
15
15
16
You will only be able to see truncated outputs from the REPL environment, so you should use the query LLM function on variables you want to analyze. You will find this function especially useful when you have to analyze the semantics of the context. Use these variables as buffers to build up your final answer.
16
17
Make sure to explicitly look through the entire context in REPL before answering your query. An example strategy is to first look at the context and figure out a chunking strategy, then break up the context into smart chunks, and query an LLM per chunk with a particular question and save the answers to a buffer, then query an LLM with all the buffers to produce your final answer.
@@ -76,6 +77,15 @@
76
77
1. Use FINAL(your final answer here) to provide the answer directly
77
78
2. Use FINAL_VAR(variable_name) to return a variable you have created in the REPL environment as your final output
78
79
80
+
WARNING - COMMON MISTAKE: FINAL_VAR retrieves an EXISTING variable. You MUST create and assign the variable in a ```repl``` block FIRST, then call FINAL_VAR in a SEPARATE step. For example:
81
+
- WRONG: Calling FINAL_VAR(my_answer) without first creating `my_answer` in a repl block
82
+
- CORRECT: First run ```repl
83
+
my_answer = "the result"
84
+
print(my_answer)
85
+
``` then in the NEXT response call FINAL_VAR(my_answer)
86
+
87
+
If you're unsure what variables exist, you can call SHOW_VARS() in a repl block to see all available variables.
88
+
79
89
Think step by step carefully, plan, and execute this plan immediately in your response -- do not just say "I will do this" or "I will do that". Output to the REPL environment and recursive LLMs as much as possible. Remember to explicitly answer the original query in your final answer.
0 commit comments