Skip to content

Commit

Permalink
Merge pull request #28 from imclerran/list-splitat
Browse files Browse the repository at this point in the history
Rename List. split to List.splitAt
  • Loading branch information
imclerran authored Dec 6, 2024
2 parents da9fbe2 + b9058a2 commit e70eb97
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package/Chat.roc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ injectMessages = \bodyBytes, messages ->
if injectAt == 0 then
bodyBytes
else
{ before, others } = List.split bodyBytes injectAt
{ before, others } = List.splitAt bodyBytes injectAt
messageBytes = messages |> List.map \message ->
if message.cached && message.toolCallId == "" then
messageToCacheMessage message
Expand Down
4 changes: 2 additions & 2 deletions package/InternalTools.roc
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ ToolChoice : [None, Auto, ToolName Str]
## Inject the tools list into the request body. This is necessary because Encode does not support Dict types.
injectTools : List U8, List Tool -> List U8
injectTools = \requestBody, tools ->
{ before, others } = List.split requestBody ((List.len requestBody) - 1)
{ before, others } = List.splitAt requestBody ((List.len requestBody) - 1)
toolsJson = encodeTools tools
[before, (", \"tools\": " |> Str.toUtf8), toolsJson, others] |> List.join

## Inject the tool choice into the request body. This is necessary because Encode does not support Dict types.
injectToolChoice : List U8, ToolChoice -> List U8
injectToolChoice = \requestBody, toolChoice ->
{ before, others } = List.split requestBody ((List.len requestBody) - 1)
{ before, others } = List.splitAt requestBody ((List.len requestBody) - 1)
toolChoiceJson =
when toolChoice is
None -> "\"none\"" |> Str.toUtf8
Expand Down
4 changes: 2 additions & 2 deletions package/main.roc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ package [
Toolkit.WolframAlpha,
Toolkit.WorldTimeApi,
] {
json: "https://github.com/lukewilliamboswell/roc-json/releases/download/0.10.2/FH4N0Sw-JSFXJfG3j54VEDPtXOoN-6I9v_IA8S18IGk.tar.br",
iso: "https://github.com/imclerran/roc-isodate/releases/download/v0.5.0/ptg0ElRLlIqsxMDZTTvQHgUSkNrUSymQaGwTfv0UEmk.tar.br",
json: "https://github.com/lukewilliamboswell/roc-json/releases/download/0.11.0/z45Wzc-J39TLNweQUoLw3IGZtkQiEN3lTBv3BXErRjQ.tar.br",
iso: "https://github.com/imclerran/roc-isodate/releases/download/v0.5.2/4h2zENssbUDlWTTsTuwCmb0tal733VWhjft8LO7WcQo.tar.br",
}

0 comments on commit e70eb97

Please sign in to comment.