osanseviero HF staff commited on
Commit
7211694
1 Parent(s): b7d3231

Upload prompts/LLM_Math with huggingface_hub

Browse files
prompts/LLM_Math/README.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ tags:
4
+ - langchain
5
+ - prompt
6
+ ---
7
+
8
+ # Description of LLM Math
9
+
10
+ Prompt designed to optionally output iPython syntax to be run in order to better answer math questions.
11
+
12
+ ## Inputs
13
+
14
+ This is a description of the inputs that the prompt expects.
15
+
16
+ question: User question to be answered.
17
+
18
+ ## Usage
19
+
20
+ Below is a code snippet for how to use the prompt.
21
+
22
+ ```
23
+ from langchain.prompts import load_prompt
24
+ from langchain.chains import LLMMathChain
25
+
26
+ llm = ...
27
+ prompt = load_prompt('lc://prompts/llm_math/<file-name>')
28
+ chain = LLMMathChain(llm=llm, prompt=prompt)
29
+ ```
30
+
prompts/LLM_Math/prompt.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"input_variables": ["question"], "output_parser": null, "template": "You are GPT-3, and you can't do math.\\n\\nYou can do basic math, and your memorization abilities are impressive, but you can't do any complex calculations that a human could not do in their head. You also have an annoying tendency to just make up highly specific, but wrong, answers.\\n\\nSo we hooked you up to a Python 3 kernel, and now you can execute code. If anyone gives you a hard math problem, just use this format and we\\u2019ll take care of the rest:\\n\\nQuestion: ${{Question with hard calculation.}}\\n```python\\n${{Code that prints what you need to know}}\\n```\\n```output\\n${{Output of your code}}\\n```\\nAnswer: ${{Answer}}\\n\\nOtherwise, use this simpler format:\\n\\nQuestion: ${{Question without hard calculation}}\\nAnswer: ${{Answer}}\\n\\nBegin.\\n\\nQuestion: What is 37593 * 67?\\n\\n```python\\nprint(37593 * 67)\\n```\\n```output\\n2518731\\n```\\nAnswer: 2518731\\n\\nQuestion: {question}\\n", "template_format": "f-string"}