@@ -12,6 +12,7 @@ class PromptConfiguration(
12
12
val docsInContext : Int = 5 ,
13
13
val memoryLimit : Int = 5 ,
14
14
val minResponseTokens : Int = 500 ,
15
+ val messagePolicy : MessagePolicy = MessagePolicy (),
15
16
) {
16
17
companion object {
17
18
@@ -23,6 +24,7 @@ class PromptConfiguration(
23
24
private var docsInContext: Int = 20
24
25
private var minResponseTokens: Int = 500
25
26
private var memoryLimit: Int = 5
27
+ private var messagePolicy: MessagePolicy = MessagePolicy ()
26
28
27
29
fun maxDeserializationAttempts (maxDeserializationAttempts : Int ) = apply {
28
30
this .maxDeserializationAttempts = maxDeserializationAttempts
@@ -44,6 +46,8 @@ class PromptConfiguration(
44
46
45
47
fun memoryLimit (memoryLimit : Int ) = apply { this .memoryLimit = memoryLimit }
46
48
49
+ fun messagePolicy (messagePolicy : MessagePolicy ) = apply { this .messagePolicy = messagePolicy }
50
+
47
51
fun build () =
48
52
PromptConfiguration (
49
53
maxDeserializationAttempts = maxDeserializationAttempts,
@@ -53,6 +57,7 @@ class PromptConfiguration(
53
57
docsInContext = docsInContext,
54
58
memoryLimit = memoryLimit,
55
59
minResponseTokens = minResponseTokens,
60
+ messagePolicy = messagePolicy,
56
61
)
57
62
}
58
63
@@ -62,3 +67,15 @@ class PromptConfiguration(
62
67
@JvmField val DEFAULTS = PromptConfiguration ()
63
68
}
64
69
}
70
+
71
+ /* *
72
+ * The [MessagePolicy] encapsulates the message selection policy for sending to the server. Allows
73
+ * defining the percentages of historical and contextual messages to include in the final list.
74
+ *
75
+ * @property historyPercent Percentage of historical messages
76
+ * @property contextPercent Percentage of context messages
77
+ */
78
+ class MessagePolicy (
79
+ val historyPercent : Int = 50 ,
80
+ val contextPercent : Int = 50 ,
81
+ )
0 commit comments