Skip to content

Commit 05e66d4

Browse files
authored
Merge pull request #5 from AnswerDotAI/fix_arg
fix: remove if statement too eagerly
2 parents 7e9e39c + 88c0714 commit 05e66d4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

msglm/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,6 @@ def mk_msg_anthropic(*args, cache=False, **kwargs):
161161
def mk_msgs_anthropic(*args, cache=False, cache_last_ckpt_only=False, **kwargs):
162162
"Create a list of Anthropic compatible messages."
163163
msgs = partial(mk_msgs, api="anthropic")(*args, **kwargs)
164-
msgs = [_remove_cache_ckpts(m) for m in msgs]
164+
if cache_last_ckpt_only: msgs = [_remove_cache_ckpts(m) for m in msgs]
165165
msgs[-1] = _add_cache_control(msgs[-1], cache=cache)
166166
return msgs

nbs/00_core.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@
17131713
"def mk_msgs_anthropic(*args, cache=False, cache_last_ckpt_only=False, **kwargs):\n",
17141714
" \"Create a list of Anthropic compatible messages.\"\n",
17151715
" msgs = partial(mk_msgs, api=\"anthropic\")(*args, **kwargs)\n",
1716-
" msgs = [_remove_cache_ckpts(m) for m in msgs]\n",
1716+
" if cache_last_ckpt_only: msgs = [_remove_cache_ckpts(m) for m in msgs]\n",
17171717
" msgs[-1] = _add_cache_control(msgs[-1], cache=cache)\n",
17181718
" return msgs"
17191719
]

0 commit comments

Comments
 (0)