letta-nightly 0.6.51.dev20250411211126__py3-none-any.whl → 0.6.52.dev20250412104020__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 CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.6.51"
1
+ __version__ = "0.6.52"
2
2
 
3
3
  # import clients
4
4
  from letta.client.client import LocalClient, RESTClient, create_client
@@ -318,17 +318,16 @@ class GoogleAIClient(LLMClientBase):
318
318
  for t in tools
319
319
  ]
320
320
 
321
- # Correct casing + add inner thoughts if needed
321
+ # Add inner thoughts if needed
322
322
  for func in function_list:
323
- func["parameters"]["type"] = "OBJECT"
324
- for param_name, param_fields in func["parameters"]["properties"].items():
325
- param_fields["type"] = param_fields["type"].upper()
323
+ # Note: Google AI API used to have weird casing requirements, but not any more
324
+
326
325
  # Add inner thoughts
327
326
  if self.llm_config.put_inner_thoughts_in_kwargs:
328
327
  from letta.local_llm.constants import INNER_THOUGHTS_KWARG, INNER_THOUGHTS_KWARG_DESCRIPTION
329
328
 
330
329
  func["parameters"]["properties"][INNER_THOUGHTS_KWARG] = {
331
- "type": "STRING",
330
+ "type": "string",
332
331
  "description": INNER_THOUGHTS_KWARG_DESCRIPTION,
333
332
  }
334
333
  func["parameters"]["required"].append(INNER_THOUGHTS_KWARG)
@@ -66,8 +66,14 @@ class OpenAIClient(LLMClientBase):
66
66
  put_inner_thoughts_first=True,
67
67
  )
68
68
 
69
+ use_developer_message = llm_config.model.startswith("o1") or llm_config.model.startswith("o3") # o-series models
69
70
  openai_message_list = [
70
- cast_message_to_subtype(m.to_openai_dict(put_inner_thoughts_in_kwargs=llm_config.put_inner_thoughts_in_kwargs))
71
+ cast_message_to_subtype(
72
+ m.to_openai_dict(
73
+ put_inner_thoughts_in_kwargs=llm_config.put_inner_thoughts_in_kwargs,
74
+ use_developer_message=use_developer_message,
75
+ )
76
+ )
71
77
  for m in messages
72
78
  ]
73
79
 
letta/schemas/message.py CHANGED
@@ -598,6 +598,7 @@ class Message(BaseMessage):
598
598
  self,
599
599
  max_tool_id_length: int = TOOL_CALL_ID_MAX_LEN,
600
600
  put_inner_thoughts_in_kwargs: bool = False,
601
+ use_developer_message: bool = False,
601
602
  ) -> dict:
602
603
  """Go from Message class to ChatCompletion message object"""
603
604
 
@@ -625,7 +626,7 @@ class Message(BaseMessage):
625
626
  assert all([v is not None for v in [self.role]]), vars(self)
626
627
  openai_message = {
627
628
  "content": text_content,
628
- "role": self.role,
629
+ "role": "developer" if use_developer_message else self.role,
629
630
  }
630
631
 
631
632
  elif self.role == "user":
@@ -1,14 +1,15 @@
1
1
  import json
2
2
  import traceback
3
3
  from datetime import datetime
4
- from typing import Annotated, List, Optional
4
+ from typing import Annotated, Any, List, Optional
5
5
 
6
6
  from fastapi import APIRouter, BackgroundTasks, Body, Depends, File, Header, HTTPException, Query, UploadFile, status
7
7
  from fastapi.responses import JSONResponse
8
8
  from marshmallow import ValidationError
9
+ from orjson import orjson
9
10
  from pydantic import Field
10
11
  from sqlalchemy.exc import IntegrityError, OperationalError
11
- from starlette.responses import StreamingResponse
12
+ from starlette.responses import Response, StreamingResponse
12
13
 
13
14
  from letta.agents.letta_agent import LettaAgent
14
15
  from letta.constants import DEFAULT_MESSAGE_TOOL, DEFAULT_MESSAGE_TOOL_KWARG
@@ -102,7 +103,14 @@ def list_agents(
102
103
  )
103
104
 
104
105
 
105
- @router.get("/{agent_id}/export", operation_id="export_agent_serialized")
106
+ class IndentedORJSONResponse(Response):
107
+ media_type = "application/json"
108
+
109
+ def render(self, content: Any) -> bytes:
110
+ return orjson.dumps(content, option=orjson.OPT_INDENT_2)
111
+
112
+
113
+ @router.get("/{agent_id}/export", response_class=IndentedORJSONResponse, operation_id="export_agent_serialized")
106
114
  def export_agent_serialized(
107
115
  agent_id: str,
108
116
  server: "SyncServer" = Depends(get_letta_server),
@@ -118,9 +126,7 @@ def export_agent_serialized(
118
126
 
119
127
  try:
120
128
  agent = server.agent_manager.serialize(agent_id=agent_id, actor=actor)
121
- # Convert to JSON with 2-space indentation
122
- content = agent.model_dump_json(indent=2)
123
- return JSONResponse(content=content, media_type="application/json")
129
+ return agent.model_dump()
124
130
  except NoResultFound:
125
131
  raise HTTPException(status_code=404, detail=f"Agent with id={agent_id} not found for user_id={actor.id}.")
126
132
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-nightly
3
- Version: 0.6.51.dev20250411211126
3
+ Version: 0.6.52.dev20250412104020
4
4
  Summary: Create LLM agents with long-term memory and custom tools
5
5
  License: Apache License
6
6
  Author: Letta Team
@@ -255,7 +255,7 @@ No, the data in your Letta server database stays on your machine. The Letta ADE
255
255
 
256
256
  > _"Do I have to use your ADE? Can I build my own?"_
257
257
 
258
- The ADE is built on top of the (fully open source) Letta server and Letta Agents API. You can build your own application like the ADE on top of the REST API (view the documention [here](https://docs.letta.com/api-reference)).
258
+ The ADE is built on top of the (fully open source) Letta server and Letta Agents API. You can build your own application like the ADE on top of the REST API (view the documentation [here](https://docs.letta.com/api-reference)).
259
259
 
260
260
  > _"Can I interact with Letta agents via the CLI?"_
261
261
 
@@ -1,4 +1,4 @@
1
- letta/__init__.py,sha256=SMiwob1Zxn_whxPmRDFNZ8tzrCPLzaTuJn3tIEX_4Cw,918
1
+ letta/__init__.py,sha256=YNv_R4fVl8VwT-cs795_lg9nThhtS3sVogPd9BfMXBI,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
@@ -73,7 +73,7 @@ letta/llm_api/azure_openai.py,sha256=YAkXwKyfnJFNhB45pkJVFsoxUNB_M74rQYchtw_CN6I
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=CXTxQWF7Up1gdP-ZyYdbwAxe-s5qwTfPpe9mpP8uCHA,20546
76
+ letta/llm_api/google_ai_client.py,sha256=cXuwUE8Zt6f82PdHRWdbOq9MIGzQPBuRsx70b7SRm5c,20417
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
@@ -82,7 +82,7 @@ letta/llm_api/llm_client.py,sha256=PWnzdwD_7TMmbBuZnCWt10pJL4WXLCsQ3yS9-Y3Nh-c,2
82
82
  letta/llm_api/llm_client_base.py,sha256=ea4YyfZQqmkm6IcG7U3nu86VX820eXbX9gWuw5hDdzg,5766
83
83
  letta/llm_api/mistral.py,sha256=fHdfD9ug-rQIk2qn8tRKay1U6w9maF11ryhKi91FfXM,1593
84
84
  letta/llm_api/openai.py,sha256=fF6qf1t2DrkmJkoZuWE6Gbb6Yquw5hpMrEet1v9YP0Q,22979
85
- letta/llm_api/openai_client.py,sha256=UJQk59VN-wlKvIfVbOjh4M8V1lbYCxICN6Al8rnooY0,11720
85
+ letta/llm_api/openai_client.py,sha256=J4jTHIdtLGQXD2ChYp_Vn3YcOuNIXGwf2CHxk4-PNZo,11976
86
86
  letta/local_llm/README.md,sha256=hFJyw5B0TU2jrh9nb0zGZMgdH-Ei1dSRfhvPQG_NSoU,168
87
87
  letta/local_llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
88
  letta/local_llm/chat_completion_proxy.py,sha256=k8_8kIKglMSXnthIdc4TnR3ACJVQsk6MHJY_Y3lM6B0,13845
@@ -211,7 +211,7 @@ letta/schemas/llm_batch_job.py,sha256=q5TCUPsvro1R_02XyNdsJDvKizL-H9ioAbev-2LgoG
211
211
  letta/schemas/llm_config.py,sha256=6UhTkL5adLWOzC-V7GsTP7c4pStJk3b2qnoaIKGnqo0,7059
212
212
  letta/schemas/llm_config_overrides.py,sha256=-oRglCTcajF6UAK3RAa0FLWVuKODPI1v403fDIWMAtA,1815
213
213
  letta/schemas/memory.py,sha256=GOYDfPKzbWftUWO9Hv4KW7xAi1EIQmC8zpP7qvEkVHw,10245
214
- letta/schemas/message.py,sha256=rduTFO8poky5DC1LEKvdSR6xYMruyeyUFw8UJTmoOlU,47751
214
+ letta/schemas/message.py,sha256=KOpfUqE8qljhqDVPifcTv5kfTRj5iAy2ZxLf0GNyha0,47838
215
215
  letta/schemas/openai/chat_completion_request.py,sha256=B07JpvTAuu_mFtKwXmP9_8w7co1a24lha5cMd8JHocE,4139
216
216
  letta/schemas/openai/chat_completion_response.py,sha256=yoepGZkg5PIobGqvATJruPdV4odpIUDHWniodSQo3PY,4433
217
217
  letta/schemas/openai/chat_completions.py,sha256=l0e9sT9boTD5VBU5YtJ0s7qUtCfFGB2K-gQLeEZ2LHU,3599
@@ -254,7 +254,7 @@ letta/server/rest_api/routers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
254
254
  letta/server/rest_api/routers/openai/chat_completions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
255
255
  letta/server/rest_api/routers/openai/chat_completions/chat_completions.py,sha256=OgjWs4zJaIi5Ps67iCTeOLmLXcW0S5Xccd-TcNa9obQ,5321
256
256
  letta/server/rest_api/routers/v1/__init__.py,sha256=AV_uopcsNQIK-paX-9X23dNmLMUDDe_fgLTfeNyjWk8,1456
257
- letta/server/rest_api/routers/v1/agents.py,sha256=gsHWH233EdsGvVKmRwOh4Y7eStz35TpRjfzELi0Hqw8,32781
257
+ letta/server/rest_api/routers/v1/agents.py,sha256=7S698GHon4XJJyeCZut1ljHrHeDugcWTiBDturYndyA,32907
258
258
  letta/server/rest_api/routers/v1/blocks.py,sha256=Sefvon0jLvlNh0oAzntUcDZptnutuJOf-2Wcad_45Dg,4169
259
259
  letta/server/rest_api/routers/v1/groups.py,sha256=a17167-w1kowdwrJxd-kM9J0T3bHEezTjOsxz0sbqjs,10878
260
260
  letta/server/rest_api/routers/v1/health.py,sha256=MoOjkydhGcJXTiuJrKIB0etVXiRMdTa51S8RQ8-50DQ,399
@@ -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.51.dev20250411211126.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
327
- letta_nightly-0.6.51.dev20250411211126.dist-info/METADATA,sha256=jXA2Br4yDlpPOnAwF5GVn8COIAIWBwEvgE888og19mE,22902
328
- letta_nightly-0.6.51.dev20250411211126.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
329
- letta_nightly-0.6.51.dev20250411211126.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
330
- letta_nightly-0.6.51.dev20250411211126.dist-info/RECORD,,
326
+ letta_nightly-0.6.52.dev20250412104020.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
327
+ letta_nightly-0.6.52.dev20250412104020.dist-info/METADATA,sha256=MU3pNP5x2WrbWFN761NNijhz86YhWCAg42vpKzTSZO8,22904
328
+ letta_nightly-0.6.52.dev20250412104020.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
329
+ letta_nightly-0.6.52.dev20250412104020.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
330
+ letta_nightly-0.6.52.dev20250412104020.dist-info/RECORD,,