forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
718 B
Python
35 lines
718 B
Python
# flake8: noqa
|
|
from langchain.prompts.prompt import PromptTemplate
|
|
|
|
_PROMPT_TEMPLATE = """Translate a math problem into a expression that can be executed using Python's numexpr library. Use the output of running this code to answer the question.
|
|
|
|
Question: ${{Question with math problem.}}
|
|
```text
|
|
${{single line mathematical expression that solves the problem}}
|
|
```
|
|
...numexpr.evaluate(text)...
|
|
```output
|
|
${{Output of running the code}}
|
|
```
|
|
Answer: ${{Answer}}
|
|
|
|
Begin.
|
|
|
|
Question: What is 37593 * 67?
|
|
```text
|
|
37593 * 67
|
|
```
|
|
...numexpr.evaluate("37593 * 67")...
|
|
```output
|
|
2518731
|
|
```
|
|
Answer: 2518731
|
|
|
|
Question: {question}
|
|
"""
|
|
|
|
PROMPT = PromptTemplate(
|
|
input_variables=["question"],
|
|
template=_PROMPT_TEMPLATE,
|
|
)
|