letta-nightly 0.6.13.dev20250122185528__py3-none-any.whl → 0.6.14.dev20250123104106__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.
Files changed (61) hide show
  1. letta/__init__.py +2 -2
  2. letta/agent.py +69 -100
  3. letta/chat_only_agent.py +1 -1
  4. letta/client/client.py +153 -137
  5. letta/constants.py +1 -8
  6. letta/data_sources/connectors.py +1 -1
  7. letta/functions/helpers.py +29 -4
  8. letta/functions/schema_generator.py +55 -0
  9. letta/llm_api/helpers.py +51 -1
  10. letta/memory.py +9 -7
  11. letta/orm/agent.py +2 -2
  12. letta/orm/block.py +3 -1
  13. letta/orm/custom_columns.py +5 -4
  14. letta/orm/enums.py +1 -0
  15. letta/orm/message.py +2 -2
  16. letta/orm/sqlalchemy_base.py +5 -0
  17. letta/schemas/agent.py +3 -3
  18. letta/schemas/block.py +2 -2
  19. letta/schemas/environment_variables.py +1 -1
  20. letta/schemas/job.py +1 -1
  21. letta/schemas/letta_base.py +6 -0
  22. letta/schemas/letta_message.py +6 -6
  23. letta/schemas/memory.py +3 -2
  24. letta/schemas/message.py +21 -13
  25. letta/schemas/passage.py +1 -1
  26. letta/schemas/source.py +4 -4
  27. letta/schemas/tool.py +38 -43
  28. letta/server/rest_api/app.py +1 -16
  29. letta/server/rest_api/routers/v1/agents.py +101 -84
  30. letta/server/rest_api/routers/v1/blocks.py +8 -46
  31. letta/server/rest_api/routers/v1/jobs.py +4 -4
  32. letta/server/rest_api/routers/v1/providers.py +2 -2
  33. letta/server/rest_api/routers/v1/runs.py +6 -6
  34. letta/server/rest_api/routers/v1/sources.py +8 -38
  35. letta/server/rest_api/routers/v1/tags.py +1 -1
  36. letta/server/rest_api/routers/v1/tools.py +6 -7
  37. letta/server/server.py +3 -3
  38. letta/services/agent_manager.py +43 -9
  39. letta/services/block_manager.py +3 -3
  40. letta/services/job_manager.py +5 -3
  41. letta/services/organization_manager.py +1 -1
  42. letta/services/passage_manager.py +3 -3
  43. letta/services/provider_manager.py +2 -2
  44. letta/services/sandbox_config_manager.py +2 -2
  45. letta/services/source_manager.py +3 -3
  46. letta/services/tool_execution_sandbox.py +3 -1
  47. letta/services/tool_manager.py +8 -3
  48. letta/services/user_manager.py +2 -2
  49. letta/settings.py +29 -0
  50. letta/system.py +2 -2
  51. {letta_nightly-0.6.13.dev20250122185528.dist-info → letta_nightly-0.6.14.dev20250123104106.dist-info}/METADATA +1 -1
  52. {letta_nightly-0.6.13.dev20250122185528.dist-info → letta_nightly-0.6.14.dev20250123104106.dist-info}/RECORD +55 -61
  53. letta/server/rest_api/routers/openai/__init__.py +0 -0
  54. letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
  55. letta/server/rest_api/routers/openai/assistants/assistants.py +0 -115
  56. letta/server/rest_api/routers/openai/assistants/schemas.py +0 -115
  57. letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
  58. letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -120
  59. {letta_nightly-0.6.13.dev20250122185528.dist-info → letta_nightly-0.6.14.dev20250123104106.dist-info}/LICENSE +0 -0
  60. {letta_nightly-0.6.13.dev20250122185528.dist-info → letta_nightly-0.6.14.dev20250123104106.dist-info}/WHEEL +0 -0
  61. {letta_nightly-0.6.13.dev20250122185528.dist-info → letta_nightly-0.6.14.dev20250123104106.dist-info}/entry_points.txt +0 -0
@@ -1,19 +1,19 @@
1
- letta/__init__.py,sha256=gTEUm0ateSUlGMLdfbEv5XQpadHqH9KtnZVlWn45rU8,993
1
+ letta/__init__.py,sha256=BeMu4nr5y0Y255XZLIZrYc_4K9QUwY1ndKLRgJHzip8,920
2
2
  letta/__main__.py,sha256=6Hs2PV7EYc5Tid4g4OtcLXhqVHiNYTGzSBdoOnW2HXA,29
3
- letta/agent.py,sha256=m4g4gbx4Y0SFPsGzNi6lmkwVSWPfvh2bYoQTKf1CL6A,57854
3
+ letta/agent.py,sha256=aKJWo3Q3OXuSa8UhPTdHvMvyQaDPMaYHhMZgF8Sg3lc,56622
4
4
  letta/benchmark/benchmark.py,sha256=ebvnwfp3yezaXOQyGXkYCDYpsmre-b9hvNtnyx4xkG0,3701
5
5
  letta/benchmark/constants.py,sha256=aXc5gdpMGJT327VuxsT5FngbCK2J41PQYeICBO7g_RE,536
6
- letta/chat_only_agent.py,sha256=ECqJS7KzXOsNkJc9mv7reKbcxBI_PKP_PQyk95tsT1Y,4761
6
+ letta/chat_only_agent.py,sha256=71Lf-df8y3nsE9IFKpEigaZaWHoWnXnhVChkp1L-83I,4760
7
7
  letta/cli/cli.py,sha256=_uGKM-RvGLGf7y8iWjkLgLTxIw7uWrdCdL5ETUOCkUs,16472
8
8
  letta/cli/cli_config.py,sha256=I5J8D0OpsDDXCTOWFqjmxQuZCGrC1oCuNbVkrKwg4VM,8544
9
9
  letta/cli/cli_load.py,sha256=xFw-CuzjChcIptaqQ1XpDROENt0JSjyPeiQ0nmEeO1k,2706
10
10
  letta/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- letta/client/client.py,sha256=9c-qgnVs0ZI0mwpK5FIEYhzlSLUPSZ09HuKpwOSxmlY,135925
11
+ letta/client/client.py,sha256=hv5dOwGxhkI9hZarNIV6hmR0ty7-jLjB5VdAalqa6Q4,136428
12
12
  letta/client/streaming.py,sha256=mWyMMCJeYf0aGcX_-9ZeiH3egh2Fl20Yjo1acaPO4nA,4824
13
13
  letta/client/utils.py,sha256=VCGV-op5ZSmurd4yw7Vhf93XDQ0BkyBT8qsuV7EqfiU,2859
14
14
  letta/config.py,sha256=JFGY4TWW0Wm5fTbZamOwWqk5G8Nn-TXyhgByGoAqy2c,12375
15
- letta/constants.py,sha256=qkH98awgWUW1g9Qpb-IWqVULcLHH-lpblWeUZdLDzkY,7528
16
- letta/data_sources/connectors.py,sha256=L-WL-znjaRstMwSunHf3xDywjvgnbjnUR9rUpL6Ypo0,7023
15
+ letta/constants.py,sha256=CTJa3eFroiQIPg2iCxT_9PqV5IogJKEZLc78K70Ou-Q,7118
16
+ letta/data_sources/connectors.py,sha256=R2AssXpqS7wN6VI8AfxvqaZs5S1ZACc4E_FewmR9iZI,7022
17
17
  letta/data_sources/connectors_helper.py,sha256=2TQjCt74fCgT5sw1AP8PalDEk06jPBbhrPG4HVr-WLs,3371
18
18
  letta/embeddings.py,sha256=VgqbUqYL6oTuLOKGOd_8swTRMYIpRTIWJbBthjT8eR8,8838
19
19
  letta/errors.py,sha256=6fQXg2unP-2fo3R7db0ayKKWlD2XMusOPNi9TgJplCg,5558
@@ -23,8 +23,8 @@ letta/functions/function_sets/base.py,sha256=bOiitkhzqYKwZBiRYrx29AlordiA5IrXw25
23
23
  letta/functions/function_sets/extras.py,sha256=sNY5oavQ5ZmO5GpAtnm8hkWokqwqB8ClPB2VOL-B8MM,4719
24
24
  letta/functions/function_sets/multi_agent.py,sha256=kF1k-MccbRRvzH0Y93Dw5FjqwgToOwlhFCNRGWcQMMw,3851
25
25
  letta/functions/functions.py,sha256=wxxo6MJXBfcPeEc1YYWK5ENOD3RFNTIc65RTDBo77x4,5673
26
- letta/functions/helpers.py,sha256=2euEURCzZqtbdXGiUqoK06kUO-jdbp-vOyML0ZB7h4U,13412
27
- letta/functions/schema_generator.py,sha256=Buij3FwsvEztznmi4Enj9Riephf_MuK57Op3NsgXPBU,17819
26
+ letta/functions/helpers.py,sha256=KQVdIq1klsfKsyYiKbzLd-n0r3i01mjra-QfqR9EOdE,14052
27
+ letta/functions/schema_generator.py,sha256=qIdEYn4gu_lQRaCLSA_zmogcPBWF1Lv7G-PxN77ozCI,19686
28
28
  letta/helpers/__init__.py,sha256=p0luQ1Oe3Skc6sH4O58aHHA3Qbkyjifpuq0DZ1GAY0U,59
29
29
  letta/helpers/tool_rule_solver.py,sha256=VnJfqb5L1Lcipc_tBVGj0om60GKQkMkNLgg6X9VZl2c,6210
30
30
  letta/humans/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -38,7 +38,7 @@ letta/llm_api/azure_openai.py,sha256=Y1HKPog1XzM_f7ujUK_Gv2zQkoy5pU-1bKiUnvSxSrs
38
38
  letta/llm_api/azure_openai_constants.py,sha256=oXtKrgBFHf744gyt5l1thILXgyi8NDNUrKEa2GGGpjw,278
39
39
  letta/llm_api/cohere.py,sha256=H5kzYH_aQAnGNq7lip7XyKGLEOKC318Iw0_tiTP6kc4,14772
40
40
  letta/llm_api/google_ai.py,sha256=MIX4nmyC6448AvyPPSE8JZ_tzSpKJTArkZSfQGGoy0M,17920
41
- letta/llm_api/helpers.py,sha256=iP9EswPflaRzsmLqQuMGt1OCUQgPrPq1xTjrqmMKPiA,13675
41
+ letta/llm_api/helpers.py,sha256=ov9WHsLSvkceIpSNJ3PUgCvufD862Bcrum-bWrUVJko,16193
42
42
  letta/llm_api/llm_api_tools.py,sha256=-cLTeYwhwA6Dy9Io_W3DYrZ-gvYaAtp3TY2Snh1L13o,19512
43
43
  letta/llm_api/mistral.py,sha256=fHdfD9ug-rQIk2qn8tRKay1U6w9maF11ryhKi91FfXM,1593
44
44
  letta/llm_api/openai.py,sha256=vEQOk_8DA6-qhj3KFk5gcIlE4kAuf6307IVljn8xRRM,25390
@@ -81,25 +81,25 @@ letta/local_llm/webui/legacy_settings.py,sha256=BLmd3TSx5StnY3ibjwaxYATPt_Lvq-o1
81
81
  letta/local_llm/webui/settings.py,sha256=gmLHfiOl1u4JmlAZU2d2O8YKF9lafdakyjwR_ftVPh8,552
82
82
  letta/log.py,sha256=FxkAk2f8Bl-u9dfImSj1DYnjAsmV6PL3tjTSnEiNP48,2218
83
83
  letta/main.py,sha256=_agyaYPJq70OL0goNwO34zENL2KupnTgqlg-HVcNaTY,15379
84
- letta/memory.py,sha256=tt7xuknsId1c9LK0gNIfsMQgcrPXFa6aWHALlDeoHMc,3277
84
+ letta/memory.py,sha256=htiDt-AHci__P8cfxHMts6fe50bPqVK4INw9cbumrRQ,3271
85
85
  letta/offline_memory_agent.py,sha256=Wc2_je3oXxXcaiPPNPxc78A3IXVsiK6Q7X3t_SrlHck,7651
86
86
  letta/openai_backcompat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
87
  letta/openai_backcompat/openai_object.py,sha256=Y1ZS1sATP60qxJiOsjOP3NbwSzuzvkNAvb3DeuhM5Uk,13490
88
88
  letta/orm/__all__.py,sha256=2gh2MZTkA3Hw67VWVKK3JIStJOqTeLdpCvYSVYNeEDA,692
89
89
  letta/orm/__init__.py,sha256=wPokP-EvOri2LhKLjmYVtI_FWchaxgFvJeF_NAfqJIo,842
90
- letta/orm/agent.py,sha256=X-u2qUlI3O6RqGlZVWKSDK722YaovIHpuGy5yy9DQDE,6099
90
+ letta/orm/agent.py,sha256=POgpKT4u5FlcCV5w5HsI4D3ZPalZnJ86zBcyJQ1J_mI,6135
91
91
  letta/orm/agents_tags.py,sha256=dYSnHz4IWBjyOiQ4RJomX3P0QN76JTlEZEw5eJM6Emg,925
92
92
  letta/orm/base.py,sha256=VjvxF9TwKF9Trf8BJkDgf7D6KrWWopOkUiF18J3IElk,3071
93
- letta/orm/block.py,sha256=U2fOXdab9ynQscOqzUo3xv1a_GjqHLIgoNSZq-U0mYg,3308
93
+ letta/orm/block.py,sha256=p360LWSjmpXCcdD0S7jFW3Sl153aljhtjn8shCk2Zm8,3469
94
94
  letta/orm/blocks_agents.py,sha256=W0dykl9OchAofSuAYZD5zNmhyMabPr9LTJrz-I3A0m4,983
95
- letta/orm/custom_columns.py,sha256=dBYJn3yc1BIy7ZntIFfq9oEdQav-u0r412C2HyDeUPU,5056
96
- letta/orm/enums.py,sha256=oCvGwxK8heYtBV7wtxOQGlBZ2rocWLlKXP6elkqm0IM,384
95
+ letta/orm/custom_columns.py,sha256=EML5AE5FQ4ugI8MGj4yqfmwBrw7YAcp4_dO6i9oQs6I,5192
96
+ letta/orm/enums.py,sha256=HzX3eXhBH-PnpxhBWtWbkV4J6wrStlJaX_OVdZgAdLU,428
97
97
  letta/orm/errors.py,sha256=Se0Guz-gqi-D36NUWSh7AP9zTVCSph9KgZh_trwng4o,734
98
98
  letta/orm/file.py,sha256=7_p7LxityP3NQZVURQYG0kgcZhEkVuMN0Fj4h9YOe1w,1780
99
99
  letta/orm/job.py,sha256=hTW6INcSc_snMiv8pxCNTAQZACrVXxGMJ-XhCToo6Fk,2088
100
100
  letta/orm/job_messages.py,sha256=SgwaYPYwwAC3dBtl9Xye_TWUl9H_-m95S95TTcfPyOg,1245
101
101
  letta/orm/job_usage_statistics.py,sha256=gR-lp-ZEBDK8TIFEgwFSDt382l6CFLWHciB-KCISbCQ,1380
102
- letta/orm/message.py,sha256=cMnHbZALDgcUHiVkXs8xnMK61LYD5v2cw3Q-P3FFJ5Y,2229
102
+ letta/orm/message.py,sha256=RIu-w2Qk8tt9V-3MwDO9uM1UU433skb1eLpZBMsdTHE,2288
103
103
  letta/orm/mixins.py,sha256=9c79Kfr-Z1hL-SDYKeoptx_yMTbBwJJBo9nrKEzSDAc,1622
104
104
  letta/orm/organization.py,sha256=b12iASuskPnG2yHyFh8p2BFROkoqMPEYUFMuVcFPCHs,2897
105
105
  letta/orm/passage.py,sha256=tm5YhUozLR9hN7odGCqCniTl-3GDiFNz3LWAxullaGA,3132
@@ -107,7 +107,7 @@ letta/orm/provider.py,sha256=-qA9tvKTZgaM4D7CoDZZiA7zTgjaaWDV4jZvifQv_MM,805
107
107
  letta/orm/sandbox_config.py,sha256=DyOy_1_zCMlp13elCqPcuuA6OwUove6mrjhcpROTg50,4150
108
108
  letta/orm/source.py,sha256=xM3Iwy3xzYdoZja9BZrQwyAnPf5iksaQOs8HlNCvb_c,2031
109
109
  letta/orm/sources_agents.py,sha256=Ik_PokCBrXRd9wXWomeNeb8EtLUwjb9VMZ8LWXqpK5A,473
110
- letta/orm/sqlalchemy_base.py,sha256=yMb-gGVuy1KKUqcVC42xCG8GpXnjtFT9AKpvGHOgr7E,19169
110
+ letta/orm/sqlalchemy_base.py,sha256=g3ZuILuaPD1IhqMi2k0Uwka7SYj4xl9XrwcHP1wz3PA,19442
111
111
  letta/orm/sqlite_functions.py,sha256=JCScKiRlYCKxy9hChQ8wsk4GMKknZE24MunnG3fM1Gw,4255
112
112
  letta/orm/step.py,sha256=6ygEnkQSIMxNH08Om0a-UK-f2E66QSpp9GdGm7mGjFg,2853
113
113
  letta/orm/tool.py,sha256=dJi56QksOCYsz2RvXyGQODyuHmx0rEoU3E1wHt_jPOI,2293
@@ -140,34 +140,34 @@ letta/prompts/system/memgpt_modified_o1.txt,sha256=objnDgnxpF3-MmU28ZqZ7-TOG8UlH
140
140
  letta/prompts/system/memgpt_offline_memory.txt,sha256=rWEJeF-6aiinjkJM9hgLUYCmlEcC_HekYB1bjEUYq6M,2460
141
141
  letta/prompts/system/memgpt_offline_memory_chat.txt,sha256=ituh7gDuio7nC2UKFB7GpBq6crxb8bYedQfJ0ADoPgg,3949
142
142
  letta/pytest.ini,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
143
- letta/schemas/agent.py,sha256=3mXbC7TYTIkwuD2cejPmnXIfZBt5odWL3DRvwBC52wQ,11843
144
- letta/schemas/block.py,sha256=pVDH8jr5r-oxdX4cK9dX2wXyLBzgGKQOBWOzqZSeBog,5944
143
+ letta/schemas/agent.py,sha256=VmzzaRb4HA20fahzUxU2JOdcIxt2ywLFdTRjbR6Ogyk,11783
144
+ letta/schemas/block.py,sha256=FYYmRWjH4d4QHMUx_nmIXjv_qJna_l-Ip_4i51wDBPA,5942
145
145
  letta/schemas/embedding_config.py,sha256=RkLbUorFkMWr1tPkn6c2aHrnICjWTbhPY86tIncwXyA,3373
146
146
  letta/schemas/enums.py,sha256=f8SVJqb0dzhlNCBN2SgeM4ZMHX5LMyhln1SCJAgXeow,1068
147
- letta/schemas/environment_variables.py,sha256=ZTMH_2YMzDQc62eRnHRh1Mmmcvfj8d0aXGDAAOnTlIA,2446
147
+ letta/schemas/environment_variables.py,sha256=VRtzOjdeQdHcSHXisk7oJUQlheruxhSWNS0xqlfGzbs,2429
148
148
  letta/schemas/file.py,sha256=ChN2CWzLI2TT9WLItcfElEH0E8b7kzPylF2OQBr6Beg,1550
149
149
  letta/schemas/health.py,sha256=zT6mYovvD17iJRuu2rcaQQzbEEYrkwvAE9TB7iU824c,139
150
- letta/schemas/job.py,sha256=CXjCvYj0afe8TivOYroL9DiHelDqJzxI9u_fFORvmV4,1521
151
- letta/schemas/letta_base.py,sha256=cfnDxsys0mnGQjocBUL61SmjSZlktWl62vr0vuCaQCo,3773
152
- letta/schemas/letta_message.py,sha256=ZifuFk_5H4xsSyRRrKARhPGc0mB25HNgHqZp69fXrEQ,9120
150
+ letta/schemas/job.py,sha256=npIWwV3G3eTTbN9rNxqI0Avb9Q3YJJ18e4CrjU-jMoM,1520
151
+ letta/schemas/letta_base.py,sha256=HTnSHJ2YSyhEdpY-vg9Y7ywqS1zzTjb9j5iVPYsuVSk,3991
152
+ letta/schemas/letta_message.py,sha256=k8j0_x0YRHV2QYfqCHOySTmoY-DoBR84rljKc-k2sDQ,9078
153
153
  letta/schemas/letta_request.py,sha256=YRLjzGHQusj0NIue2AjCN-6j0cvxZ_DJQKjgTpT3fPc,1355
154
154
  letta/schemas/letta_response.py,sha256=yL0w-cdUazgEqg6_F4LJz2tugKNAZsB83Gr5jfXwa5U,7124
155
155
  letta/schemas/llm_config.py,sha256=HQrwXk6LGJVoOmZwTUXfK0jwVSeX9kCsL-GUcv7loWQ,4603
156
- letta/schemas/memory.py,sha256=dWF1AWhQKEp1MJ6yz8wVYrWNsmA2ADREAz2lS3d8I6c,10229
157
- letta/schemas/message.py,sha256=VJb987frMGIuOvx3H4u5LQpdUhhEXyalX08fPb8ZLTs,34171
156
+ letta/schemas/memory.py,sha256=GOYDfPKzbWftUWO9Hv4KW7xAi1EIQmC8zpP7qvEkVHw,10245
157
+ letta/schemas/message.py,sha256=XOObBue8VfWF2TStiPo3ASvJRovncy38kYMnOLW1YAU,34277
158
158
  letta/schemas/openai/chat_completion_request.py,sha256=AOIwgbN3CZKVqkuXeMHeSa53u4h0wVq69t3T_LJ0vIE,3389
159
159
  letta/schemas/openai/chat_completion_response.py,sha256=ub-oVSyLpuJd-5_yzCSIRR8tD3GM83IeDO1c1uAATa4,3970
160
160
  letta/schemas/openai/chat_completions.py,sha256=V0ZPIIk-ds3O6MAkNHMz8zh1hqMFSPrTcYr88WDYzWE,3588
161
161
  letta/schemas/openai/embedding_response.py,sha256=WKIZpXab1Av7v6sxKG8feW3ZtpQUNosmLVSuhXYa_xU,357
162
162
  letta/schemas/openai/openai.py,sha256=Hilo5BiLAGabzxCwnwfzK5QrWqwYD8epaEKFa4Pwndk,7970
163
163
  letta/schemas/organization.py,sha256=WWbUWVSp_VQRFwWN4fdHg1yObiV6x9rZnvIY8x5BPs0,746
164
- letta/schemas/passage.py,sha256=t_bSI8hpEuh-mj8bV8qOiIA1tAgyjGKrZMVe9l5oIaY,3675
164
+ letta/schemas/passage.py,sha256=HOPdaTNCe6vZ1jqZf9PD758d0wG5haMW4Ztfde4ZQq8,3674
165
165
  letta/schemas/providers.py,sha256=8sEM3J_KgHkYy7zy8IAsYgltqGMHt15nlNEdK6MpOTo,29668
166
166
  letta/schemas/run.py,sha256=OyuAXXjL96ftOeLdqkiIKi9csGeewy-pN5SgWk-vYGg,2124
167
167
  letta/schemas/sandbox_config.py,sha256=v32V5T73X-VxhDk0g_1RGniK985KMvg2xyLVi1dvMQY,4215
168
- letta/schemas/source.py,sha256=B1VbaDJV-EGPv1nQXwCx_RAzeAJd50UqP_1m1cIRT8c,2854
168
+ letta/schemas/source.py,sha256=Z9pGfZIpV19PY5kAbgzz15AckgSRYMab8FkSaC0DsMI,2850
169
169
  letta/schemas/step.py,sha256=cCmDChQMndy7aMJGH0Z19VbzJkAeFTYuA0cJpzjW2g0,1928
170
- letta/schemas/tool.py,sha256=E1MSm2THSyQ5LMEDDm0zdJa7AyweC3rEeDPNIuYr1nY,11138
170
+ letta/schemas/tool.py,sha256=bvWMDH_dSSLqyXXvItiLENwHfXS067Cw-ZsKa6lAlmc,11302
171
171
  letta/schemas/tool_rule.py,sha256=LJwi1T474-3zbFGiW7_fegyfduC3F2u7cdlBsV0U_IU,1679
172
172
  letta/schemas/usage.py,sha256=8oYRH-JX0PfjIu2zkT5Uu3UWQ7Unnz_uHiO8hRGI4m0,912
173
173
  letta/schemas/user.py,sha256=V32Tgl6oqB3KznkxUz12y7agkQicjzW7VocSpj78i6Q,1526
@@ -175,35 +175,29 @@ letta/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
175
175
  letta/server/constants.py,sha256=yAdGbLkzlOU_dLTx0lKDmAnj0ZgRXCEaIcPJWO69eaE,92
176
176
  letta/server/generate_openapi_schema.sh,sha256=0OtBhkC1g6CobVmNEd_m2B6sTdppjbJLXaM95icejvE,371
177
177
  letta/server/rest_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
178
- letta/server/rest_api/app.py,sha256=iFc5YNC2Wa5R0yWL3S1IrTMUHPWPWTHg5EkYbPw61ak,11850
178
+ letta/server/rest_api/app.py,sha256=0gQ9TJ6AvbuiyewtNkLPHsk1o3HltDdixCz1rqvhwJg,11108
179
179
  letta/server/rest_api/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
180
180
  letta/server/rest_api/auth/index.py,sha256=fQBGyVylGSRfEMLQ17cZzrHd5Y1xiVylvPqH5Rl-lXQ,1378
181
181
  letta/server/rest_api/auth_token.py,sha256=725EFEIiNj4dh70hrSd94UysmFD8vcJLrTRfNHkzxDo,774
182
182
  letta/server/rest_api/interface.py,sha256=1p8Bt7uLNLJsKa-TnLXobiLfO91laclK-AiE-jbJr18,51494
183
183
  letta/server/rest_api/routers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
184
- letta/server/rest_api/routers/openai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
185
- letta/server/rest_api/routers/openai/assistants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
186
- letta/server/rest_api/routers/openai/assistants/assistants.py,sha256=PXv5vLFDa3ptMBY6QJUkMaPqk2HFP0IpirJUCmgOY6k,4828
187
- letta/server/rest_api/routers/openai/assistants/schemas.py,sha256=ZWUrmkvDMeywlxYhcp1hHzLXNgWpD8qWt80jRlhb7Rc,5605
188
- letta/server/rest_api/routers/openai/chat_completions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
189
- letta/server/rest_api/routers/openai/chat_completions/chat_completions.py,sha256=Sx_D1WvMDuI42Bt66_w4_h3-eT4hyn5pBPEn5yYlKc4,4600
190
184
  letta/server/rest_api/routers/v1/__init__.py,sha256=bXEZzmvHNX7N11NDwsxyajjci7yxP-2dYIvbeJi33vA,1070
191
- letta/server/rest_api/routers/v1/agents.py,sha256=f1pbJgW6mHjbJSMZuT16jhPBBW6LKiSjNB7ZrW_l5R8,25356
192
- letta/server/rest_api/routers/v1/blocks.py,sha256=IJ2pppwNooaUjIwyBALnKL4sJ8idW8cVJlY-VH_J9HY,4803
185
+ letta/server/rest_api/routers/v1/agents.py,sha256=IAs3LsuoyWHBHJMKdfTNEvVXQ9tiCG8Sa98RI9GyGy0,25265
186
+ letta/server/rest_api/routers/v1/blocks.py,sha256=6zMA4qRbc1kqBzOhkX1Ra4mZM-Z-ccb-cwJf3sSjKt8,3145
193
187
  letta/server/rest_api/routers/v1/health.py,sha256=pKCuVESlVOhGIb4VC4K-H82eZqfghmT6kvj2iOkkKuc,401
194
- letta/server/rest_api/routers/v1/jobs.py,sha256=-tEyuIxlXZfPREeMks-sRzHwhKE2xxgzbXeEbBAS2Q8,2730
188
+ letta/server/rest_api/routers/v1/jobs.py,sha256=pKihW12hQdFwt6tHQXs94yOMv6xotlhBB3Vl7Q5ASKQ,2738
195
189
  letta/server/rest_api/routers/v1/llms.py,sha256=lYp5URXtZk1yu_Pe-p1Wq1uQ0qeb6aWtx78rXSB7N_E,881
196
190
  letta/server/rest_api/routers/v1/organizations.py,sha256=tyqVzXTpMtk3sKxI3Iz4aS6RhbGEbXDzFBB_CpW18v4,2080
197
- letta/server/rest_api/routers/v1/providers.py,sha256=QqGLz6k2XoQi1b6ktUVOgjT78RzCuppJqFjF03Pvc10,2447
198
- letta/server/rest_api/routers/v1/runs.py,sha256=pp-5vaIpe-mVu3ryjZVaxYNgGYIjxiya0TXglyLTXH0,5099
191
+ letta/server/rest_api/routers/v1/providers.py,sha256=cUDcNsLxmv_q6BmW3d78qa-K7y3W87Dz_zChWl50jfE,2447
192
+ letta/server/rest_api/routers/v1/runs.py,sha256=zsxXyhGrPloyHVgcxMeREP-l2ay_zMUZdHRr5afV40o,5121
199
193
  letta/server/rest_api/routers/v1/sandbox_configs.py,sha256=DJ8mz7HsXCuGypNaxTgoMW8xR1kMOwdVnon00srRdCo,5266
200
- letta/server/rest_api/routers/v1/sources.py,sha256=EJ-VCqiKtaiYuivZrWx1gYSNUKnWJuduSm-L_2ljhLc,9913
201
- letta/server/rest_api/routers/v1/tags.py,sha256=-AyPJ7kCvQNRgyUE5eQGWcRz58oUXhpiMIm6j1ryjEg,880
202
- letta/server/rest_api/routers/v1/tools.py,sha256=cfUcRvcQuOXeptwFaIhOmO14wN_eQc3MQAy9XDVMaXY,12081
194
+ letta/server/rest_api/routers/v1/sources.py,sha256=Bcy7E0KgzrNkjpHoywaQoNVFjxFdkVdh5UwRw20X1WA,8417
195
+ letta/server/rest_api/routers/v1/tags.py,sha256=j0Oach9hNcPQx2KVuN4QJQHVlhjbdL2pv1JExq9yCVo,881
196
+ letta/server/rest_api/routers/v1/tools.py,sha256=WwzLLEXoidQqtosPcV6nTIvuusbu6Iz3WIOFYq6jzE0,12013
203
197
  letta/server/rest_api/routers/v1/users.py,sha256=EBQe9IfCG3kzHpKmotz4yVGZioXz3SCSRy5yEhJK8hU,2293
204
198
  letta/server/rest_api/static_files.py,sha256=NG8sN4Z5EJ8JVQdj19tkFa9iQ1kBPTab9f_CUxd_u4Q,3143
205
199
  letta/server/rest_api/utils.py,sha256=dsjkZzgo9Rk3fjUf1ajjiiql1eeO5DAzmXprttI7bJU,3993
206
- letta/server/server.py,sha256=dzfAEAvVJIIpO4mysaDKKj6kb8wrPefKlc_0Pj7vtoI,57628
200
+ letta/server/server.py,sha256=ZV7cNuvvFqJnAQ0vAT1Swc9Yo4YzAvapvF_jt-WxWh0,57625
207
201
  letta/server/startup.sh,sha256=722uKJWB2C4q3vjn39De2zzPacaZNw_1fN1SpLGjKIo,1569
208
202
  letta/server/static_files/assets/index-048c9598.js,sha256=mR16XppvselwKCcNgONs4L7kZEVa4OEERm4lNZYtLSk,146819
209
203
  letta/server/static_files/assets/index-0e31b727.css,sha256=SBbja96uiQVLDhDOroHgM6NSl7tS4lpJRCREgSS_hA8,7672
@@ -217,28 +211,28 @@ letta/server/ws_api/interface.py,sha256=TWl9vkcMCnLsUtgsuENZ-ku2oMDA-OUTzLh_yNRo
217
211
  letta/server/ws_api/protocol.py,sha256=M_-gM5iuDBwa1cuN2IGNCG5GxMJwU2d3XW93XALv9s8,1821
218
212
  letta/server/ws_api/server.py,sha256=cBSzf-V4zT1bL_0i54OTI3cMXhTIIxqjSRF8pYjk7fg,5835
219
213
  letta/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
220
- letta/services/agent_manager.py,sha256=Z2Q6ahrbF-cT-EjVTZIM-ajEv3a8Ycns_2c0bvw8cos,46191
221
- letta/services/block_manager.py,sha256=HUj9HKW2LvAsENEsgCO3Pf3orvSy6XOimev38VKmRZ8,4929
214
+ letta/services/agent_manager.py,sha256=BkGss9v1jBWSWok8bjvFInUZMHb-9Nats8kjJp9qtzg,47794
215
+ letta/services/block_manager.py,sha256=5unHvV0-nDRaPRFh-bcqr4Qye-b1-QWdpz-Il3CfLuM,4968
222
216
  letta/services/helpers/agent_manager_helper.py,sha256=ytNViS18ubRbj90yZ2B3jf1on5pzxT9xaQOpCLFA-ss,10451
223
- letta/services/job_manager.py,sha256=0YdpM4344AVTTMd9hhDWXKr4OxIzLDBtcY91_qZoXcY,12842
217
+ letta/services/job_manager.py,sha256=KIXikN9dPrAK_lIEmgn3IdQ-thn6sMLs3zLfa9u7MeA,12897
224
218
  letta/services/message_manager.py,sha256=a7U0MfgaNAdjbls7ZtUdS7eJ6prJaMkE0NIHgtzh4us,8552
225
- letta/services/organization_manager.py,sha256=hJI86_FErkRaW-VLBBmvmmciIXN59LN0mEMm78C36kQ,3331
226
- letta/services/passage_manager.py,sha256=Lq1caspE1VGmT7vlsUOuJVRflJZ122qfG0dmNGm_6o8,7691
219
+ letta/services/organization_manager.py,sha256=YRYQKlvIgc3gyKoubcwWVEyCbA9CXvh83EVATkkZNPs,3342
220
+ letta/services/passage_manager.py,sha256=INxeNiFAluAkzmCL5jeWWimA3ONUZcck8BuCa0UYajk,7714
227
221
  letta/services/per_agent_lock_manager.py,sha256=porM0cKKANQ1FvcGXOO_qM7ARk5Fgi1HVEAhXsAg9-4,546
228
- letta/services/provider_manager.py,sha256=I_4sY0DQ9zr7gOMH1PqaCCIf_1kjbyLS_FbECVYTbFU,3500
229
- letta/services/sandbox_config_manager.py,sha256=YWJES09KX5POXwL-hijaf87zW3az3Ioh8lWDeZYPY6k,13290
230
- letta/services/source_manager.py,sha256=ZtLQikeJjwAq49f0d4WxUzyUN3LZBqWCZI4a-AzEMWQ,7643
222
+ letta/services/provider_manager.py,sha256=1NSbn9m5F8xvDw0bQ52Y8wqU0CXqORlbfv81lsiNQxM,3526
223
+ letta/services/sandbox_config_manager.py,sha256=5CoUqM4pw-RT5C3GgQjnDrb6eGo3Ovet-tKgnWFQx2k,13316
224
+ letta/services/source_manager.py,sha256=8P0EiKc9SXTECg5DeKL9RFTuXgIkGVup2NJfJ6YY6kI,7682
231
225
  letta/services/step_manager.py,sha256=RngrVs2Sd_oDZv_UoQ1ToLY0RnH-6wS1DqIBPRm-Imc,2961
232
- letta/services/tool_execution_sandbox.py,sha256=yKHSSVeIVXg7-11BXDu1nfjCuIPu19YD4hx6ZuMBgEY,23119
233
- letta/services/tool_manager.py,sha256=CdI6aYQZr2Ar9-iDSMnjMcLIh8n8y_gkKte6FnUy9uE,8164
234
- letta/services/user_manager.py,sha256=oqLF9C4mGbN0TaGj7wMpb2RH2bUg6OJJcdyaWv370rQ,4272
235
- letta/settings.py,sha256=LJAMa0APYBPn9oFtpAGotH10drrzaoFGL88RFoc8QTI,4733
226
+ letta/services/tool_execution_sandbox.py,sha256=Tjufm58V9XzeYr8oF6g5b3OV5zZ7oPWUTqcC8GsBi9k,23162
227
+ letta/services/tool_manager.py,sha256=mkWrr0PnTWi8JGKgfcV8WZ8H8FrJ6qsBAT04-2mF1zc,8458
228
+ letta/services/user_manager.py,sha256=RaXWC8Nbg_5GZSj2fIDXRFb6hRKWTtqtk2d5H4_Ywwo,4296
229
+ letta/settings.py,sha256=wqKdD4C9HjGWvQlbQN69LK6s_TYj4IT-au_sa1Ad6zE,6011
236
230
  letta/streaming_interface.py,sha256=lo2VAQRUJOdWTijwnXuKOC9uejqr2siUAEmZiQUXkj8,15710
237
231
  letta/streaming_utils.py,sha256=pJExJe6OgWDyRgzxbsSuT5JrVsXNlZP4hrT4Xu_z3Po,11778
238
- letta/system.py,sha256=buKYPqG5n2x41hVmWpu6JUpyd7vTWED9Km2_M7dLrvk,6960
232
+ letta/system.py,sha256=iCcjvMKXvG1sa18Suy8Gjoa0djYGiPKi3ywMECce40Y,6974
239
233
  letta/utils.py,sha256=FQgWuYF0CTCIyH41rVy_rD5_ATPIlBZ24ovBtf3T1tI,33291
240
- letta_nightly-0.6.13.dev20250122185528.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
241
- letta_nightly-0.6.13.dev20250122185528.dist-info/METADATA,sha256=HEERHHQpqlMNHztkYKNsP5mw81fqR-NEEyb407moZUU,22116
242
- letta_nightly-0.6.13.dev20250122185528.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
243
- letta_nightly-0.6.13.dev20250122185528.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
244
- letta_nightly-0.6.13.dev20250122185528.dist-info/RECORD,,
234
+ letta_nightly-0.6.14.dev20250123104106.dist-info/LICENSE,sha256=mExtuZ_GYJgDEI38GWdiEYZizZS4KkVt2SF1g_GPNhI,10759
235
+ letta_nightly-0.6.14.dev20250123104106.dist-info/METADATA,sha256=Y_Nyei1BFenDkYkoGD9sgh7m5yuNySO6JcCvfrcWoqs,22116
236
+ letta_nightly-0.6.14.dev20250123104106.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
237
+ letta_nightly-0.6.14.dev20250123104106.dist-info/entry_points.txt,sha256=2zdiyGNEZGV5oYBuS-y2nAAgjDgcC9yM_mHJBFSRt5U,40
238
+ letta_nightly-0.6.14.dev20250123104106.dist-info/RECORD,,
File without changes
@@ -1,115 +0,0 @@
1
- from typing import List
2
-
3
- from fastapi import APIRouter, Body, HTTPException, Path, Query
4
-
5
- from letta.constants import DEFAULT_PRESET
6
- from letta.schemas.openai.openai import AssistantFile, OpenAIAssistant
7
- from letta.server.rest_api.routers.openai.assistants.schemas import (
8
- CreateAssistantFileRequest,
9
- CreateAssistantRequest,
10
- DeleteAssistantFileResponse,
11
- DeleteAssistantResponse,
12
- )
13
- from letta.utils import get_utc_time
14
-
15
- router = APIRouter()
16
-
17
-
18
- # TODO: implement mechanism for creating/authenticating users associated with a bearer token
19
- router = APIRouter(prefix="/v1/assistants", tags=["assistants"])
20
-
21
-
22
- # create assistant (Letta agent)
23
- @router.post("/", response_model=OpenAIAssistant)
24
- def create_assistant(request: CreateAssistantRequest = Body(...)):
25
- # TODO: create preset
26
- return OpenAIAssistant(
27
- id=DEFAULT_PRESET,
28
- name="default_preset",
29
- description=request.description,
30
- created_at=int(get_utc_time().timestamp()),
31
- model=request.model,
32
- instructions=request.instructions,
33
- tools=request.tools,
34
- file_ids=request.file_ids,
35
- metadata=request.metadata,
36
- )
37
-
38
-
39
- @router.post("/{assistant_id}/files", response_model=AssistantFile)
40
- def create_assistant_file(
41
- assistant_id: str = Path(..., description="The unique identifier of the assistant."),
42
- request: CreateAssistantFileRequest = Body(...),
43
- ):
44
- # TODO: add file to assistant
45
- return AssistantFile(
46
- id=request.file_id,
47
- created_at=int(get_utc_time().timestamp()),
48
- assistant_id=assistant_id,
49
- )
50
-
51
-
52
- @router.get("/", response_model=List[OpenAIAssistant])
53
- def list_assistants(
54
- limit: int = Query(1000, description="How many assistants to retrieve."),
55
- order: str = Query("asc", description="Order of assistants to retrieve (either 'asc' or 'desc')."),
56
- after: str = Query(None, description="A cursor for use in pagination. `after` is an object ID that defines your place in the list."),
57
- before: str = Query(None, description="A cursor for use in pagination. `after` is an object ID that defines your place in the list."),
58
- ):
59
- # TODO: implement list assistants (i.e. list available Letta presets)
60
- raise HTTPException(status_code=404, detail="Not yet implemented (coming soon)")
61
-
62
-
63
- @router.get("/{assistant_id}/files", response_model=List[AssistantFile])
64
- def list_assistant_files(
65
- assistant_id: str = Path(..., description="The unique identifier of the assistant."),
66
- limit: int = Query(1000, description="How many files to retrieve."),
67
- order: str = Query("asc", description="Order of files to retrieve (either 'asc' or 'desc')."),
68
- after: str = Query(None, description="A cursor for use in pagination. `after` is an object ID that defines your place in the list."),
69
- before: str = Query(None, description="A cursor for use in pagination. `after` is an object ID that defines your place in the list."),
70
- ):
71
- # TODO: list attached data sources to preset
72
- raise HTTPException(status_code=404, detail="Not yet implemented (coming soon)")
73
-
74
-
75
- @router.get("/{assistant_id}", response_model=OpenAIAssistant)
76
- def retrieve_assistant(
77
- assistant_id: str = Path(..., description="The unique identifier of the assistant."),
78
- ):
79
- # TODO: get and return preset
80
- raise HTTPException(status_code=404, detail="Not yet implemented (coming soon)")
81
-
82
-
83
- @router.get("/{assistant_id}/files/{file_id}", response_model=AssistantFile)
84
- def retrieve_assistant_file(
85
- assistant_id: str = Path(..., description="The unique identifier of the assistant."),
86
- file_id: str = Path(..., description="The unique identifier of the file."),
87
- ):
88
- # TODO: return data source attached to preset
89
- raise HTTPException(status_code=404, detail="Not yet implemented (coming soon)")
90
-
91
-
92
- @router.post("/{assistant_id}", response_model=OpenAIAssistant)
93
- def modify_assistant(
94
- assistant_id: str = Path(..., description="The unique identifier of the assistant."),
95
- request: CreateAssistantRequest = Body(...),
96
- ):
97
- # TODO: modify preset
98
- raise HTTPException(status_code=404, detail="Not yet implemented (coming soon)")
99
-
100
-
101
- @router.delete("/{assistant_id}", response_model=DeleteAssistantResponse)
102
- def delete_assistant(
103
- assistant_id: str = Path(..., description="The unique identifier of the assistant."),
104
- ):
105
- # TODO: delete preset
106
- raise HTTPException(status_code=404, detail="Not yet implemented (coming soon)")
107
-
108
-
109
- @router.delete("/{assistant_id}/files/{file_id}", response_model=DeleteAssistantFileResponse)
110
- def delete_assistant_file(
111
- assistant_id: str = Path(..., description="The unique identifier of the assistant."),
112
- file_id: str = Path(..., description="The unique identifier of the file."),
113
- ):
114
- # TODO: delete source on preset
115
- raise HTTPException(status_code=404, detail="Not yet implemented (coming soon)")
@@ -1,115 +0,0 @@
1
- from typing import List, Optional
2
-
3
- from pydantic import BaseModel, Field
4
-
5
- from letta.schemas.openai.openai import MessageRoleType, OpenAIMessage, OpenAIThread, ToolCall, ToolCallOutput
6
-
7
-
8
- class CreateAssistantRequest(BaseModel):
9
- model: str = Field(..., description="The model to use for the assistant.")
10
- name: str = Field(..., description="The name of the assistant.")
11
- description: str = Field(None, description="The description of the assistant.")
12
- instructions: str = Field(..., description="The instructions for the assistant.")
13
- tools: List[str] = Field(None, description="The tools used by the assistant.")
14
- file_ids: List[str] = Field(None, description="List of file IDs associated with the assistant.")
15
- metadata: dict = Field(None, description="Metadata associated with the assistant.")
16
-
17
- # letta-only (not openai)
18
- embedding_model: str = Field(None, description="The model to use for the assistant.")
19
-
20
- ## TODO: remove
21
- # user_id: str = Field(..., description="The unique identifier of the user.")
22
-
23
-
24
- class CreateThreadRequest(BaseModel):
25
- messages: Optional[List[str]] = Field(None, description="List of message IDs associated with the thread.")
26
- metadata: Optional[dict] = Field(None, description="Metadata associated with the thread.")
27
-
28
- # letta-only
29
- assistant_name: Optional[str] = Field(None, description="The name of the assistant (i.e. Letta preset)")
30
-
31
-
32
- class ModifyThreadRequest(BaseModel):
33
- metadata: dict = Field(None, description="Metadata associated with the thread.")
34
-
35
-
36
- class ModifyMessageRequest(BaseModel):
37
- metadata: dict = Field(None, description="Metadata associated with the message.")
38
-
39
-
40
- class ModifyRunRequest(BaseModel):
41
- metadata: dict = Field(None, description="Metadata associated with the run.")
42
-
43
-
44
- class CreateMessageRequest(BaseModel):
45
- role: str = Field(..., description="Role of the message sender (either 'user' or 'system')")
46
- content: str = Field(..., description="The message content to be processed by the agent.")
47
- file_ids: Optional[List[str]] = Field(None, description="List of file IDs associated with the message.")
48
- metadata: Optional[dict] = Field(None, description="Metadata associated with the message.")
49
-
50
-
51
- class UserMessageRequest(BaseModel):
52
- user_id: str = Field(..., description="The unique identifier of the user.")
53
- agent_id: str = Field(..., description="The unique identifier of the agent.")
54
- message: str = Field(..., description="The message content to be processed by the agent.")
55
- stream: bool = Field(default=False, description="Flag to determine if the response should be streamed. Set to True for streaming.")
56
- role: MessageRoleType = Field(default=MessageRoleType.user, description="Role of the message sender (either 'user' or 'system')")
57
-
58
-
59
- class UserMessageResponse(BaseModel):
60
- messages: List[dict] = Field(..., description="List of messages generated by the agent in response to the received message.")
61
-
62
-
63
- class GetAgentMessagesRequest(BaseModel):
64
- user_id: str = Field(..., description="The unique identifier of the user.")
65
- agent_id: str = Field(..., description="The unique identifier of the agent.")
66
- start: int = Field(..., description="Message index to start on (reverse chronological).")
67
- count: int = Field(..., description="How many messages to retrieve.")
68
-
69
-
70
- class ListMessagesResponse(BaseModel):
71
- messages: List[OpenAIMessage] = Field(..., description="List of message objects.")
72
-
73
-
74
- class CreateAssistantFileRequest(BaseModel):
75
- file_id: str = Field(..., description="The unique identifier of the file.")
76
-
77
-
78
- class CreateRunRequest(BaseModel):
79
- assistant_id: str = Field(..., description="The unique identifier of the assistant.")
80
- model: Optional[str] = Field(None, description="The model used by the run.")
81
- instructions: str = Field(..., description="The instructions for the run.")
82
- additional_instructions: Optional[str] = Field(None, description="Additional instructions for the run.")
83
- tools: Optional[List[ToolCall]] = Field(None, description="The tools used by the run (overrides assistant).")
84
- metadata: Optional[dict] = Field(None, description="Metadata associated with the run.")
85
-
86
-
87
- class CreateThreadRunRequest(BaseModel):
88
- assistant_id: str = Field(..., description="The unique identifier of the assistant.")
89
- thread: OpenAIThread = Field(..., description="The thread to run.")
90
- model: str = Field(..., description="The model used by the run.")
91
- instructions: str = Field(..., description="The instructions for the run.")
92
- tools: Optional[List[ToolCall]] = Field(None, description="The tools used by the run (overrides assistant).")
93
- metadata: Optional[dict] = Field(None, description="Metadata associated with the run.")
94
-
95
-
96
- class DeleteAssistantResponse(BaseModel):
97
- id: str = Field(..., description="The unique identifier of the agent.")
98
- object: str = "assistant.deleted"
99
- deleted: bool = Field(..., description="Whether the agent was deleted.")
100
-
101
-
102
- class DeleteAssistantFileResponse(BaseModel):
103
- id: str = Field(..., description="The unique identifier of the file.")
104
- object: str = "assistant.file.deleted"
105
- deleted: bool = Field(..., description="Whether the file was deleted.")
106
-
107
-
108
- class DeleteThreadResponse(BaseModel):
109
- id: str = Field(..., description="The unique identifier of the agent.")
110
- object: str = "thread.deleted"
111
- deleted: bool = Field(..., description="Whether the agent was deleted.")
112
-
113
-
114
- class SubmitToolOutputsToRunRequest(BaseModel):
115
- tools_outputs: List[ToolCallOutput] = Field(..., description="The tool outputs to submit.")
@@ -1,120 +0,0 @@
1
- import json
2
- from typing import TYPE_CHECKING, Optional
3
-
4
- from fastapi import APIRouter, Body, Depends, Header, HTTPException
5
-
6
- from letta.schemas.letta_message import LettaMessage, ToolCall
7
- from letta.schemas.openai.chat_completion_request import ChatCompletionRequest
8
- from letta.schemas.openai.chat_completion_response import ChatCompletionResponse, Choice, Message, UsageStatistics
9
-
10
- # TODO this belongs in a controller!
11
- from letta.server.rest_api.utils import get_letta_server
12
-
13
- if TYPE_CHECKING:
14
- pass
15
-
16
- from letta.server.server import SyncServer
17
- from letta.utils import get_utc_time
18
-
19
- router = APIRouter(prefix="/v1/chat/completions", tags=["chat_completions"])
20
-
21
-
22
- @router.post("/", response_model=ChatCompletionResponse)
23
- async def create_chat_completion(
24
- completion_request: ChatCompletionRequest = Body(...),
25
- server: "SyncServer" = Depends(get_letta_server),
26
- user_id: Optional[str] = Header(None, alias="user_id"), # Extract user_id from header, default to None if not present
27
- ):
28
- """Send a message to a Letta agent via a /chat/completions completion_request
29
- The bearer token will be used to identify the user.
30
- The 'user' field in the completion_request should be set to the agent ID.
31
- """
32
- actor = server.user_manager.get_user_or_default(user_id=user_id)
33
-
34
- agent_id = completion_request.user
35
- if agent_id is None:
36
- raise HTTPException(status_code=400, detail="Must pass agent_id in the 'user' field")
37
-
38
- messages = completion_request.messages
39
- if messages is None:
40
- raise HTTPException(status_code=400, detail="'messages' field must not be empty")
41
- if len(messages) > 1:
42
- raise HTTPException(status_code=400, detail="'messages' field must be a list of length 1")
43
- if messages[0].role != "user":
44
- raise HTTPException(status_code=400, detail="'messages[0].role' must be a 'user'")
45
-
46
- input_message = completion_request.messages[0]
47
- if completion_request.stream:
48
- print("Starting streaming OpenAI proxy response")
49
-
50
- # TODO(charles) support multimodal parts
51
- assert isinstance(input_message.content, str)
52
-
53
- return await server.send_message_to_agent(
54
- agent_id=agent_id,
55
- actor=actor,
56
- message=input_message.content, # TODO: This is broken
57
- # Turn streaming ON
58
- stream_steps=True,
59
- stream_tokens=True,
60
- # Turn on ChatCompletion mode (eg remaps send_message to content)
61
- chat_completion_mode=True,
62
- )
63
-
64
- else:
65
- print("Starting non-streaming OpenAI proxy response")
66
-
67
- # TODO(charles) support multimodal parts
68
- assert isinstance(input_message.content, str)
69
-
70
- response_messages = await server.send_message_to_agent(
71
- agent_id=agent_id,
72
- actor=actor,
73
- message=input_message.content, # TODO: This is broken
74
- # Turn streaming OFF
75
- stream_steps=False,
76
- stream_tokens=False,
77
- )
78
- # print(response_messages)
79
-
80
- # Concatenate all send_message outputs together
81
- id = ""
82
- visible_message_str = ""
83
- created_at = None
84
- for letta_msg in response_messages.messages:
85
- assert isinstance(letta_msg, LettaMessage)
86
- if isinstance(letta_msg, ToolCall):
87
- if letta_msg.name and letta_msg.name == "send_message":
88
- try:
89
- letta_function_call_args = json.loads(letta_msg.arguments)
90
- visible_message_str += letta_function_call_args["message"]
91
- id = letta_msg.id
92
- created_at = letta_msg.date
93
- except:
94
- print(f"Failed to parse Letta message: {str(letta_msg)}")
95
- else:
96
- print(f"Skipping function_call: {str(letta_msg)}")
97
- else:
98
- print(f"Skipping message: {str(letta_msg)}")
99
-
100
- response = ChatCompletionResponse(
101
- id=id,
102
- created=created_at if created_at else get_utc_time(),
103
- choices=[
104
- Choice(
105
- finish_reason="stop",
106
- index=0,
107
- message=Message(
108
- role="assistant",
109
- content=visible_message_str,
110
- ),
111
- )
112
- ],
113
- # TODO add real usage
114
- usage=UsageStatistics(
115
- completion_tokens=0,
116
- prompt_tokens=0,
117
- total_tokens=0,
118
- ),
119
- )
120
- return response