PythonAstREPLTool - How to add few-shot examples? #27565
mraguth
announced in
Ask Dosu (Archived)
Replies: 1 comment 4 replies
-
To add few-shot examples to the from langchain_experimental.tools.python.tool import PythonAstREPLTool
description = """
A Python shell. Use this to execute python commands. Input should be a valid python command.
When using this tool, sometimes output is abbreviated - make sure it does not look abbreviated before using it in your answer.
Examples:
1. Input: `print("Hello, World!")`
Output: `Hello, World!`
2. Input: `1 + 1`
Output: `2`
3. Input: `len("LangChain")`
Output: `9`
"""
tool = PythonAstREPLTool(description=description) In this example, the |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://api.python.langchain.com/en/latest/tools/langchain_experimental.tools.python.tool.PythonAstREPLTool.html
As mentioned in the above reference, how I add 'few shot examples'? can I add a template? or can you give me a sample code for me?
param description: str = 'A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes output is abbreviated - make sure it does not look abbreviated before using it in your answer.'
Used to tell the model how/when/why to use the tool.
You can provide few-shot examples as a part of the description.
Beta Was this translation helpful? Give feedback.
All reactions