-
Notifications
You must be signed in to change notification settings - Fork 4
Tool Definition docs #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EricGustin
wants to merge
8
commits into
main
Choose a base branch
from
ericgustin/tool-definition
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+255
−0
Open
Tool Definition docs #135
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f21c4ea
Tool Definition docs
EricGustin 2809868
Update file metadata
EricGustin d4257c1
Address Sam's comments
EricGustin ec3f998
Improve
EricGustin 437b852
Use code examples
EricGustin 66bc325
Undo really annoying pre-commit formatting that literally commits its…
EricGustin fe8e51a
Undo annoying pre-commit formatting
EricGustin 62a9c79
Omg i hate this formatter
EricGustin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: "Tool Definition" | ||
description: "Documentation for what is sent to the language model when defining a tool" | ||
--- | ||
|
||
# Tool Definitions | ||
|
||
When defining an Arcade tool, it's important to understand which parts of the tool's definition are sent to the language model and which are not. This understanding helps in designing tools that effectively communicate their purpose and usage to the model. | ||
|
||
```python | ||
@tool( | ||
requires_auth=Google( | ||
scopes=["https://www.googleapis.com/auth/gmail.compose"], | ||
) # Not sent to the model | ||
) | ||
async def write_draft_email( # Tool name and toolkit name is sent to the model | ||
context: ToolContext, # ToolContext is never sent to the model | ||
subject: Annotated[str, "Subject of the email"], # Sent to the model | ||
body: Annotated[str, "Body content of the email"], # Sent to the model | ||
recipient: Annotated[str, "Email recipient"], # Sent to the model | ||
cc: Annotated[Optional[list[str]], "CC recipients"], # Sent to the model | ||
bcc: Annotated[Optional[list[str]], "BCC recipients"], # Sent to the model | ||
) -> Annotated[dict, "Email draft details"]: # Return type not sent to the model | ||
""" | ||
Drafts an email with the given subject and body. # Sent to the model | ||
""" | ||
# The body of the function is not sent to the model | ||
... | ||
``` | ||
|
||
## Additional Information | ||
|
||
- _**Defaults:**_ The default value for optional parameters is not sent to the language model. | ||
- _**Enum Values:**_ If a parameter is an enum, each possible value for the enum is sent to the language model. This provides clarity on the valid options for that parameter. | ||
EricGustin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- _**Annotations:**_ The annotation for each parameter is sent to the language model, thus each parameter must be annotated. | ||
- _**Tool Definition Schema:**_ Check out the [Tool Definition JSON schema](https://github.com/ArcadeAI/arcade-ai/blob/main/schemas/preview/tool_definition.schema.jsonc) for more details on how to define your tools. | ||
|
||
Understanding these distinctions helps in crafting tools that are clear and informative for the language model. If you are ever unsure about what is sent to the language model, you can always retrieve a tool's definition formatted for a specific model. For more details, refer to the [get formatted tool definitions](home/use-tools/get-tool-definitions) documentation. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.