Skip to content

Commit

Permalink
Add type signatures for all toolkits
Browse files Browse the repository at this point in the history
  • Loading branch information
imclerran committed Dec 31, 2024
1 parent 73b1b4f commit 71f0879
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
8 changes: 4 additions & 4 deletions package/Toolkit/FileSystem.roc
Original file line number Diff line number Diff line change
Expand Up @@ -29,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 @@ -72,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 @@ -133,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 @@ -176,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
2 changes: 2 additions & 0 deletions package/Toolkit/OpenWeatherMap.roc
Original file line number Diff line number Diff line change
Expand Up @@ -24,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 @@ -84,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
4 changes: 4 additions & 0 deletions package/Toolkit/Roc.roc
Original file line number Diff line number Diff line change
Expand Up @@ -37,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 @@ -77,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 @@ -118,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 @@ -159,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
1 change: 1 addition & 0 deletions package/Toolkit/Serper.roc
Original file line number Diff line number Diff line change
Expand Up @@ -21,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
7 changes: 4 additions & 3 deletions package/Toolkit/UtcTime.roc
Original file line number Diff line number Diff line change
Expand Up @@ -18,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
2 changes: 2 additions & 0 deletions package/Toolkit/Wikipedia.roc
Original file line number Diff line number Diff line change
Expand Up @@ -27,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 @@ -93,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
1 change: 1 addition & 0 deletions package/Toolkit/WolframAlpha.roc
Original file line number Diff line number Diff line change
Expand Up @@ -24,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
1 change: 1 addition & 0 deletions package/Toolkit/WorldTimeApi.roc
Original file line number Diff line number Diff line change
Expand Up @@ -21,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

0 comments on commit 71f0879

Please sign in to comment.