letta-nightly 0.6.52.dev20250412104020__py3-none-any.whl → 0.6.53.dev20250413104111__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/__init__.py +1 -1
- letta/llm_api/anthropic_client.py +4 -0
- letta/llm_api/google_ai_client.py +39 -0
- letta/orm/message.py +4 -0
- {letta_nightly-0.6.52.dev20250412104020.dist-info → letta_nightly-0.6.53.dev20250413104111.dist-info}/METADATA +1 -1
- {letta_nightly-0.6.52.dev20250412104020.dist-info → letta_nightly-0.6.53.dev20250413104111.dist-info}/RECORD +9 -9
- {letta_nightly-0.6.52.dev20250412104020.dist-info → letta_nightly-0.6.53.dev20250413104111.dist-info}/LICENSE +0 -0
- {letta_nightly-0.6.52.dev20250412104020.dist-info → letta_nightly-0.6.53.dev20250413104111.dist-info}/WHEEL +0 -0
- {letta_nightly-0.6.52.dev20250412104020.dist-info → letta_nightly-0.6.53.dev20250413104111.dist-info}/entry_points.txt +0 -0
letta/__init__.py
CHANGED
@@ -159,6 +159,10 @@ class AnthropicClient(LLMClientBase):
|
|
159
159
|
# Special case for summarization path
|
160
160
|
tools_for_request = None
|
161
161
|
tool_choice = None
|
162
|
+
elif llm_config.enable_reasoner:
|
163
|
+
# NOTE: reasoning models currently do not allow for `any`
|
164
|
+
tool_choice = {"type": "auto", "disable_parallel_tool_use": True}
|
165
|
+
tools_for_request = [Tool(function=f) for f in tools]
|
162
166
|
elif force_tool_call is not None:
|
163
167
|
tool_choice = {"type": "tool", "name": force_tool_call}
|
164
168
|
tools_for_request = [Tool(function=f) for f in tools if f["name"] == force_tool_call]
|
@@ -263,6 +263,41 @@ class GoogleAIClient(LLMClientBase):
|
|
263
263
|
except KeyError as e:
|
264
264
|
raise e
|
265
265
|
|
266
|
+
def _clean_google_ai_schema_properties(self, schema_part: dict):
|
267
|
+
"""Recursively clean schema parts to remove unsupported Google AI keywords."""
|
268
|
+
if not isinstance(schema_part, dict):
|
269
|
+
return
|
270
|
+
|
271
|
+
# Per https://ai.google.dev/gemini-api/docs/function-calling?example=meeting#notes_and_limitations
|
272
|
+
# * Only a subset of the OpenAPI schema is supported.
|
273
|
+
# * Supported parameter types in Python are limited.
|
274
|
+
unsupported_keys = ["default", "exclusiveMaximum", "exclusiveMinimum"]
|
275
|
+
keys_to_remove_at_this_level = [key for key in unsupported_keys if key in schema_part]
|
276
|
+
for key_to_remove in keys_to_remove_at_this_level:
|
277
|
+
logger.warning(f"Removing unsupported keyword '{key_to_remove}' from schema part.")
|
278
|
+
del schema_part[key_to_remove]
|
279
|
+
|
280
|
+
if schema_part.get("type") == "string" and "format" in schema_part:
|
281
|
+
allowed_formats = ["enum", "date-time"]
|
282
|
+
if schema_part["format"] not in allowed_formats:
|
283
|
+
logger.warning(f"Removing unsupported format '{schema_part['format']}' for string type. Allowed: {allowed_formats}")
|
284
|
+
del schema_part["format"]
|
285
|
+
|
286
|
+
# Check properties within the current level
|
287
|
+
if "properties" in schema_part and isinstance(schema_part["properties"], dict):
|
288
|
+
for prop_name, prop_schema in schema_part["properties"].items():
|
289
|
+
self._clean_google_ai_schema_properties(prop_schema)
|
290
|
+
|
291
|
+
# Check items within arrays
|
292
|
+
if "items" in schema_part and isinstance(schema_part["items"], dict):
|
293
|
+
self._clean_google_ai_schema_properties(schema_part["items"])
|
294
|
+
|
295
|
+
# Check within anyOf, allOf, oneOf lists
|
296
|
+
for key in ["anyOf", "allOf", "oneOf"]:
|
297
|
+
if key in schema_part and isinstance(schema_part[key], list):
|
298
|
+
for item_schema in schema_part[key]:
|
299
|
+
self._clean_google_ai_schema_properties(item_schema)
|
300
|
+
|
266
301
|
def convert_tools_to_google_ai_format(self, tools: List[Tool]) -> List[dict]:
|
267
302
|
"""
|
268
303
|
OpenAI style:
|
@@ -322,6 +357,10 @@ class GoogleAIClient(LLMClientBase):
|
|
322
357
|
for func in function_list:
|
323
358
|
# Note: Google AI API used to have weird casing requirements, but not any more
|
324
359
|
|
360
|
+
# Google AI API only supports a subset of OpenAPI 3.0, so unsupported params must be cleaned
|
361
|
+
if "parameters" in func and isinstance(func["parameters"], dict):
|
362
|
+
self._clean_google_ai_schema_properties(func["parameters"])
|
363
|
+
|
325
364
|
# Add inner thoughts
|
326
365
|
if self.llm_config.put_inner_thoughts_in_kwargs:
|
327
366
|
from letta.local_llm.constants import INNER_THOUGHTS_KWARG, INNER_THOUGHTS_KWARG_DESCRIPTION
|
letta/orm/message.py
CHANGED
@@ -65,8 +65,12 @@ class Message(SqlalchemyBase, OrganizationMixin, AgentMixin):
|
|
65
65
|
model = self.__pydantic_model__.model_validate(self)
|
66
66
|
if self.text and not model.content:
|
67
67
|
model.content = [PydanticTextContent(text=self.text)]
|
68
|
+
# If there are no tool calls, set tool_calls to None
|
69
|
+
if len(self.tool_calls) == 0:
|
70
|
+
model.tool_calls = None
|
68
71
|
return model
|
69
72
|
|
73
|
+
|
70
74
|
# listener
|
71
75
|
|
72
76
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
letta/__init__.py,sha256=
|
1
|
+
letta/__init__.py,sha256=_RbN4dAizhBxh_BxZ7YPbnzL8oZS63r7o0js0C9Hdh8,918
|
2
2
|
letta/__main__.py,sha256=6Hs2PV7EYc5Tid4g4OtcLXhqVHiNYTGzSBdoOnW2HXA,29
|
3
3
|
letta/agent.py,sha256=bYwLPJKHiVi-qkq2B_MW66YT0cN7LZJyOvyBPPVe1YI,71193
|
4
4
|
letta/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -67,13 +67,13 @@ letta/jobs/scheduler.py,sha256=mbp7c8MDSv3YMQM_vffR_e5RGrW2kRhfQ6IJvOKohGw,966
|
|
67
67
|
letta/jobs/types.py,sha256=XD79TBZ3JGzP75Dg5FygfFdRUGaXLcYWWvKsMGf5QFQ,366
|
68
68
|
letta/llm_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
69
69
|
letta/llm_api/anthropic.py,sha256=IOpIqC0wWFRwemzpN0rxauaYzri-HFR27siw8DmHZVQ,44362
|
70
|
-
letta/llm_api/anthropic_client.py,sha256=
|
70
|
+
letta/llm_api/anthropic_client.py,sha256=VmTnCCtrRTAYEusLr5S9OhyRDZmYYGDSGKNkO_k0YpQ,24221
|
71
71
|
letta/llm_api/aws_bedrock.py,sha256=kAPpKPRe4ZUa6fkxFbo8xwQgq4fJf3QoZEAP1LOCfaw,4168
|
72
72
|
letta/llm_api/azure_openai.py,sha256=YAkXwKyfnJFNhB45pkJVFsoxUNB_M74rQYchtw_CN6I,5099
|
73
73
|
letta/llm_api/azure_openai_constants.py,sha256=ZaR2IasJThijG0uhLKJThrixdAxLPD2IojfeaJ-KQMQ,294
|
74
74
|
letta/llm_api/cohere.py,sha256=7Be_t5jt5EtWX8UUScJkX-IF9SpiZw9cDEcRC6PaxUM,14841
|
75
75
|
letta/llm_api/deepseek.py,sha256=b1mSW8gnBrpAI8d2GcBpDyLYDnuC-P1UP6xJPalfQS4,12456
|
76
|
-
letta/llm_api/google_ai_client.py,sha256=
|
76
|
+
letta/llm_api/google_ai_client.py,sha256=mzp06rYcfP1UHPLvFbHuwvcs7NgPncZFMY6VIcrkA1U,22643
|
77
77
|
letta/llm_api/google_constants.py,sha256=1dqwt-YwdYGnAHV5rIPfGHfE3ybPzSn_48vlNYfd-bk,588
|
78
78
|
letta/llm_api/google_vertex_client.py,sha256=hDj0pthZrht-dsdzyE6vZYBuSzyiLazSdcgpI76lEqg,11144
|
79
79
|
letta/llm_api/helpers.py,sha256=sLYv30UnKBRVPuhU_KDXfKFdbkUONiDAyVEwGr86l3A,16780
|
@@ -147,7 +147,7 @@ letta/orm/job.py,sha256=G2P-xUpTapD4lhU2FwMZET1b5QR4ju9WOB3uiTKD_mw,2157
|
|
147
147
|
letta/orm/job_messages.py,sha256=SgwaYPYwwAC3dBtl9Xye_TWUl9H_-m95S95TTcfPyOg,1245
|
148
148
|
letta/orm/llm_batch_items.py,sha256=PrJtT1-bbZXXGK0LvFYV30bIhcOovQ69O0cqLt_Kwds,2744
|
149
149
|
letta/orm/llm_batch_job.py,sha256=s7kXwri_SxNfRmkm-ZHGvr0nW2j4pnZlOOu5GZ94B9g,2209
|
150
|
-
letta/orm/message.py,sha256=
|
150
|
+
letta/orm/message.py,sha256=VLFA0AEd63lXgHIUqhrRzm_OuW8_FyhXVzEY5RtSioM,4544
|
151
151
|
letta/orm/mixins.py,sha256=9c79Kfr-Z1hL-SDYKeoptx_yMTbBwJJBo9nrKEzSDAc,1622
|
152
152
|
letta/orm/organization.py,sha256=STQ5x5zXoPhfagiRQX6j2lWgOqwznPp-K019MPjbY0s,3599
|
153
153
|
letta/orm/passage.py,sha256=tQi-fZZFBFVz0KZxd0foKPkAOaempgiYOHHK6lJ98gw,3332
|
@@ -323,8 +323,8 @@ letta/streaming_utils.py,sha256=jLqFTVhUL76FeOuYk8TaRQHmPTf3HSRc2EoJwxJNK6U,1194
|
|
323
323
|
letta/system.py,sha256=dnOrS2FlRMwijQnOvfrky0Lg8wEw-FUq2zzfAJOUSKA,8477
|
324
324
|
letta/tracing.py,sha256=RstWXpfWVF77nmb_ISORVWd9IQw2Ky3de40k_S70yKI,8258
|
325
325
|
letta/utils.py,sha256=IZFvtj9WYcrxUbkoUUYGDxMYQYdn5SgfqsvnARGsAzc,32245
|
326
|
-
letta_nightly-0.6.
|
327
|
-
letta_nightly-0.6.
|
328
|
-
letta_nightly-0.6.
|
329
|
-
letta_nightly-0.6.
|
330
|
-
letta_nightly-0.6.
|
326
|
+
letta_nightly-0.6.53.dev20250413104111.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
|
327
|
+
letta_nightly-0.6.53.dev20250413104111.dist-info/METADATA,sha256=u0hzhLPZpdwEcsZwJUGvNQAXQIeXcbuKUlmWaJNO4jA,22904
|
328
|
+
letta_nightly-0.6.53.dev20250413104111.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
329
|
+
letta_nightly-0.6.53.dev20250413104111.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
|
330
|
+
letta_nightly-0.6.53.dev20250413104111.dist-info/RECORD,,
|
File without changes
|
File without changes
|