Skip to content
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

Add type signatures to all toolkits. #36

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions package/Toolkit/FileSystem.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## A collection of prebuilt tools for interacting with the file system. For safety reasons, the tools in this module are limited to working in the current working directory and its subdirectories.
##
## Usage:
## ```
## # USAGE:
## # Tool list to initialize the client
## tools = [listDirectory, listFileTree, readFileContents, writeFileContents ]
## # Tool handler map is passed to Tools.handleToolCalls!
Expand Down Expand Up @@ -30,7 +29,7 @@ import json.Json
import InternalTools exposing [Tool, buildTool]

## Expose name, handler and tool for listDirectory.
listDirectory : { name : Str, handler : Str -> Task Str _, tool : Tool }
listDirectory : { name : Str, handler : Str -> Task Str *, tool : Tool }
listDirectory = {
name: listDirectoryTool.function.name,
handler: listDirectoryHandler,
Expand Down Expand Up @@ -73,7 +72,7 @@ listDirectoryHandler = \args ->
## Expose name, handler and tool for listFileTree.
##
## This tool will allow the model to list the contents of a directory, and all subdirectories.
listFileTree : { name : Str, handler : Str -> Task Str _, tool : Tool }
listFileTree : { name : Str, handler : Str -> Task Str *, tool : Tool }
listFileTree = {
name: listFileTreeTool.function.name,
handler: listFileTreeHandler,
Expand Down Expand Up @@ -134,7 +133,7 @@ fileTreeHelper = \paths, accumulation, depth ->
## Expose name, handler and tool for readFileContents.
##
## This tool will allow the model to read the contents of a file.
readFileContents : { name : Str, handler : Str -> Task Str _, tool : Tool }
readFileContents : { name : Str, handler : Str -> Task Str *, tool : Tool }
readFileContents = {
name: readFileContentsTool.function.name,
handler: readFileContentsHandler,
Expand Down Expand Up @@ -177,7 +176,7 @@ readFileContentsHandler = \args ->
## Expose name, handler and tool for writeFileContents.
##
## This tool will allow the model to write content to a file.
writeFileContents : { name : Str, handler : Str -> Task Str _, tool : Tool }
writeFileContents : { name : Str, handler : Str -> Task Str *, tool : Tool }
writeFileContents = {
name: writeFileContentsTool.function.name,
handler: writeFileContentsHandler,
Expand Down
5 changes: 3 additions & 2 deletions package/Toolkit/OpenWeatherMap.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## A collection of prebuilt tools for interacting with the OpenWeatherMap API.
##
## Usage:
## ```
## # USAGE:
## # Tool list to initialize the client
## tools = [geocoding, currentWeather]
## # Tool handler map is passed to Tools.handleToolCalls!
Expand All @@ -25,6 +24,7 @@ import InternalTools exposing [Tool]
## Expose name, handler and tool for geocoding.
##
## This tool will allow the model to get the correct latitude and longitude for a location, for use with the currentWeather tool.
geocoding: { name : Str, handler : Str -> Task Str *, tool : Tool }
geocoding = {
name: geocodingTool.function.name,
handler: geocodingHandler,
Expand Down Expand Up @@ -85,6 +85,7 @@ geocodingHandler = \args ->
## Expose name, handler and tool for currentWeather
##
## This tool will allow the model to get the current weather for a location.
currentWeather: { name : Str, handler : Str -> Task Str *, tool : Tool }
currentWeather = {
name: currentWeatherTool.function.name,
handler: currentWeatherHandler,
Expand Down
7 changes: 5 additions & 2 deletions package/Toolkit/Roc.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## A collection of prebuilt tools for interacting with the Roc programming language CLI.
##
## Usage:
## ```
## # USAGE:
## # Tool list to initialize the client
## tools = [roc, rocCheck, rocTest, rocStart]
## # Tool handler map is passed to Tools.handleToolCalls!
Expand Down Expand Up @@ -38,6 +37,7 @@ CommandErr : [
## Expose name, handler and tool for roc.
##
## This tool will allow the model to run `roc` for a roc file.
roc : { name : Str, handler : Str -> Task Str *, tool : Tool }
roc = {
name: rocTool.function.name,
handler: rocHandler,
Expand Down Expand Up @@ -78,6 +78,7 @@ rocHandler = \args ->
## Expose name, handler and tool for rocCheck.
##
## This tool will allow the model to run `roc check` for a Roc file.
rocCheck : { name : Str, handler : Str -> Task Str *, tool : Tool }
rocCheck = {
name: rocCheckTool.function.name,
handler: rocCheckHandler,
Expand Down Expand Up @@ -119,6 +120,7 @@ rocCheckHandler = \args ->
## Expose name, handler and tool for rocTest.
##
## This tool will allow the model to run `roc test` for a Roc file.
rocTest : { name : Str, handler : Str -> Task Str *, tool : Tool }
rocTest = {
name: rocTestTool.function.name,
handler: rocTestHandler,
Expand Down Expand Up @@ -160,6 +162,7 @@ rocTestHandler = \args ->
## Expose name, handler and tool for rocStart.
##
## This tool will allow the model to use `roc-start` to initialize a new Roc application.
rocStart : { name : Str, handler : Str -> Task Str *, tool : Tool }
rocStart = {
name: rocStartTool.function.name,
handler: rocStartHandler,
Expand Down
4 changes: 2 additions & 2 deletions package/Toolkit/Serper.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## A prebuilt tool for interacting with the serper.dev google search API.
##
## Usage:
## ```
## # USAGE:
## # Tool list to initialize the client
## tools = [serper]
## # Tool handler map is passed to Tools.handleToolCalls!
Expand All @@ -22,6 +21,7 @@ import InternalTools exposing [Tool, buildTool]
## Expose name, handler and tool for serper.
##
## This tool allows the model to search google using the serper.dev API.
serper : { name : Str, handler : Str -> Task Str *, tool : Tool }
serper = {
name: tool.function.name,
handler,
Expand Down
10 changes: 5 additions & 5 deletions package/Toolkit/UtcTime.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## A prebuilt tool for getting the current UTC time.
##
## Usage:
## ```
## # USAGE:
## # Tool list to initialize the client
## tools = [utcNow]
## # Tool handler map is passed to Tools.handleToolCalls!
Expand All @@ -19,16 +18,17 @@ module { getUtcNow, utcToNanos } -> [utcNow]
import InternalTools exposing [Tool, buildTool]
import iso.DateTime

## Expose name, handler and tool for utcNow
## Expose name, handler and tool for utcNow.
##
## This tool allows the model to get the current UTC time as an ISO 8601 string.
utcNow : { name : Str, handler : Str -> Task Str *, tool : Tool }
utcNow = {
name: tool.function.name,
handler,
tool,
}

## Tool definition for the utcNow function
##
## This tool allows the model to get the current UTC time as an ISO 8601 string.
tool : Tool
tool = buildTool "utcNow" "Get the current UTC time as an ISO 8601 string" []

Expand Down
5 changes: 3 additions & 2 deletions package/Toolkit/Wikipedia.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## A collection of prebuilt tools for interacting with Wikipedia.
##
## Usage:
## ```
## # USAGE:
## # Tool list to initialize the client
## tools = [wikipediaSearch, wikipediaParse]
## # Tool handler map is passed to Tools.handleToolCalls!
Expand All @@ -28,6 +27,7 @@ baseUrl = "https://en.wikipedia.org/w/api.php"
## Expose name, handler and tool for the wikipediaSarch.
##
## This tool allows the model to search Wikipedia for a given query.
wikipediaSearch : { name : Str, handler : Str -> Task Str *, tool : Tool }
wikipediaSearch = {
name: wikipediaSearchTool.function.name,
handler: wikipediaSearchHandler,
Expand Down Expand Up @@ -94,6 +94,7 @@ wikipediaSearchHandler = \args ->
## Expose name, handler and tool for the wikipediaParse tool.
##
## This tool allows the model to parse a Wikipedia article.
wikipediaParse : { name : Str, handler : Str -> Task Str *, tool : Tool }
wikipediaParse = {
name: wikipediaParseTool.function.name,
handler: wikipediaParseHandler,
Expand Down
4 changes: 2 additions & 2 deletions package/Toolkit/WolframAlpha.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## A prebuilt tool for interacting with Wolfram Alpha.
##
## Usage:
## ```
## # USAGE:
## # Tool list to initialize the client
## tools = [wolframShortAnswer]
## # Tool handler map is passed to Tools.handleToolCalls!
Expand All @@ -25,6 +24,7 @@ import Shared exposing [urlEncode]
## Expose name, handler and tool for shortAnswer.
##
## This tool allows the model to ask Wolfram Alpha a question and get a short answer.
wolframShortAnswer : { name : Str, handler : Str -> Task Str *, tool : Tool }
wolframShortAnswer = {
name: shortAnswerTool.function.name,
handler: shortAnswerHandler,
Expand Down
4 changes: 2 additions & 2 deletions package/Toolkit/WorldTimeApi.roc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## A prebuilt tool for interacting with the WorldTimeApi.
##
## Usage:
## ```
## # USAGE:
## # Tool list to initialize the client
## tools = [currentTime]
## # Tool handler map is passed to Tools.handleToolCalls!
Expand All @@ -22,6 +21,7 @@ import json.Json
## Expose name, handler and tool for the currentTime.
##
## This tool allows the model to get the current time data for a given timezone.
currentTime : { name : Str, handler : Str -> Task Str *, tool : Tool }
currentTime = {
name: tool.function.name,
handler,
Expand Down
Loading