From 43625066a885e6b96d469f6249bed01feb0d1c86 Mon Sep 17 00:00:00 2001 From: Ian McLerran Date: Tue, 31 Dec 2024 09:31:42 -0600 Subject: [PATCH] Reorder functions in Chat.roc and Expose Client from Prompt.roc --- package/Chat.roc | 14 +++++++------- package/Prompt.roc | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package/Chat.roc b/package/Chat.roc index abac43b..896af9a 100644 --- a/package/Chat.roc +++ b/package/Chat.roc @@ -32,13 +32,6 @@ import Shared exposing [ Client : Client.Client -## Initialize the OpenRouter API client with the required API key. All parameters besides apiKey are completely optional, and may be set during initialization, assigned later, or left as their defaults. -## ``` -## client = Chat.initClient { apiKey: "your_openrouter_api_key" } -## ``` -## Same as `Client.init`. -initClient = Client.init - ## The OpenAI ChatML standard message used to query the AI model. Message : { role : Str, @@ -143,6 +136,13 @@ DecodeChatResponseBody : { }, } +## Initialize the OpenRouter API client with the required API key. All parameters besides apiKey are completely optional, and may be set during initialization, assigned later, or left as their defaults. +## ``` +## client = Chat.initClient { apiKey: "your_openrouter_api_key" } +## ``` +## Same as `Client.init`. +initClient = Client.init + ## Create a request object to be sent with basic-cli's Http.send using ChatML messages buildHttpRequest : Client, List Message, { toolChoice ? ToolChoice } -> RequestObject buildHttpRequest = \client, messages, { toolChoice ? Auto } -> diff --git a/package/Prompt.roc b/package/Prompt.roc index 3d965a8..0c42217 100644 --- a/package/Prompt.roc +++ b/package/Prompt.roc @@ -2,6 +2,7 @@ module [ PromptRequestBody, PromptResponseBody, + Client, buildHttpRequest, buildRequestBody, decodeErrorResponse, @@ -18,9 +19,11 @@ module [ import json.Json import json.Option exposing [Option] -import Client exposing [Client] +import Client import Shared exposing [RequestObject, ApiError] +Client: Client.Client + ## The structure of the request body to be sent in the Http request PromptRequestBody : { prompt : Str,