Skip to content

Commit 9ffa597

Browse files
committed
cache the whole system prompt at once
1 parent 31f5587 commit 9ffa597

File tree

1 file changed

+2
-1
lines changed
  • anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/service/impl

1 file changed

+2
-1
lines changed

anthropic-client/src/main/scala/io/cequence/openaiscala/anthropic/service/impl/package.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ package object impl extends AnthropicServiceConsts {
4848
messages.zipWithIndex.collect { case (SystemMessage(content, _), index) =>
4949
useSystemCache match {
5050
case Some(cacheControl) =>
51-
if (index == 0) ContentBlockBase(TextBlock(content), Some(cacheControl))
51+
if (index == messages.size - 1)
52+
ContentBlockBase(TextBlock(content), Some(cacheControl))
5253
else ContentBlockBase(TextBlock(content), None)
5354
case None => ContentBlockBase(TextBlock(content))
5455
}

0 commit comments

Comments
 (0)