-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsession_reference_context.hpp
More file actions
53 lines (40 loc) · 1.43 KB
/
Copy pathsession_reference_context.hpp
File metadata and controls
53 lines (40 loc) · 1.43 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
#pragma once
#include "../provider/llm_provider.hpp"
#include <cstddef>
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
namespace acecode::web {
inline constexpr std::size_t kMaxSessionReferences = 5;
inline constexpr std::size_t kMaxSessionReferenceIdBytes = 256;
inline constexpr std::size_t kMaxSessionReferenceLabelBytes = 512;
inline constexpr std::size_t kMaxSessionReferenceTranscriptBytes = 24 * 1024;
inline constexpr std::size_t kMaxSessionReferencePromptBytes = 64 * 1024;
struct SessionReferenceDescriptor {
std::string session_id;
std::string workspace_hash;
bool no_workspace = false;
std::string title;
std::string workspace_name;
};
struct ParsedSessionReferences {
bool ok = true;
std::string error;
std::vector<SessionReferenceDescriptor> references;
};
struct ResolvedSessionReference {
SessionReferenceDescriptor descriptor;
std::vector<ChatMessage> messages;
};
struct SessionReferencePromptContext {
nlohmann::json meta = nlohmann::json::array();
std::string prompt;
};
ParsedSessionReferences parse_session_reference_descriptors(
const nlohmann::json& value);
SessionReferencePromptContext build_session_reference_prompt_context(
const std::vector<ResolvedSessionReference>& references);
std::string build_session_reference_augmented_prompt(
const SessionReferencePromptContext& context,
const std::string& user_text);
} // namespace acecode::web