Skip to content

Commit

Permalink
Reorder functions in Chat.roc and Expose Client from Prompt.roc
Browse files Browse the repository at this point in the history
  • Loading branch information
imclerran committed Dec 31, 2024
1 parent 24ec06d commit 4362506
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
14 changes: 7 additions & 7 deletions package/Chat.roc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 } ->
Expand Down
5 changes: 4 additions & 1 deletion package/Prompt.roc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
module [
PromptRequestBody,
PromptResponseBody,
Client,
buildHttpRequest,
buildRequestBody,
decodeErrorResponse,
Expand All @@ -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,
Expand Down

0 comments on commit 4362506

Please sign in to comment.