letta-nightly 0.8.4.dev20250617104327__py3-none-any.whl → 0.8.4.dev20250619104255__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- letta/llm_api/anthropic_client.py +23 -1
- {letta_nightly-0.8.4.dev20250617104327.dist-info → letta_nightly-0.8.4.dev20250619104255.dist-info}/METADATA +1 -1
- {letta_nightly-0.8.4.dev20250617104327.dist-info → letta_nightly-0.8.4.dev20250619104255.dist-info}/RECORD +6 -6
- {letta_nightly-0.8.4.dev20250617104327.dist-info → letta_nightly-0.8.4.dev20250619104255.dist-info}/LICENSE +0 -0
- {letta_nightly-0.8.4.dev20250617104327.dist-info → letta_nightly-0.8.4.dev20250619104255.dist-info}/WHEEL +0 -0
- {letta_nightly-0.8.4.dev20250617104327.dist-info → letta_nightly-0.8.4.dev20250619104255.dist-info}/entry_points.txt +0 -0
@@ -243,7 +243,8 @@ class AnthropicClient(LLMClientBase):
|
|
243
243
|
# Move 'system' to the top level
|
244
244
|
if messages[0].role != "system":
|
245
245
|
raise RuntimeError(f"First message is not a system message, instead has role {messages[0].role}")
|
246
|
-
|
246
|
+
system_content = messages[0].content if isinstance(messages[0].content, str) else messages[0].content[0].text
|
247
|
+
data["system"] = self._add_cache_control_to_system_message(system_content)
|
247
248
|
data["messages"] = [
|
248
249
|
m.to_anthropic_dict(
|
249
250
|
inner_thoughts_xml_tag=inner_thoughts_xml_tag,
|
@@ -489,6 +490,27 @@ class AnthropicClient(LLMClientBase):
|
|
489
490
|
)
|
490
491
|
|
491
492
|
return chat_completion_response
|
493
|
+
def _add_cache_control_to_system_message(self, system_content):
|
494
|
+
"""Add cache control to system message content"""
|
495
|
+
if isinstance(system_content, str):
|
496
|
+
# For string content, convert to list format with cache control
|
497
|
+
return [
|
498
|
+
{
|
499
|
+
'type': 'text',
|
500
|
+
'text': system_content,
|
501
|
+
'cache_control': {'type': 'ephemeral'}
|
502
|
+
}
|
503
|
+
]
|
504
|
+
elif isinstance(system_content, list):
|
505
|
+
# For list content, add cache control to the last text block
|
506
|
+
cached_content = system_content.copy()
|
507
|
+
for i in range(len(cached_content) - 1, -1, -1):
|
508
|
+
if cached_content[i].get('type') == 'text':
|
509
|
+
cached_content[i]['cache_control'] = {'type': 'ephemeral'}
|
510
|
+
break
|
511
|
+
return cached_content
|
512
|
+
|
513
|
+
return system_content
|
492
514
|
|
493
515
|
|
494
516
|
def convert_tools_to_anthropic_format(tools: List[OpenAITool]) -> List[dict]:
|
@@ -77,7 +77,7 @@ letta/jobs/scheduler.py,sha256=VpRyO2vuETNrarHOIWYctAkrD4WFtV57buUSHaLE89Y,10240
|
|
77
77
|
letta/jobs/types.py,sha256=K8GKEnqEgAT6Kq4F2hUrBC4ZAFM9OkfOjVMStzxKuXQ,742
|
78
78
|
letta/llm_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
79
79
|
letta/llm_api/anthropic.py,sha256=uR_nHffOl1KWHTos_7Pz36h1xFckCyhWVC7bEJ3isDk,47286
|
80
|
-
letta/llm_api/anthropic_client.py,sha256=
|
80
|
+
letta/llm_api/anthropic_client.py,sha256=Wiv4QFFP16fvOWbk4b-smZ9Zy0eFQhJPUEsEtgV1amY,28558
|
81
81
|
letta/llm_api/aws_bedrock.py,sha256=kAPpKPRe4ZUa6fkxFbo8xwQgq4fJf3QoZEAP1LOCfaw,4168
|
82
82
|
letta/llm_api/azure_openai.py,sha256=YAkXwKyfnJFNhB45pkJVFsoxUNB_M74rQYchtw_CN6I,5099
|
83
83
|
letta/llm_api/azure_openai_constants.py,sha256=ZaR2IasJThijG0uhLKJThrixdAxLPD2IojfeaJ-KQMQ,294
|
@@ -399,8 +399,8 @@ letta/templates/sandbox_code_file.py.j2,sha256=zgzaboDZVtM15XkxILnhiKisF7DSUoI2Y
|
|
399
399
|
letta/templates/template_helper.py,sha256=uHWO1PukgMoIIvgqQdPyHq3o3CQ6mcjUjTGvx9VLGkk,409
|
400
400
|
letta/types/__init__.py,sha256=hokKjCVFGEfR7SLMrtZsRsBfsC7yTIbgKPLdGg4K1eY,147
|
401
401
|
letta/utils.py,sha256=ZfyAcRBITlYs2XM5fHj_Lp08fPFMBMaQSPbfYlETbDs,33198
|
402
|
-
letta_nightly-0.8.4.
|
403
|
-
letta_nightly-0.8.4.
|
404
|
-
letta_nightly-0.8.4.
|
405
|
-
letta_nightly-0.8.4.
|
406
|
-
letta_nightly-0.8.4.
|
402
|
+
letta_nightly-0.8.4.dev20250619104255.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
|
403
|
+
letta_nightly-0.8.4.dev20250619104255.dist-info/METADATA,sha256=Y1C0Pt1U3xatyvPHNPM4SjK7z3J6oM6hg3Q5iAX30zA,22745
|
404
|
+
letta_nightly-0.8.4.dev20250619104255.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
405
|
+
letta_nightly-0.8.4.dev20250619104255.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
|
406
|
+
letta_nightly-0.8.4.dev20250619104255.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|