letta-nightly 0.6.1.dev20241206104246__py3-none-any.whl → 0.6.1.dev20241207104149__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.
Potentially problematic release.
This version of letta-nightly might be problematic. Click here for more details.
- letta/agent.py +54 -37
- letta/agent_store/db.py +1 -77
- letta/agent_store/storage.py +0 -5
- letta/cli/cli.py +0 -1
- letta/client/client.py +3 -7
- letta/constants.py +1 -0
- letta/functions/function_sets/base.py +33 -5
- letta/main.py +2 -2
- letta/memory.py +4 -82
- letta/metadata.py +0 -35
- letta/o1_agent.py +7 -2
- letta/offline_memory_agent.py +6 -0
- letta/orm/__init__.py +2 -0
- letta/orm/file.py +1 -1
- letta/orm/message.py +66 -0
- letta/orm/mixins.py +16 -0
- letta/orm/organization.py +1 -0
- letta/orm/sqlalchemy_base.py +118 -26
- letta/schemas/letta_base.py +7 -6
- letta/schemas/message.py +1 -7
- letta/server/rest_api/routers/v1/agents.py +2 -2
- letta/server/rest_api/routers/v1/blocks.py +2 -2
- letta/server/server.py +52 -50
- letta/server/static_files/assets/index-43ab4d62.css +1 -0
- letta/server/static_files/assets/index-4848e3d7.js +40 -0
- letta/server/static_files/index.html +2 -2
- letta/services/block_manager.py +1 -1
- letta/services/message_manager.py +182 -0
- letta/services/organization_manager.py +6 -9
- letta/services/source_manager.py +1 -1
- letta/services/tool_manager.py +1 -1
- letta/services/user_manager.py +1 -1
- {letta_nightly-0.6.1.dev20241206104246.dist-info → letta_nightly-0.6.1.dev20241207104149.dist-info}/METADATA +1 -1
- {letta_nightly-0.6.1.dev20241206104246.dist-info → letta_nightly-0.6.1.dev20241207104149.dist-info}/RECORD +37 -37
- letta/agent_store/lancedb.py +0 -177
- letta/persistence_manager.py +0 -149
- letta/server/static_files/assets/index-1b5d1a41.js +0 -271
- letta/server/static_files/assets/index-56a3f8c6.css +0 -1
- {letta_nightly-0.6.1.dev20241206104246.dist-info → letta_nightly-0.6.1.dev20241207104149.dist-info}/LICENSE +0 -0
- {letta_nightly-0.6.1.dev20241206104246.dist-info → letta_nightly-0.6.1.dev20241207104149.dist-info}/WHEEL +0 -0
- {letta_nightly-0.6.1.dev20241206104246.dist-info → letta_nightly-0.6.1.dev20241207104149.dist-info}/entry_points.txt +0 -0
|
@@ -30,19 +30,16 @@ class OrganizationManager:
|
|
|
30
30
|
def get_organization_by_id(self, org_id: str) -> Optional[PydanticOrganization]:
|
|
31
31
|
"""Fetch an organization by ID."""
|
|
32
32
|
with self.session_maker() as session:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return organization.to_pydantic()
|
|
36
|
-
except NoResultFound:
|
|
37
|
-
return None
|
|
33
|
+
organization = OrganizationModel.read(db_session=session, identifier=org_id)
|
|
34
|
+
return organization.to_pydantic()
|
|
38
35
|
|
|
39
36
|
@enforce_types
|
|
40
37
|
def create_organization(self, pydantic_org: PydanticOrganization) -> PydanticOrganization:
|
|
41
|
-
"""Create a new organization.
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
"""Create a new organization."""
|
|
39
|
+
try:
|
|
40
|
+
org = self.get_organization_by_id(pydantic_org.id)
|
|
44
41
|
return org
|
|
45
|
-
|
|
42
|
+
except NoResultFound:
|
|
46
43
|
return self._create_organization(pydantic_org=pydantic_org)
|
|
47
44
|
|
|
48
45
|
@enforce_types
|
letta/services/source_manager.py
CHANGED
|
@@ -141,5 +141,5 @@ class SourceManager:
|
|
|
141
141
|
"""Delete a file by its ID."""
|
|
142
142
|
with self.session_maker() as session:
|
|
143
143
|
file = FileMetadataModel.read(db_session=session, identifier=file_id)
|
|
144
|
-
file.
|
|
144
|
+
file.hard_delete(db_session=session, actor=actor)
|
|
145
145
|
return file.to_pydantic()
|
letta/services/tool_manager.py
CHANGED
|
@@ -122,7 +122,7 @@ class ToolManager:
|
|
|
122
122
|
tool.json_schema = new_schema
|
|
123
123
|
|
|
124
124
|
# Save the updated tool to the database
|
|
125
|
-
return tool.update(db_session=session, actor=actor)
|
|
125
|
+
return tool.update(db_session=session, actor=actor).to_pydantic()
|
|
126
126
|
|
|
127
127
|
@enforce_types
|
|
128
128
|
def delete_tool_by_id(self, tool_id: str, actor: PydanticUser) -> None:
|
letta/services/user_manager.py
CHANGED
|
@@ -71,7 +71,7 @@ class UserManager:
|
|
|
71
71
|
with self.session_maker() as session:
|
|
72
72
|
# Delete from user table
|
|
73
73
|
user = UserModel.read(db_session=session, identifier=user_id)
|
|
74
|
-
user.
|
|
74
|
+
user.hard_delete(session)
|
|
75
75
|
|
|
76
76
|
# TODO: Integrate this via the ORM models for the Agent, Source, and AgentSourceMapping
|
|
77
77
|
# Cascade delete for related models: Agent, Source, AgentSourceMapping
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
letta/__init__.py,sha256=1hJidwYqfS-iX2V3ZLC2ulm-PYX74k2EMIyzC4Z0pWc,1035
|
|
2
2
|
letta/__main__.py,sha256=6Hs2PV7EYc5Tid4g4OtcLXhqVHiNYTGzSBdoOnW2HXA,29
|
|
3
|
-
letta/agent.py,sha256=
|
|
3
|
+
letta/agent.py,sha256=Kr55vl085tf-FvSWBPD-1SZmOn2xaCd_tLtoV8SvDuU,79198
|
|
4
4
|
letta/agent_store/chroma.py,sha256=-kCEMBFKmqCyFeIETYf7RN-khGddsip2FAhSzNqaC7U,12537
|
|
5
|
-
letta/agent_store/db.py,sha256=
|
|
6
|
-
letta/agent_store/lancedb.py,sha256=i63d4VZwj9UIOTNs5f0JZ_r5yZD-jKWz4FAH4RMpXOE,5104
|
|
5
|
+
letta/agent_store/db.py,sha256=0AdN1-LpvIUhmiayTwzhKPaXTdlyOILtHGZ7zmS7pPs,20314
|
|
7
6
|
letta/agent_store/milvus.py,sha256=xUu-D9a6N10MuGJ-R-QWR2IHX77ueqAp88tV4gg9B4M,8470
|
|
8
7
|
letta/agent_store/qdrant.py,sha256=6_33V-FEDpT9LG5zmr6-3y9slw1YFLswxpahiyMkvHA,7880
|
|
9
|
-
letta/agent_store/storage.py,sha256=
|
|
8
|
+
letta/agent_store/storage.py,sha256=YDQTrfgPBa0cMiMuQatk9hcadIUMvA4zKZHx2VKjlak,6475
|
|
10
9
|
letta/benchmark/benchmark.py,sha256=ebvnwfp3yezaXOQyGXkYCDYpsmre-b9hvNtnyx4xkG0,3701
|
|
11
10
|
letta/benchmark/constants.py,sha256=aXc5gdpMGJT327VuxsT5FngbCK2J41PQYeICBO7g_RE,536
|
|
12
11
|
letta/chat_only_agent.py,sha256=606FQybmeN9s04rIFQlDkWOHirrT0p48_3pMKY8d5Ts,4740
|
|
13
|
-
letta/cli/cli.py,sha256=
|
|
12
|
+
letta/cli/cli.py,sha256=7DI6fHLCTgotP4jr6x4D07EaOjayi1vH-SZj9KiCOQQ,16834
|
|
14
13
|
letta/cli/cli_config.py,sha256=tB0Wgz3O9j6KiCsU1HWfsKmhNM9RqLsAxzxEDFQFGnM,8565
|
|
15
14
|
letta/cli/cli_load.py,sha256=x4L8s15GwIW13xrhKYFWHo_y-IVGtoPDHWWKcHDRP10,4587
|
|
16
15
|
letta/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
letta/client/client.py,sha256=
|
|
16
|
+
letta/client/client.py,sha256=Oetmz1FwIs0n9bCRmzlPqxIjQK3zKrraQ2t3gq_pNg4,124015
|
|
18
17
|
letta/client/streaming.py,sha256=Hh5pjlyrdCuO2V75ZCxSSOCPd3BmHdKFGaIUJC6fBp0,4775
|
|
19
18
|
letta/client/utils.py,sha256=OJlAKWrldc4I6M1WpcTWNtPJ4wfxlzlZqWLfCozkFtI,2872
|
|
20
19
|
letta/config.py,sha256=AF4XY6grcu87OLjrWXh1ufnyKWsCL0qER-_9jQCAlU0,18947
|
|
21
|
-
letta/constants.py,sha256=
|
|
20
|
+
letta/constants.py,sha256=l2IyZpVG-d_raFFX5bN6mCbprnnc1IA-z-oCKPoyPSM,6902
|
|
22
21
|
letta/credentials.py,sha256=D9mlcPsdDWlIIXQQD8wSPE9M_QvsRrb0p3LB5i9OF5Q,5806
|
|
23
22
|
letta/data_sources/connectors.py,sha256=5VKxfeV-QyUlK1wexLlpgar99dGm6PHxFaEbSeByo_U,9923
|
|
24
23
|
letta/data_sources/connectors_helper.py,sha256=2TQjCt74fCgT5sw1AP8PalDEk06jPBbhrPG4HVr-WLs,3371
|
|
25
24
|
letta/embeddings.py,sha256=3vJaQ8RMLLp6yiYZGsthq6Xsu4keb9gp7DYN_2GPBFU,8459
|
|
26
25
|
letta/errors.py,sha256=mFeTpZP37otDMr68s9hyGOnafJPrWeblQOI79cgP4nQ,3209
|
|
27
26
|
letta/functions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
-
letta/functions/function_sets/base.py,sha256=
|
|
27
|
+
letta/functions/function_sets/base.py,sha256=anK6XJQlmTu9eC33700Eh7NWxQ0NTLUC2Vxpn6ihvnY,9034
|
|
29
28
|
letta/functions/function_sets/extras.py,sha256=Jik3UiDqYTm4Lam1XPTvuVjvgUHwIAhopsnbmVhGMBg,4732
|
|
30
29
|
letta/functions/functions.py,sha256=evH6GKnIJwVVre1Xre2gaSIqREv4eNM4DiWOhn8PMqg,3299
|
|
31
30
|
letta/functions/helpers.py,sha256=K84kqAN1RXZIhjb7-btS0C2p-SInYNv6FvSfo-16Y6g,8578
|
|
@@ -84,32 +83,32 @@ letta/local_llm/webui/legacy_api.py,sha256=k3H3y4qp2Fs-XmP24iSIEyvq6wjWFWBzklY3-
|
|
|
84
83
|
letta/local_llm/webui/legacy_settings.py,sha256=BLmd3TSx5StnY3ibjwaxYATPt_Lvq-o1rlcc_-Q1JcU,538
|
|
85
84
|
letta/local_llm/webui/settings.py,sha256=gmLHfiOl1u4JmlAZU2d2O8YKF9lafdakyjwR_ftVPh8,552
|
|
86
85
|
letta/log.py,sha256=FxkAk2f8Bl-u9dfImSj1DYnjAsmV6PL3tjTSnEiNP48,2218
|
|
87
|
-
letta/main.py,sha256=
|
|
88
|
-
letta/memory.py,sha256=
|
|
89
|
-
letta/metadata.py,sha256=
|
|
90
|
-
letta/o1_agent.py,sha256=
|
|
91
|
-
letta/offline_memory_agent.py,sha256=
|
|
86
|
+
letta/main.py,sha256=M78MU-12bj-6qyoWz-yNIRsj8qMmwCZB4Ed8LTFfKrc,19135
|
|
87
|
+
letta/memory.py,sha256=R4Z_MYD5ve04FBe2yohux1pzp8MTjOSI1AZ5oLCdGRA,14568
|
|
88
|
+
letta/metadata.py,sha256=zwIe0Sr1Q2g5L2V6Yc5D_t_NG8nhdgleAGQEdaAi2Lw,15165
|
|
89
|
+
letta/o1_agent.py,sha256=aNuv70NmmtKQcfOcd0L4VxHzg7o7xoiU81j1LWok4bk,3164
|
|
90
|
+
letta/offline_memory_agent.py,sha256=369jMxqKMoex9JI269kpaO1Q_JPWLwn-BaiZ6YHc-Fw,7898
|
|
92
91
|
letta/openai_backcompat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
93
92
|
letta/openai_backcompat/openai_object.py,sha256=Y1ZS1sATP60qxJiOsjOP3NbwSzuzvkNAvb3DeuhM5Uk,13490
|
|
94
93
|
letta/orm/__all__.py,sha256=2gh2MZTkA3Hw67VWVKK3JIStJOqTeLdpCvYSVYNeEDA,692
|
|
95
|
-
letta/orm/__init__.py,sha256=
|
|
94
|
+
letta/orm/__init__.py,sha256=HyH2suMD8-92bZ5paW8AC1o-639AQqwAc_HN8S7mjxI,542
|
|
96
95
|
letta/orm/agents_tags.py,sha256=Qa7Yt9imL8xbGP57fflccAMy7Z32CQiU_7eZKSSPngc,1119
|
|
97
96
|
letta/orm/base.py,sha256=K_LpNUURbsj44ycHbzvNXG_n8pBOjf1YvDaikIPDpQA,2716
|
|
98
97
|
letta/orm/block.py,sha256=xymYeCTJJFkzADW6wjfP2LXNZZN9yg4mCSybbvEEMMM,2356
|
|
99
98
|
letta/orm/blocks_agents.py,sha256=o6cfblODja7so4444npW0vusqKcvDPp8YJdsWsOePus,1164
|
|
100
99
|
letta/orm/enums.py,sha256=KfHcFt_fR6GUmSlmfsa-TetvmuRxGESNve8MStRYW64,145
|
|
101
100
|
letta/orm/errors.py,sha256=nv1HnF3z4-u9m_g7SO5TO5u2nmJN677_n8F0iIjluUI,460
|
|
102
|
-
letta/orm/file.py,sha256=
|
|
101
|
+
letta/orm/file.py,sha256=JafpJhooBtMrmkRG68jT8rFK9mRIQSlYKYjq3VXhTcc,1525
|
|
103
102
|
letta/orm/job.py,sha256=If-qSTJW4t5h-6Jolw3tS3-xMZEaPIbXe3S0GMf_FXI,1102
|
|
104
|
-
letta/orm/
|
|
105
|
-
letta/orm/
|
|
103
|
+
letta/orm/message.py,sha256=8x6zDFlnYqTL27JDaVcaHtIOkvTGVg_FxesSmOvH0kI,2677
|
|
104
|
+
letta/orm/mixins.py,sha256=TpP5dFAcGu2VvHZQSt8ymc0UjQhcVp5-Fc2C4v_nUTM,1508
|
|
105
|
+
letta/orm/organization.py,sha256=ZoHow3Tpdh9TXDvB4VZbArbUCgbErFTSQMriYAzulqA,2397
|
|
106
106
|
letta/orm/sandbox_config.py,sha256=PCMHE-eJPzBT-90OYtXjEMRF4f9JB8AJIGETE7bu-f0,2870
|
|
107
107
|
letta/orm/source.py,sha256=Ib0XHCMt345RjBSC30A398rZ21W5mA4PXX00XNXyd24,2021
|
|
108
|
-
letta/orm/sqlalchemy_base.py,sha256=
|
|
108
|
+
letta/orm/sqlalchemy_base.py,sha256=_uix_6bCC_rZYbTKL_OpldjTgrEv-9l6FL3ysKsgUZU,13877
|
|
109
109
|
letta/orm/tool.py,sha256=R1I3FGjt8xlW7DPkwV9zlliOcAB3vpphAZTQTsvDBXs,2982
|
|
110
110
|
letta/orm/tools_agents.py,sha256=mBMGQsTEx_ckfhZb2-2nqbxHBEMhvDXim6w6tFHHWBQ,1195
|
|
111
111
|
letta/orm/user.py,sha256=bUZzyBQXfR0w7mZAkThPAQE6kKx6W--Rw6uAiPEUW3s,1133
|
|
112
|
-
letta/persistence_manager.py,sha256=sEnNdNisK7StqIzG8eIY0YMag6S9hZFbkDfmY7L2Ikc,5268
|
|
113
112
|
letta/personas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
114
113
|
letta/personas/examples/anna_pa.txt,sha256=zgiNdSNhy1HQy58cF_6RFPzcg2i37F9v38YuL1CW40A,1849
|
|
115
114
|
letta/personas/examples/google_search_persona.txt,sha256=RyObU80MIk2oeJJDWOK1aX5pHOtbHSSjIrbUpxov240,1194
|
|
@@ -148,13 +147,13 @@ letta/schemas/enums.py,sha256=F396hXs57up4Jqj1vwWVknMpoVo7MkccVBALvKGHPpE,1032
|
|
|
148
147
|
letta/schemas/file.py,sha256=ChN2CWzLI2TT9WLItcfElEH0E8b7kzPylF2OQBr6Beg,1550
|
|
149
148
|
letta/schemas/health.py,sha256=zT6mYovvD17iJRuu2rcaQQzbEEYrkwvAE9TB7iU824c,139
|
|
150
149
|
letta/schemas/job.py,sha256=vRVVpMCHTxot9uaalLS8RARnqzJWvcLB1XP5XRBioPc,1398
|
|
151
|
-
letta/schemas/letta_base.py,sha256=
|
|
150
|
+
letta/schemas/letta_base.py,sha256=v3OvpVFVUfcuK1lIyTjM0x4fmWeWQw1DdlhKXHBUCz8,3608
|
|
152
151
|
letta/schemas/letta_message.py,sha256=RuVVtwFbi85yP3dXQxowofQ6cI2cO_CdGtgpHGQzgHc,6563
|
|
153
152
|
letta/schemas/letta_request.py,sha256=E6OwKiceNffpdGdQMI1qc0jEfpL_e7O9BTzklOkbt6Y,1019
|
|
154
153
|
letta/schemas/letta_response.py,sha256=vQV5uqe-kq9fc4wCo-sVB_PJt5yUk8DB2zOgHsrmN-k,6189
|
|
155
154
|
letta/schemas/llm_config.py,sha256=RbgnCaqYd_yl-Xs7t-DEI1NhpKD8WiVWjxcwq5mZd5M,4467
|
|
156
155
|
letta/schemas/memory.py,sha256=80Y7gqWQQndhNkJ-0j38d2m619gTlfes_qJNA6_ant8,10040
|
|
157
|
-
letta/schemas/message.py,sha256=
|
|
156
|
+
letta/schemas/message.py,sha256=KER04veCt-7FiZj3GU1x_QW38xnBC7jnnBDkRJuW3ak,33485
|
|
158
157
|
letta/schemas/openai/chat_completion_request.py,sha256=AOIwgbN3CZKVqkuXeMHeSa53u4h0wVq69t3T_LJ0vIE,3389
|
|
159
158
|
letta/schemas/openai/chat_completion_response.py,sha256=ub-oVSyLpuJd-5_yzCSIRR8tD3GM83IeDO1c1uAATa4,3970
|
|
160
159
|
letta/schemas/openai/chat_completions.py,sha256=V0ZPIIk-ds3O6MAkNHMz8zh1hqMFSPrTcYr88WDYzWE,3588
|
|
@@ -187,8 +186,8 @@ letta/server/rest_api/routers/openai/assistants/threads.py,sha256=g8iu98__tQEMY9
|
|
|
187
186
|
letta/server/rest_api/routers/openai/chat_completions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
188
187
|
letta/server/rest_api/routers/openai/chat_completions/chat_completions.py,sha256=qFMpxfYIlJ-PW08IQt09RW44u6hwkssdsUT-h_GuOvE,4836
|
|
189
188
|
letta/server/rest_api/routers/v1/__init__.py,sha256=RZc0fIHNN4BGretjU6_TGK7q49RyV4jfYNudoiK_sUo,762
|
|
190
|
-
letta/server/rest_api/routers/v1/agents.py,sha256=
|
|
191
|
-
letta/server/rest_api/routers/v1/blocks.py,sha256=
|
|
189
|
+
letta/server/rest_api/routers/v1/agents.py,sha256=h6i_HJZ0kcM4p2cTZeh0Mi65PhBw08uzDDxsQkFRLt4,24891
|
|
190
|
+
letta/server/rest_api/routers/v1/blocks.py,sha256=hLGwm56xCA09KdEi8P0V3s__pD_yyl07p17cdSfDj8g,4878
|
|
192
191
|
letta/server/rest_api/routers/v1/health.py,sha256=pKCuVESlVOhGIb4VC4K-H82eZqfghmT6kvj2iOkkKuc,401
|
|
193
192
|
letta/server/rest_api/routers/v1/jobs.py,sha256=gnu__rjcd9SpKdQkSD_sci-xJYH0fw828PuHMcYwsCw,2678
|
|
194
193
|
letta/server/rest_api/routers/v1/llms.py,sha256=TcyvSx6MEM3je5F4DysL7ligmssL_pFlJaaO4uL95VY,877
|
|
@@ -199,12 +198,12 @@ letta/server/rest_api/routers/v1/tools.py,sha256=TP16cpuTF2HYLFZVmabExw9gziB-Ptk
|
|
|
199
198
|
letta/server/rest_api/routers/v1/users.py,sha256=M1wEr2IyHzuRwINYxLXTkrbAH3osLe_cWjzrWrzR1aw,3729
|
|
200
199
|
letta/server/rest_api/static_files.py,sha256=NG8sN4Z5EJ8JVQdj19tkFa9iQ1kBPTab9f_CUxd_u4Q,3143
|
|
201
200
|
letta/server/rest_api/utils.py,sha256=6c5a_-ZFTlwZ1IuzpRQtqxSG1eD56nNhKhWlrdgBYWk,3103
|
|
202
|
-
letta/server/server.py,sha256=
|
|
201
|
+
letta/server/server.py,sha256=jX1KQsSoLY9gtKFSwskxZjx7lduuQ0YLTovriKnM-9Q,81561
|
|
203
202
|
letta/server/startup.sh,sha256=wTOQOJJZw_Iec57WIu0UW0AVflk0ZMWYZWg8D3T_gSQ,698
|
|
204
|
-
letta/server/static_files/assets/index-
|
|
205
|
-
letta/server/static_files/assets/index-
|
|
203
|
+
letta/server/static_files/assets/index-43ab4d62.css,sha256=Q6tNYu7XNRgkTZau1dVwCQTT4YpLGLF7VgTNzLcMaQI,7613
|
|
204
|
+
letta/server/static_files/assets/index-4848e3d7.js,sha256=XkoX-NW0x1Hb7uTWslfpuPP73MnNDthOdJLHLID9EhM,146806
|
|
206
205
|
letta/server/static_files/favicon.ico,sha256=DezhLdFSbM8o81wCOZcV3riq7tFUOGQD4h6-vr-HuU0,342
|
|
207
|
-
letta/server/static_files/index.html,sha256=
|
|
206
|
+
letta/server/static_files/index.html,sha256=RF-Kt4CbTPJbsHtK30NaWIsdUiBpmJgQsKmE6WwqsBk,1198
|
|
208
207
|
letta/server/static_files/memgpt_logo_transparent.png,sha256=7l6niNb4MlUILxLlUZPxIE1TEHj_Z9f9XDxoST3d7Vw,85383
|
|
209
208
|
letta/server/utils.py,sha256=rRvW6L1lzau4u9boamiyZH54lf5tQ91ypXzUW9cfSPA,1667
|
|
210
209
|
letta/server/ws_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -214,25 +213,26 @@ letta/server/ws_api/protocol.py,sha256=M_-gM5iuDBwa1cuN2IGNCG5GxMJwU2d3XW93XALv9
|
|
|
214
213
|
letta/server/ws_api/server.py,sha256=C2Kv48PCwl46DQFb0ZP30s86KJLQ6dZk2AhWQEZn9pY,6004
|
|
215
214
|
letta/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
216
215
|
letta/services/agents_tags_manager.py,sha256=zNqeXDpaf4dQ77jrRHiQfITdk4FawBzcND-9tWrj8gw,3127
|
|
217
|
-
letta/services/block_manager.py,sha256=
|
|
216
|
+
letta/services/block_manager.py,sha256=BmuK0k3yl9byT703syGtZNfjUdM2FkOwlE6bQYIQtjI,5448
|
|
218
217
|
letta/services/blocks_agents_manager.py,sha256=mfO3EMW9os_E1_r4SRlC2wmBFFLpt8p-yhdOH_Iotaw,5627
|
|
219
218
|
letta/services/job_manager.py,sha256=FrkSXloke48CZKuzlYdysxM5gKWoTu7FRigPrs_YW4A,3645
|
|
220
|
-
letta/services/
|
|
219
|
+
letta/services/message_manager.py,sha256=pvRaV2GoW5EzRas5j2NSF75O_sTaHVUWwmPzTbHcfHw,6874
|
|
220
|
+
letta/services/organization_manager.py,sha256=B7BgHkZcAOP1fzbg2fFF8eTfKmqOiGvoojQ8ys7JVY4,3412
|
|
221
221
|
letta/services/per_agent_lock_manager.py,sha256=porM0cKKANQ1FvcGXOO_qM7ARk5Fgi1HVEAhXsAg9-4,546
|
|
222
222
|
letta/services/sandbox_config_manager.py,sha256=9BCu59nHR4nIMFXgFyEMOY2UTmZvBMS3GlDBWWCHB4I,12648
|
|
223
|
-
letta/services/source_manager.py,sha256=
|
|
223
|
+
letta/services/source_manager.py,sha256=8TILbVvJx1bopgDbIJCiIguZBw7uyYDFkasZxVos_G8,6560
|
|
224
224
|
letta/services/tool_execution_sandbox.py,sha256=GTWdfAKIMIuODEFbmReyEYkOnE62uzDF-3FHWee1s3A,21295
|
|
225
|
-
letta/services/tool_manager.py,sha256=
|
|
225
|
+
letta/services/tool_manager.py,sha256=BFwD9J6WOIXnYV6QmJFeCKRIiAiD0vO0haNfshkn2jI,7854
|
|
226
226
|
letta/services/tool_sandbox_env/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
227
227
|
letta/services/tools_agents_manager.py,sha256=kF6yIsUO154_Q3l-cEeSU56QW-VUr_M6B-9csqhHBkg,4847
|
|
228
|
-
letta/services/user_manager.py,sha256=
|
|
228
|
+
letta/services/user_manager.py,sha256=cfXgnVlnfqPCk7c-wYRsU3RegHs-4stksk186RW89Do,4403
|
|
229
229
|
letta/settings.py,sha256=ZcUcwvl7hStawZ0JOA0133jNk3j5qBd7qlFAAaIPsU8,3608
|
|
230
230
|
letta/streaming_interface.py,sha256=_FPUWy58j50evHcpXyd7zB1wWqeCc71NCFeWh_TBvnw,15736
|
|
231
231
|
letta/streaming_utils.py,sha256=329fsvj1ZN0r0LpQtmMPZ2vSxkDBIUUwvGHZFkjm2I8,11745
|
|
232
232
|
letta/system.py,sha256=buKYPqG5n2x41hVmWpu6JUpyd7vTWED9Km2_M7dLrvk,6960
|
|
233
233
|
letta/utils.py,sha256=7FGZYp8JCEtP0PBSfV03Zj4kW3pwV7qpNki4AOU3a94,32913
|
|
234
|
-
letta_nightly-0.6.1.
|
|
235
|
-
letta_nightly-0.6.1.
|
|
236
|
-
letta_nightly-0.6.1.
|
|
237
|
-
letta_nightly-0.6.1.
|
|
238
|
-
letta_nightly-0.6.1.
|
|
234
|
+
letta_nightly-0.6.1.dev20241207104149.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
|
|
235
|
+
letta_nightly-0.6.1.dev20241207104149.dist-info/METADATA,sha256=65Tw5JljqWDW7dJ2Qm-ZS-4hfPopKW9WAmstmTFOv3I,11459
|
|
236
|
+
letta_nightly-0.6.1.dev20241207104149.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
237
|
+
letta_nightly-0.6.1.dev20241207104149.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
|
|
238
|
+
letta_nightly-0.6.1.dev20241207104149.dist-info/RECORD,,
|
letta/agent_store/lancedb.py
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
# type: ignore
|
|
2
|
-
|
|
3
|
-
import uuid
|
|
4
|
-
from datetime import datetime
|
|
5
|
-
from typing import Dict, Iterator, List, Optional
|
|
6
|
-
|
|
7
|
-
from lancedb.pydantic import LanceModel, Vector
|
|
8
|
-
|
|
9
|
-
from letta.agent_store.storage import StorageConnector, TableType
|
|
10
|
-
from letta.config import AgentConfig, LettaConfig
|
|
11
|
-
from letta.schemas.message import Message, Passage, Record
|
|
12
|
-
|
|
13
|
-
""" Initial implementation - not complete """
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def get_db_model(table_name: str, table_type: TableType):
|
|
17
|
-
config = LettaConfig.load()
|
|
18
|
-
|
|
19
|
-
if table_type == TableType.ARCHIVAL_MEMORY or table_type == TableType.PASSAGES:
|
|
20
|
-
# create schema for archival memory
|
|
21
|
-
class PassageModel(LanceModel):
|
|
22
|
-
"""Defines data model for storing Passages (consisting of text, embedding)"""
|
|
23
|
-
|
|
24
|
-
id: uuid.UUID
|
|
25
|
-
user_id: str
|
|
26
|
-
text: str
|
|
27
|
-
file_id: str
|
|
28
|
-
agent_id: str
|
|
29
|
-
data_source: str
|
|
30
|
-
embedding: Vector(config.default_embedding_config.embedding_dim)
|
|
31
|
-
metadata_: Dict
|
|
32
|
-
|
|
33
|
-
def __repr__(self):
|
|
34
|
-
return f"<Passage(passage_id='{self.id}', text='{self.text}', embedding='{self.embedding})>"
|
|
35
|
-
|
|
36
|
-
def to_record(self):
|
|
37
|
-
return Passage(
|
|
38
|
-
text=self.text,
|
|
39
|
-
embedding=self.embedding,
|
|
40
|
-
file_id=self.file_id,
|
|
41
|
-
user_id=self.user_id,
|
|
42
|
-
id=self.id,
|
|
43
|
-
data_source=self.data_source,
|
|
44
|
-
agent_id=self.agent_id,
|
|
45
|
-
metadata=self.metadata_,
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
return PassageModel
|
|
49
|
-
elif table_type == TableType.RECALL_MEMORY:
|
|
50
|
-
|
|
51
|
-
class MessageModel(LanceModel):
|
|
52
|
-
"""Defines data model for storing Message objects"""
|
|
53
|
-
|
|
54
|
-
__abstract__ = True # this line is necessary
|
|
55
|
-
|
|
56
|
-
# Assuming message_id is the primary key
|
|
57
|
-
id: uuid.UUID
|
|
58
|
-
user_id: str
|
|
59
|
-
agent_id: str
|
|
60
|
-
|
|
61
|
-
# openai info
|
|
62
|
-
role: str
|
|
63
|
-
name: str
|
|
64
|
-
text: str
|
|
65
|
-
model: str
|
|
66
|
-
user: str
|
|
67
|
-
|
|
68
|
-
# function info
|
|
69
|
-
function_name: str
|
|
70
|
-
function_args: str
|
|
71
|
-
function_response: str
|
|
72
|
-
|
|
73
|
-
embedding = Vector(config.default_embedding_config.embedding_dim)
|
|
74
|
-
|
|
75
|
-
# Add a datetime column, with default value as the current time
|
|
76
|
-
created_at = datetime
|
|
77
|
-
|
|
78
|
-
def __repr__(self):
|
|
79
|
-
return f"<Message(message_id='{self.id}', text='{self.text}', embedding='{self.embedding})>"
|
|
80
|
-
|
|
81
|
-
def to_record(self):
|
|
82
|
-
return Message(
|
|
83
|
-
user_id=self.user_id,
|
|
84
|
-
agent_id=self.agent_id,
|
|
85
|
-
role=self.role,
|
|
86
|
-
name=self.name,
|
|
87
|
-
text=self.text,
|
|
88
|
-
model=self.model,
|
|
89
|
-
function_name=self.function_name,
|
|
90
|
-
function_args=self.function_args,
|
|
91
|
-
function_response=self.function_response,
|
|
92
|
-
embedding=self.embedding,
|
|
93
|
-
created_at=self.created_at,
|
|
94
|
-
id=self.id,
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
"""Create database model for table_name"""
|
|
98
|
-
return MessageModel
|
|
99
|
-
|
|
100
|
-
else:
|
|
101
|
-
raise ValueError(f"Table type {table_type} not implemented")
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
class LanceDBConnector(StorageConnector):
|
|
105
|
-
"""Storage via LanceDB"""
|
|
106
|
-
|
|
107
|
-
# TODO: this should probably eventually be moved into a parent DB class
|
|
108
|
-
|
|
109
|
-
def __init__(self, name: Optional[str] = None, agent_config: Optional[AgentConfig] = None):
|
|
110
|
-
# TODO
|
|
111
|
-
pass
|
|
112
|
-
|
|
113
|
-
def generate_where_filter(self, filters: Dict) -> str:
|
|
114
|
-
where_filters = []
|
|
115
|
-
for key, value in filters.items():
|
|
116
|
-
where_filters.append(f"{key}={value}")
|
|
117
|
-
return where_filters.join(" AND ")
|
|
118
|
-
|
|
119
|
-
@abstractmethod
|
|
120
|
-
def get_all_paginated(self, filters: Optional[Dict] = {}, page_size: Optional[int] = 1000) -> Iterator[List[Record]]:
|
|
121
|
-
# TODO
|
|
122
|
-
pass
|
|
123
|
-
|
|
124
|
-
@abstractmethod
|
|
125
|
-
def get_all(self, filters: Optional[Dict] = {}, limit=10) -> List[Record]:
|
|
126
|
-
# TODO
|
|
127
|
-
pass
|
|
128
|
-
|
|
129
|
-
@abstractmethod
|
|
130
|
-
def get(self, id: uuid.UUID) -> Optional[Record]:
|
|
131
|
-
# TODO
|
|
132
|
-
pass
|
|
133
|
-
|
|
134
|
-
@abstractmethod
|
|
135
|
-
def size(self, filters: Optional[Dict] = {}) -> int:
|
|
136
|
-
# TODO
|
|
137
|
-
pass
|
|
138
|
-
|
|
139
|
-
@abstractmethod
|
|
140
|
-
def insert(self, record: Record):
|
|
141
|
-
# TODO
|
|
142
|
-
pass
|
|
143
|
-
|
|
144
|
-
@abstractmethod
|
|
145
|
-
def insert_many(self, records: List[Record], show_progress=False):
|
|
146
|
-
# TODO
|
|
147
|
-
pass
|
|
148
|
-
|
|
149
|
-
@abstractmethod
|
|
150
|
-
def query(self, query: str, query_vec: List[float], top_k: int = 10, filters: Optional[Dict] = {}) -> List[Record]:
|
|
151
|
-
# TODO
|
|
152
|
-
pass
|
|
153
|
-
|
|
154
|
-
@abstractmethod
|
|
155
|
-
def query_date(self, start_date, end_date):
|
|
156
|
-
# TODO
|
|
157
|
-
pass
|
|
158
|
-
|
|
159
|
-
@abstractmethod
|
|
160
|
-
def query_text(self, query):
|
|
161
|
-
# TODO
|
|
162
|
-
pass
|
|
163
|
-
|
|
164
|
-
@abstractmethod
|
|
165
|
-
def delete_table(self):
|
|
166
|
-
# TODO
|
|
167
|
-
pass
|
|
168
|
-
|
|
169
|
-
@abstractmethod
|
|
170
|
-
def delete(self, filters: Optional[Dict] = {}):
|
|
171
|
-
# TODO
|
|
172
|
-
pass
|
|
173
|
-
|
|
174
|
-
@abstractmethod
|
|
175
|
-
def save(self):
|
|
176
|
-
# TODO
|
|
177
|
-
pass
|
letta/persistence_manager.py
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import List
|
|
4
|
-
|
|
5
|
-
from letta.memory import BaseRecallMemory, EmbeddingArchivalMemory
|
|
6
|
-
from letta.schemas.agent import AgentState
|
|
7
|
-
from letta.schemas.memory import Memory
|
|
8
|
-
from letta.schemas.message import Message
|
|
9
|
-
from letta.utils import printd
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def parse_formatted_time(formatted_time: str):
|
|
13
|
-
# parse times returned by letta.utils.get_formatted_time()
|
|
14
|
-
try:
|
|
15
|
-
return datetime.strptime(formatted_time.strip(), "%Y-%m-%d %I:%M:%S %p %Z%z")
|
|
16
|
-
except:
|
|
17
|
-
return datetime.strptime(formatted_time.strip(), "%Y-%m-%d %I:%M:%S %p")
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class PersistenceManager(ABC):
|
|
21
|
-
@abstractmethod
|
|
22
|
-
def trim_messages(self, num):
|
|
23
|
-
pass
|
|
24
|
-
|
|
25
|
-
@abstractmethod
|
|
26
|
-
def prepend_to_messages(self, added_messages):
|
|
27
|
-
pass
|
|
28
|
-
|
|
29
|
-
@abstractmethod
|
|
30
|
-
def append_to_messages(self, added_messages):
|
|
31
|
-
pass
|
|
32
|
-
|
|
33
|
-
@abstractmethod
|
|
34
|
-
def swap_system_message(self, new_system_message):
|
|
35
|
-
pass
|
|
36
|
-
|
|
37
|
-
@abstractmethod
|
|
38
|
-
def update_memory(self, new_memory):
|
|
39
|
-
pass
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class LocalStateManager(PersistenceManager):
|
|
43
|
-
"""In-memory state manager has nothing to manage, all agents are held in-memory"""
|
|
44
|
-
|
|
45
|
-
recall_memory_cls = BaseRecallMemory
|
|
46
|
-
archival_memory_cls = EmbeddingArchivalMemory
|
|
47
|
-
|
|
48
|
-
def __init__(self, agent_state: AgentState):
|
|
49
|
-
# Memory held in-state useful for debugging stateful versions
|
|
50
|
-
self.memory = agent_state.memory
|
|
51
|
-
# self.messages = [] # current in-context messages
|
|
52
|
-
# self.all_messages = [] # all messages seen in current session (needed if lazily synchronizing state with DB)
|
|
53
|
-
self.archival_memory = EmbeddingArchivalMemory(agent_state)
|
|
54
|
-
self.recall_memory = BaseRecallMemory(agent_state)
|
|
55
|
-
# self.agent_state = agent_state
|
|
56
|
-
|
|
57
|
-
def save(self):
|
|
58
|
-
"""Ensure storage connectors save data"""
|
|
59
|
-
self.archival_memory.save()
|
|
60
|
-
self.recall_memory.save()
|
|
61
|
-
|
|
62
|
-
'''
|
|
63
|
-
def json_to_message(self, message_json) -> Message:
|
|
64
|
-
"""Convert agent message JSON into Message object"""
|
|
65
|
-
|
|
66
|
-
# get message
|
|
67
|
-
if "message" in message_json:
|
|
68
|
-
message = message_json["message"]
|
|
69
|
-
else:
|
|
70
|
-
message = message_json
|
|
71
|
-
|
|
72
|
-
# get timestamp
|
|
73
|
-
if "timestamp" in message_json:
|
|
74
|
-
timestamp = parse_formatted_time(message_json["timestamp"])
|
|
75
|
-
else:
|
|
76
|
-
timestamp = get_local_time()
|
|
77
|
-
|
|
78
|
-
# TODO: change this when we fully migrate to tool calls API
|
|
79
|
-
if "function_call" in message:
|
|
80
|
-
tool_calls = [
|
|
81
|
-
ToolCall(
|
|
82
|
-
id=message["tool_call_id"],
|
|
83
|
-
tool_call_type="function",
|
|
84
|
-
function={
|
|
85
|
-
"name": message["function_call"]["name"],
|
|
86
|
-
"arguments": message["function_call"]["arguments"],
|
|
87
|
-
},
|
|
88
|
-
)
|
|
89
|
-
]
|
|
90
|
-
printd(f"Saving tool calls {[vars(tc) for tc in tool_calls]}")
|
|
91
|
-
else:
|
|
92
|
-
tool_calls = None
|
|
93
|
-
|
|
94
|
-
# if message["role"] == "function":
|
|
95
|
-
# message["role"] = "tool"
|
|
96
|
-
|
|
97
|
-
return Message(
|
|
98
|
-
user_id=self.agent_state.user_id,
|
|
99
|
-
agent_id=self.agent_state.id,
|
|
100
|
-
role=message["role"],
|
|
101
|
-
text=message["content"],
|
|
102
|
-
name=message["name"] if "name" in message else None,
|
|
103
|
-
model=self.agent_state.llm_config.model,
|
|
104
|
-
created_at=timestamp,
|
|
105
|
-
tool_calls=tool_calls,
|
|
106
|
-
tool_call_id=message["tool_call_id"] if "tool_call_id" in message else None,
|
|
107
|
-
id=message["id"] if "id" in message else None,
|
|
108
|
-
)
|
|
109
|
-
'''
|
|
110
|
-
|
|
111
|
-
def trim_messages(self, num):
|
|
112
|
-
# printd(f"InMemoryStateManager.trim_messages")
|
|
113
|
-
# self.messages = [self.messages[0]] + self.messages[num:]
|
|
114
|
-
pass
|
|
115
|
-
|
|
116
|
-
def prepend_to_messages(self, added_messages: List[Message]):
|
|
117
|
-
# first tag with timestamps
|
|
118
|
-
# added_messages = [{"timestamp": get_local_time(), "message": msg} for msg in added_messages]
|
|
119
|
-
|
|
120
|
-
printd(f"{self.__class__.__name__}.prepend_to_message")
|
|
121
|
-
# self.messages = [self.messages[0]] + added_messages + self.messages[1:]
|
|
122
|
-
|
|
123
|
-
# add to recall memory
|
|
124
|
-
self.recall_memory.insert_many([m for m in added_messages])
|
|
125
|
-
|
|
126
|
-
def append_to_messages(self, added_messages: List[Message]):
|
|
127
|
-
# first tag with timestamps
|
|
128
|
-
# added_messages = [{"timestamp": get_local_time(), "message": msg} for msg in added_messages]
|
|
129
|
-
|
|
130
|
-
printd(f"{self.__class__.__name__}.append_to_messages")
|
|
131
|
-
# self.messages = self.messages + added_messages
|
|
132
|
-
|
|
133
|
-
# add to recall memory
|
|
134
|
-
self.recall_memory.insert_many([m for m in added_messages])
|
|
135
|
-
|
|
136
|
-
def swap_system_message(self, new_system_message: Message):
|
|
137
|
-
# first tag with timestamps
|
|
138
|
-
# new_system_message = {"timestamp": get_local_time(), "message": new_system_message}
|
|
139
|
-
|
|
140
|
-
printd(f"{self.__class__.__name__}.swap_system_message")
|
|
141
|
-
# self.messages[0] = new_system_message
|
|
142
|
-
|
|
143
|
-
# add to recall memory
|
|
144
|
-
self.recall_memory.insert(new_system_message)
|
|
145
|
-
|
|
146
|
-
def update_memory(self, new_memory: Memory):
|
|
147
|
-
printd(f"{self.__class__.__name__}.update_memory")
|
|
148
|
-
assert isinstance(new_memory, Memory), type(new_memory)
|
|
149
|
-
self.memory = new_memory
|