ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
llm_client.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5#include <vector>
6
7namespace llm
8{
10{
11 std::string role;
12 std::string content;
13};
14
15enum class backendt
16{
19};
20
21struct configt
22{
24 std::string model;
25 std::string endpoint;
26 std::string api_key;
27 double temperature = 0.7;
28 unsigned max_tokens = 1024;
29 unsigned timeout_ms = 30000;
30
31 // For the CLI backend.
32 std::string executable;
33 std::vector<std::string> extra_args;
34};
35
43{
44public:
45 virtual ~clientt() = default;
46
47 // Single chat completion; returns the assistant message content.
48 virtual std::string complete(const std::vector<message_t> &messages) = 0;
49
50 const configt &config() const noexcept
51 {
52 return cfg;
53 }
54
55protected:
56 explicit clientt(configt config) : cfg(std::move(config))
57 {
58 }
59
61};
62
63std::unique_ptr<clientt> make_client(configt config);
64
65} // namespace llm
virtual ~clientt()=default
configt cfg
Definition llm_client.h:60
clientt(configt config)
Definition llm_client.h:56
virtual std::string complete(const std::vector< message_t > &messages)=0
const configt & config() const noexcept
Definition llm_client.h:50
configt config
Definition config.cpp:8
Definition cli_llm_client.cpp:25
std::unique_ptr< clientt > make_client(configt config)
Definition llm_client.cpp:26
backendt
Definition llm_client.h:16
@ cli
Definition llm_client.h:18
@ stub
Definition llm_client.h:17
Definition exception.cpp:51
Definition llm_client.h:22
std::string executable
Definition llm_client.h:32
unsigned timeout_ms
Definition llm_client.h:29
std::string endpoint
Definition llm_client.h:25
double temperature
Definition llm_client.h:27
std::string api_key
Definition llm_client.h:26
std::string model
Definition llm_client.h:24
unsigned max_tokens
Definition llm_client.h:28
std::vector< std::string > extra_args
Definition llm_client.h:33
backendt backend
Definition llm_client.h:23
Definition llm_client.h:10
std::string role
Definition llm_client.h:11
std::string content
Definition llm_client.h:12