forked from janhq/cortex.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassistants.h
More file actions
78 lines (58 loc) · 2.8 KB
/
assistants.h
File metadata and controls
78 lines (58 loc) · 2.8 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include <drogon/HttpController.h>
#include <trantor/utils/Logger.h>
#include "services/assistant_service.h"
using namespace drogon;
class Assistants : public drogon::HttpController<Assistants, false> {
constexpr static auto kOpenAiAssistantKeyV2 = "openai-beta";
constexpr static auto kOpenAiAssistantValueV2 = "assistants=v2";
public:
METHOD_LIST_BEGIN
ADD_METHOD_TO(
Assistants::ListAssistants,
"/v1/"
"assistants?limit={limit}&order={order}&after={after}&before={before}",
Get);
ADD_METHOD_TO(Assistants::DeleteAssistant, "/v1/assistants/{assistant_id}",
Options, Delete);
ADD_METHOD_TO(Assistants::RetrieveAssistant, "/v1/assistants/{assistant_id}",
Get);
ADD_METHOD_TO(Assistants::CreateAssistant, "/v1/assistants/{assistant_id}",
Options, Post);
ADD_METHOD_TO(Assistants::CreateAssistantV2, "/v1/assistants", Options, Post);
ADD_METHOD_TO(Assistants::ModifyAssistant, "/v1/assistants/{assistant_id}",
Options, Patch);
METHOD_LIST_END
explicit Assistants(std::shared_ptr<AssistantService> assistant_srv)
: assistant_service_{assistant_srv} {};
void ListAssistants(const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback,
std::optional<std::string> limit,
std::optional<std::string> order,
std::optional<std::string> after,
std::optional<std::string> before) const;
void RetrieveAssistant(const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback,
const std::string& assistant_id) const;
void RetrieveAssistantV2(
const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback,
const std::string& assistant_id) const;
void DeleteAssistant(const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback,
const std::string& assistant_id);
void CreateAssistant(const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback,
const std::string& assistant_id);
void CreateAssistantV2(
const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback);
void ModifyAssistant(const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback,
const std::string& assistant_id);
void ModifyAssistantV2(const HttpRequestPtr& req,
std::function<void(const HttpResponsePtr&)>&& callback,
const std::string& assistant_id);
private:
std::shared_ptr<AssistantService> assistant_service_;
};