Skip to content

Commit 0f6a311

Browse files
committed
Add cacheIfPossible to chat message
1 parent 2b86abb commit 0f6a311

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Tool/Sources/ChatBasic/ChatMessage.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ public struct ChatMessage: Equatable, Codable {
145145
/// The references of this message.
146146
@FallbackDecoding<EmptyArray<Reference>>
147147
public var references: [Reference]
148+
149+
/// Cache the message in the prompt if possible.
150+
public var cacheIfPossible: Bool
148151

149152
/// Is the message considered empty.
150153
public var isEmpty: Bool {
@@ -164,7 +167,8 @@ public struct ChatMessage: Equatable, Codable {
164167
toolCalls: [ToolCall]? = nil,
165168
summary: String? = nil,
166169
tokenCount: Int? = nil,
167-
references: [Reference] = []
170+
references: [Reference] = [],
171+
cacheIfPossible: Bool = false
168172
) {
169173
self.role = role
170174
self.senderId = senderId
@@ -176,6 +180,7 @@ public struct ChatMessage: Equatable, Codable {
176180
self.id = id
177181
tokensCount = tokenCount
178182
self.references = references
183+
self.cacheIfPossible = cacheIfPossible
179184
}
180185
}
181186

0 commit comments

Comments
 (0)