Skip to content

Commit 6a5fe79

Browse files
committed
Add cache if possible to chat message
1 parent 27cf396 commit 6a5fe79

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Tool/Sources/OpenAIService/APIs/ChatCompletionsAPIDefinition.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ struct ChatCompletionsRequestBody: Codable, Equatable {
4141
///
4242
/// - important: It's required when the role is `tool`.
4343
var toolCallId: String?
44+
/// Cache the message if possible.
45+
var cacheIfPossible: Bool = false
4446
}
4547

4648
struct MessageFunctionCall: Codable, Equatable {

Tool/Sources/OpenAIService/ChatGPTService.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ extension ChatGPTService {
538538
} else {
539539
nil
540540
}
541-
}()
541+
}(),
542+
cacheIfPossible: chatMessage.cacheIfPossible
542543
))
543544

544545
for call in chatMessage.toolCalls ?? [] {

0 commit comments

Comments
 (0)