-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_classify_message.cpp
More file actions
44 lines (35 loc) · 1.08 KB
/
Copy path01_classify_message.cpp
File metadata and controls
44 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2026 Bontal LLC
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
/**
* @file 01_classify_message.cpp
* @brief Binary classification with Noul questions.
*/
#include <typesafe/typesafe.h>
#include <iostream>
#include "openrouter_helper.h"
int main()
{
try
{
auto client = typesafe::examples::createClient();
typesafe::SystemOneRequest request;
request.state = "You won a free cruise! Click here to claim.";
request.add("spam",
typesafe::Noul{"Is this message unsolicited advertising?",
std::nullopt});
const typesafe::SystemOneResponse answer = client.systemOne(request);
std::cout << "spam probability: " << answer.nouls.at("spam").noul
<< "\n";
std::cout << "tokens: " << answer.usage.input_tokens << " in, "
<< answer.usage.output_tokens << " out\n";
return (0);
}
catch (const typesafe::TypeSafeError &error)
{
std::cerr << "TypeSafe: " << error.what() << "\n";
return (1);
}
}