From ff4ee0344cae09aed64588b419e1d12e866badb0 Mon Sep 17 00:00:00 2001 From: Ian McLerran Date: Tue, 31 Dec 2024 09:22:34 -0600 Subject: [PATCH] Improve toolkit usage examples --- package/Toolkit/FileSystem.roc | 5 ++--- package/Toolkit/OpenWeatherMap.roc | 5 ++--- package/Toolkit/Roc.roc | 5 ++--- package/Toolkit/Serper.roc | 5 ++--- package/Toolkit/UtcTime.roc | 5 ++--- package/Toolkit/Wikipedia.roc | 5 ++--- package/Toolkit/WolframAlpha.roc | 5 ++--- package/Toolkit/WorldTimeApi.roc | 5 ++--- 8 files changed, 16 insertions(+), 24 deletions(-) diff --git a/package/Toolkit/FileSystem.roc b/package/Toolkit/FileSystem.roc index 009d992..e90cc81 100644 --- a/package/Toolkit/FileSystem.roc +++ b/package/Toolkit/FileSystem.roc @@ -11,12 +11,11 @@ ## (writeFileContents.name, writeFileContents.handler), ## ] ## client = Client.init { apiKey, model: "tool-capable/model", tools } -## ## #... -## ## messages = Chat.appendUserMessage previousMessages newMessage ## response = Http.send (Chat.buildHttpRequest client messages {}) |> Task.result! -## updatedMessages = updateMessagesFromResponse response messages |> Tools.handleToolCalls! client toolHandlerMap +## updatedMessages = updateMessagesFromResponse response messages +## |> Tools.handleToolCalls! client toolHandlerMap ## ``` module { pathFromStr, pathToStr, listDir, isDir, readFile, writeUtf8 } -> [ listDirectory, diff --git a/package/Toolkit/OpenWeatherMap.roc b/package/Toolkit/OpenWeatherMap.roc index ac053ca..a3ec729 100644 --- a/package/Toolkit/OpenWeatherMap.roc +++ b/package/Toolkit/OpenWeatherMap.roc @@ -9,12 +9,11 @@ ## (currentWeather.name, currentWeather.handler), ## ] ## client = Client.init { apiKey, model: "tool-capable/model", tools } -## ## #... -## ## messages = Chat.appendUserMessage previousMessages newMessage ## response = Http.send (Chat.buildHttpRequest client messages {}) |> Task.result! -## updatedMessages = updateMessagesFromResponse response messages |> Tools.handleToolCalls! client toolHandlerMap +## updatedMessages = updateMessagesFromResponse response messages +## |> Tools.handleToolCalls! client toolHandlerMap ## ``` module { sendHttpReq, getEnvVar } -> [geocoding, currentWeather] diff --git a/package/Toolkit/Roc.roc b/package/Toolkit/Roc.roc index 85ecbe5..da2bca6 100644 --- a/package/Toolkit/Roc.roc +++ b/package/Toolkit/Roc.roc @@ -11,12 +11,11 @@ ## (rocStart.name, rocStart.handler), ## ] ## client = Client.init { apiKey, model: "tool-capable/model", tools } -## ## #... -## ## messages = Chat.appendUserMessage previousMessages newMessage ## response = Http.send (Chat.buildHttpRequest client messages {}) |> Task.result! -## updatedMessages = updateMessagesFromResponse response messages |> Tools.handleToolCalls! client toolHandlerMap +## updatedMessages = updateMessagesFromResponse response messages +## |> Tools.handleToolCalls! client toolHandlerMap ## ``` module { cmdNew, cmdArg, cmdOutput } -> [roc, rocCheck, rocTest, rocStart] diff --git a/package/Toolkit/Serper.roc b/package/Toolkit/Serper.roc index e12f012..a989fe3 100644 --- a/package/Toolkit/Serper.roc +++ b/package/Toolkit/Serper.roc @@ -6,12 +6,11 @@ ## # Tool handler map is passed to Tools.handleToolCalls! ## toolHandlerMap = Dict.fromList [(serper.name, serper.handler)] ## client = Client.init { apiKey, model: "tool-capable/model", tools } -## ## #... -## ## messages = Chat.appendUserMessage previousMessages newMessage ## response = Http.send (Chat.buildHttpRequest client messages {}) |> Task.result! -## updatedMessages = updateMessagesFromResponse response messages |> Tools.handleToolCalls! client toolHandlerMap +## updatedMessages = updateMessagesFromResponse response messages +## |> Tools.handleToolCalls! client toolHandlerMap ## ``` module { sendHttpReq, getEnvVar } -> [serper] diff --git a/package/Toolkit/UtcTime.roc b/package/Toolkit/UtcTime.roc index c0dbdca..96d5087 100644 --- a/package/Toolkit/UtcTime.roc +++ b/package/Toolkit/UtcTime.roc @@ -6,12 +6,11 @@ ## # Tool handler map is passed to Tools.handleToolCalls! ## toolHandlerMap = Dict.fromList [(utcNow.name, utcNow.handler)] ## client = Client.init { apiKey, model: "tool-capable/model", tools } -## ## #... -## ## messages = Chat.appendUserMessage previousMessages newMessage ## response = Http.send (Chat.buildHttpRequest client messages {}) |> Task.result! -## updatedMessages = updateMessagesFromResponse response messages |> Tools.handleToolCalls! client toolHandlerMap +## updatedMessages = updateMessagesFromResponse response messages +## |> Tools.handleToolCalls! client toolHandlerMap ## ``` module { getUtcNow, utcToNanos } -> [utcNow] diff --git a/package/Toolkit/Wikipedia.roc b/package/Toolkit/Wikipedia.roc index 5d1aa5c..9bee6d0 100644 --- a/package/Toolkit/Wikipedia.roc +++ b/package/Toolkit/Wikipedia.roc @@ -9,12 +9,11 @@ ## (wikipediaParse.name, wikipediaParse.handler), ## ] ## client = Client.init { apiKey, model: "tool-capable/model", tools } -## ## #... -## ## messages = Chat.appendUserMessage previousMessages newMessage ## response = Http.send (Chat.buildHttpRequest client messages {}) |> Task.result! -## updatedMessages = updateMessagesFromResponse response messages |> Tools.handleToolCalls! client toolHandlerMap +## updatedMessages = updateMessagesFromResponse response messages +## |> Tools.handleToolCalls! client toolHandlerMap ## ``` module { sendHttpReq } -> [wikipediaSearch, wikipediaParse] diff --git a/package/Toolkit/WolframAlpha.roc b/package/Toolkit/WolframAlpha.roc index 29acfe4..749c327 100644 --- a/package/Toolkit/WolframAlpha.roc +++ b/package/Toolkit/WolframAlpha.roc @@ -8,12 +8,11 @@ ## (wolframShortAnswer.name, wolframShortAnswer.handler), ## ] ## client = Client.init { apiKey, model: "tool-capable/model", tools } -## ## #... -## ## messages = Chat.appendUserMessage previousMessages newMessage ## response = Http.send (Chat.buildHttpRequest client messages {}) |> Task.result! -## updatedMessages = updateMessagesFromResponse response messages |> Tools.handleToolCalls! client toolHandlerMap +## updatedMessages = updateMessagesFromResponse response messages +## |> Tools.handleToolCalls! client toolHandlerMap ## ``` module { sendHttpReq, getEnvVar } -> [wolframShortAnswer] diff --git a/package/Toolkit/WorldTimeApi.roc b/package/Toolkit/WorldTimeApi.roc index 81347e1..648fbcf 100644 --- a/package/Toolkit/WorldTimeApi.roc +++ b/package/Toolkit/WorldTimeApi.roc @@ -6,12 +6,11 @@ ## # Tool handler map is passed to Tools.handleToolCalls! ## toolHandlerMap = Dict.fromList [(currentTime.name, currentTime.handler)] ## client = Client.init { apiKey, model: "tool-capable/model", tools } -## ## #... -## ## messages = Chat.appendUserMessage previousMessages newMessage ## response = Http.send (Chat.buildHttpRequest client messages {}) |> Task.result! -## updatedMessages = updateMessagesFromResponse response messages |> Tools.handleToolCalls! client toolHandlerMap +## updatedMessages = updateMessagesFromResponse response messages +## |> Tools.handleToolCalls! client toolHandlerMap ## ``` module { sendHttpReq } -> [currentTime]