Current section
Files
Jump to
Current section
Files
src/gopenai.erl
-module(gopenai).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([main/0]).
-spec main() -> {ok, gopenai@chat:completion_response()} |
{error, gopenai@chat:chat_error()}.
main() ->
System = <<"
Your an IoT Data Analyst your job is to find anomalies from a fridge timeseries (an array of tuples (time,temperature)) for an etire day.
The operational temperature is 5.0°C celsius, an anomaly can be defined as an increment in temperature (+5.0°C celcius) for more than 2 hours.
"/utf8>>,
Data = <<"
time,temperature
6:00,5.5
7:00,4.5
8:00,5.0
9:00,5.5
10:00,4.5
11:00,5.0
12:00,5.5
13:00,4.5
14:00,5.0
15:00,6.5
16:00,8.5
17:00,10.0
18:00,15.0
19:00,16.0
20:00,17.0
"/utf8>>,
gleam@result:'try'(
gopenai@chat:completion(
gopenai@client:generic(
<<"https://api.groq.com/openai"/utf8>>,
<<"GROQ_API_KEY"/utf8>>
),
{request,
l_la_ma3_size8b,
[{system_message, System, none}, {user_message, Data, none}],
+0.0,
none}
),
fun(Res) -> pprint:debug({ok, Res}) end
).