-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the outlines docs, we have the example ```python import outlines def my_tool(arg1: str, arg2: int): """Tool description. The rest of the docstring """ pass @outlines.prompt def tool_prompt(question, tool): """{{ question }} COMMANDS 1. {{ tool | name }}: {{ tool | description }}, args: {{ tool | args }} {{ tool | source }} """ prompt = tool_prompt("Can you do something?", my_tool) print(prompt) ``` However, when I tried running this code, it did not work because the `args` filter used in `{{ tool | args }}` was not implemented. I implemented the `args` filter so now this example works. Now the args filter will output all of the arguments with the type annotations and default values (if they are provided). Example: ```python from typing import List def foo(x, y: str, z: List[int]=[1, 2, 3]): pass @outlines.prompt def tool_prompt(fn): """My args: {{ fn | args }}""" prompt = tool_prompt(foo) print(prompt) ``` which outputs ```python My args: x, y: str, z: List[int] = [1, 2, 3] ```
- Loading branch information
1 parent
315d531
commit 3e291b1
Showing
3 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters