letta-nightly 0.5.0.dev20241023104105__tar.gz → 0.5.1.dev20241023193051__tar.gz

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.

Files changed (209) hide show
  1. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/PKG-INFO +1 -1
  2. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/__init__.py +1 -1
  3. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/constants.py +3 -3
  4. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/metadata.py +0 -86
  5. letta_nightly-0.5.1.dev20241023193051/letta/orm/errors.py +6 -0
  6. letta_nightly-0.5.1.dev20241023193051/letta/orm/mixins.py +67 -0
  7. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/orm/organization.py +7 -14
  8. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/orm/sqlalchemy_base.py +3 -13
  9. letta_nightly-0.5.1.dev20241023193051/letta/orm/user.py +25 -0
  10. letta_nightly-0.5.1.dev20241023193051/letta/schemas/user.py +40 -0
  11. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/organizations.py +2 -2
  12. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/users.py +6 -7
  13. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/server.py +47 -66
  14. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/services/organization_manager.py +17 -7
  15. letta_nightly-0.5.1.dev20241023193051/letta/services/user_manager.py +99 -0
  16. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/settings.py +5 -0
  17. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/pyproject.toml +1 -1
  18. letta_nightly-0.5.0.dev20241023104105/letta/orm/errors.py +0 -2
  19. letta_nightly-0.5.0.dev20241023104105/letta/orm/mixins.py +0 -40
  20. letta_nightly-0.5.0.dev20241023104105/letta/schemas/user.py +0 -33
  21. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/LICENSE +0 -0
  22. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/README.md +0 -0
  23. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/__main__.py +0 -0
  24. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/agent.py +0 -0
  25. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/agent_store/chroma.py +0 -0
  26. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/agent_store/db.py +0 -0
  27. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/agent_store/lancedb.py +0 -0
  28. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/agent_store/milvus.py +0 -0
  29. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/agent_store/qdrant.py +0 -0
  30. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/agent_store/storage.py +0 -0
  31. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/benchmark/benchmark.py +0 -0
  32. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/benchmark/constants.py +0 -0
  33. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/cli/cli.py +0 -0
  34. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/cli/cli_config.py +0 -0
  35. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/cli/cli_load.py +0 -0
  36. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/client/__init__.py +0 -0
  37. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/client/client.py +0 -0
  38. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/client/streaming.py +0 -0
  39. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/client/utils.py +0 -0
  40. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/config.py +0 -0
  41. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/credentials.py +0 -0
  42. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/data_sources/connectors.py +0 -0
  43. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/data_sources/connectors_helper.py +0 -0
  44. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/embeddings.py +0 -0
  45. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/errors.py +0 -0
  46. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/functions/__init__.py +0 -0
  47. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/functions/function_sets/base.py +0 -0
  48. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/functions/function_sets/extras.py +0 -0
  49. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/functions/functions.py +0 -0
  50. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/functions/helpers.py +0 -0
  51. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/functions/schema_generator.py +0 -0
  52. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/humans/__init__.py +0 -0
  53. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/humans/examples/basic.txt +0 -0
  54. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/humans/examples/cs_phd.txt +0 -0
  55. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/interface.py +0 -0
  56. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/__init__.py +0 -0
  57. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/anthropic.py +0 -0
  58. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/azure_openai.py +0 -0
  59. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/azure_openai_constants.py +0 -0
  60. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/cohere.py +0 -0
  61. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/google_ai.py +0 -0
  62. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/helpers.py +0 -0
  63. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/llm_api_tools.py +0 -0
  64. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/mistral.py +0 -0
  65. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/llm_api/openai.py +0 -0
  66. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/README.md +0 -0
  67. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/__init__.py +0 -0
  68. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/chat_completion_proxy.py +0 -0
  69. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/constants.py +0 -0
  70. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/function_parser.py +0 -0
  71. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/grammars/__init__.py +0 -0
  72. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
  73. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/grammars/json.gbnf +0 -0
  74. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
  75. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/json_parser.py +0 -0
  76. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/koboldcpp/api.py +0 -0
  77. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/koboldcpp/settings.py +0 -0
  78. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llamacpp/api.py +0 -0
  79. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llamacpp/settings.py +0 -0
  80. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
  81. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
  82. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
  83. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
  84. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
  85. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
  86. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
  87. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
  88. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
  89. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/lmstudio/api.py +0 -0
  90. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/lmstudio/settings.py +0 -0
  91. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/ollama/api.py +0 -0
  92. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/ollama/settings.py +0 -0
  93. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/settings/__init__.py +0 -0
  94. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
  95. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/settings/settings.py +0 -0
  96. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/settings/simple.py +0 -0
  97. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/utils.py +0 -0
  98. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/vllm/api.py +0 -0
  99. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/webui/api.py +0 -0
  100. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/webui/legacy_api.py +0 -0
  101. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/webui/legacy_settings.py +0 -0
  102. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/local_llm/webui/settings.py +0 -0
  103. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/log.py +0 -0
  104. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/main.py +0 -0
  105. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/memory.py +0 -0
  106. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/o1_agent.py +0 -0
  107. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/openai_backcompat/__init__.py +0 -0
  108. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/openai_backcompat/openai_object.py +0 -0
  109. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/orm/__all__.py +0 -0
  110. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/orm/__init__.py +0 -0
  111. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/orm/base.py +0 -0
  112. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/orm/enums.py +0 -0
  113. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/persistence_manager.py +0 -0
  114. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/__init__.py +0 -0
  115. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/anna_pa.txt +0 -0
  116. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/google_search_persona.txt +0 -0
  117. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/memgpt_doc.txt +0 -0
  118. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/memgpt_starter.txt +0 -0
  119. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/o1_persona.txt +0 -0
  120. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/sam.txt +0 -0
  121. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/sam_pov.txt +0 -0
  122. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
  123. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/personas/examples/sqldb/test.db +0 -0
  124. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/__init__.py +0 -0
  125. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/gpt_summarize.py +0 -0
  126. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/gpt_system.py +0 -0
  127. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_base.txt +0 -0
  128. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_chat.txt +0 -0
  129. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
  130. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
  131. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_doc.txt +0 -0
  132. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
  133. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
  134. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
  135. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/prompts/system/memgpt_modified_o1.txt +0 -0
  136. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/providers.py +0 -0
  137. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/pytest.ini +0 -0
  138. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/agent.py +0 -0
  139. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/api_key.py +0 -0
  140. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/block.py +0 -0
  141. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/embedding_config.py +0 -0
  142. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/enums.py +0 -0
  143. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/file.py +0 -0
  144. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/health.py +0 -0
  145. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/job.py +0 -0
  146. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/letta_base.py +0 -0
  147. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/letta_message.py +0 -0
  148. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/letta_request.py +0 -0
  149. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/letta_response.py +0 -0
  150. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/llm_config.py +0 -0
  151. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/memory.py +0 -0
  152. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/message.py +0 -0
  153. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/openai/chat_completion_request.py +0 -0
  154. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/openai/chat_completion_response.py +0 -0
  155. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/openai/chat_completions.py +0 -0
  156. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/openai/embedding_response.py +0 -0
  157. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/openai/openai.py +0 -0
  158. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/organization.py +0 -0
  159. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/passage.py +0 -0
  160. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/source.py +0 -0
  161. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/tool.py +0 -0
  162. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/schemas/usage.py +0 -0
  163. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/__init__.py +0 -0
  164. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/constants.py +0 -0
  165. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/__init__.py +0 -0
  166. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/admin/__init__.py +0 -0
  167. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/admin/agents.py +0 -0
  168. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/admin/tools.py +0 -0
  169. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/admin/users.py +0 -0
  170. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/app.py +0 -0
  171. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/auth/__init__.py +0 -0
  172. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/auth/index.py +0 -0
  173. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/auth_token.py +0 -0
  174. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/interface.py +0 -0
  175. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/__init__.py +0 -0
  176. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/openai/__init__.py +0 -0
  177. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
  178. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
  179. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
  180. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
  181. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
  182. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
  183. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/__init__.py +0 -0
  184. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/agents.py +0 -0
  185. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/blocks.py +0 -0
  186. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/health.py +0 -0
  187. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/jobs.py +0 -0
  188. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/llms.py +0 -0
  189. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/sources.py +0 -0
  190. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/routers/v1/tools.py +0 -0
  191. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/static_files.py +0 -0
  192. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/rest_api/utils.py +0 -0
  193. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/startup.sh +0 -0
  194. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
  195. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/static_files/assets/index-d6b3669a.js +0 -0
  196. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/static_files/favicon.ico +0 -0
  197. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/static_files/index.html +0 -0
  198. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
  199. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/utils.py +0 -0
  200. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/ws_api/__init__.py +0 -0
  201. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/ws_api/example_client.py +0 -0
  202. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/ws_api/interface.py +0 -0
  203. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/ws_api/protocol.py +0 -0
  204. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/server/ws_api/server.py +0 -0
  205. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/services/__init__.py +0 -0
  206. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/streaming_interface.py +0 -0
  207. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/streaming_utils.py +0 -0
  208. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/system.py +0 -0
  209. {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241023193051}/letta/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-nightly
3
- Version: 0.5.0.dev20241023104105
3
+ Version: 0.5.1.dev20241023193051
4
4
  Summary: Create LLM agents with long-term memory and custom tools
5
5
  License: Apache License
6
6
  Author: Letta Team
@@ -1,4 +1,4 @@
1
- __version__ = "0.5.0"
1
+ __version__ = "0.5.1"
2
2
 
3
3
  # import clients
4
4
  from letta.client.client import LocalClient, RESTClient, create_client
@@ -4,13 +4,13 @@ from logging import CRITICAL, DEBUG, ERROR, INFO, NOTSET, WARN, WARNING
4
4
  LETTA_DIR = os.path.join(os.path.expanduser("~"), ".letta")
5
5
 
6
6
  # Defaults
7
- DEFAULT_USER_ID = "user-00000000"
7
+ DEFAULT_USER_ID = "user-00000000-0000-4000-8000-000000000000"
8
8
  # This UUID follows the UUID4 rules:
9
9
  # The 13th character (4) indicates it's version 4.
10
10
  # The first character of the third segment (8) ensures the variant is correctly set.
11
11
  DEFAULT_ORG_ID = "organization-00000000-0000-4000-8000-000000000000"
12
- DEFAULT_USER_NAME = "default"
13
- DEFAULT_ORG_NAME = "default"
12
+ DEFAULT_USER_NAME = "default_user"
13
+ DEFAULT_ORG_NAME = "default_org"
14
14
 
15
15
 
16
16
  # String in the error message for when the context window is too large
@@ -15,7 +15,6 @@ from sqlalchemy import (
15
15
  String,
16
16
  TypeDecorator,
17
17
  asc,
18
- desc,
19
18
  or_,
20
19
  )
21
20
  from sqlalchemy.sql import func
@@ -31,8 +30,6 @@ from letta.schemas.file import FileMetadata
31
30
  from letta.schemas.job import Job
32
31
  from letta.schemas.llm_config import LLMConfig
33
32
  from letta.schemas.memory import Memory
34
-
35
- # from letta.schemas.message import Message, Passage, Record, RecordType, ToolCall
36
33
  from letta.schemas.openai.chat_completions import ToolCall, ToolCallFunction
37
34
  from letta.schemas.source import Source
38
35
  from letta.schemas.tool import Tool
@@ -154,25 +151,6 @@ class ToolCallColumn(TypeDecorator):
154
151
  return value
155
152
 
156
153
 
157
- class UserModel(Base):
158
- __tablename__ = "users"
159
- __table_args__ = {"extend_existing": True}
160
-
161
- id = Column(String, primary_key=True)
162
- org_id = Column(String)
163
- name = Column(String, nullable=False)
164
- created_at = Column(DateTime(timezone=True))
165
-
166
- # TODO: what is this?
167
- policies_accepted = Column(Boolean, nullable=False, default=False)
168
-
169
- def __repr__(self) -> str:
170
- return f"<User(id='{self.id}' name='{self.name}')>"
171
-
172
- def to_record(self) -> User:
173
- return User(id=self.id, name=self.name, created_at=self.created_at, org_id=self.org_id)
174
-
175
-
176
154
  # TODO: eventually store providers?
177
155
  # class Provider(Base):
178
156
  # __tablename__ = "providers"
@@ -497,15 +475,6 @@ class MetadataStore:
497
475
  tokens = [r.to_record() for r in results]
498
476
  return tokens
499
477
 
500
- @enforce_types
501
- def get_user_from_api_key(self, api_key: str) -> Optional[User]:
502
- """Get the user associated with a given API key"""
503
- token = self.get_api_key(api_key=api_key)
504
- if token is None:
505
- raise ValueError(f"Provided token does not exist")
506
- else:
507
- return self.get_user(user_id=token.user_id)
508
-
509
478
  @enforce_types
510
479
  def create_agent(self, agent: AgentState):
511
480
  # insert into agent table
@@ -527,14 +496,6 @@ class MetadataStore:
527
496
  session.add(SourceModel(**vars(source)))
528
497
  session.commit()
529
498
 
530
- @enforce_types
531
- def create_user(self, user: User):
532
- with self.session_maker() as session:
533
- if session.query(UserModel).filter(UserModel.id == user.id).count() > 0:
534
- raise ValueError(f"User with id {user.id} already exists")
535
- session.add(UserModel(**vars(user)))
536
- session.commit()
537
-
538
499
  @enforce_types
539
500
  def create_block(self, block: Block):
540
501
  with self.session_maker() as session:
@@ -573,12 +534,6 @@ class MetadataStore:
573
534
  session.query(AgentModel).filter(AgentModel.id == agent.id).update(fields)
574
535
  session.commit()
575
536
 
576
- @enforce_types
577
- def update_user(self, user: User):
578
- with self.session_maker() as session:
579
- session.query(UserModel).filter(UserModel.id == user.id).update(vars(user))
580
- session.commit()
581
-
582
537
  @enforce_types
583
538
  def update_source(self, source: Source):
584
539
  with self.session_maker() as session:
@@ -657,23 +612,6 @@ class MetadataStore:
657
612
 
658
613
  session.commit()
659
614
 
660
- @enforce_types
661
- def delete_user(self, user_id: str):
662
- with self.session_maker() as session:
663
- # delete from users table
664
- session.query(UserModel).filter(UserModel.id == user_id).delete()
665
-
666
- # delete associated agents
667
- session.query(AgentModel).filter(AgentModel.user_id == user_id).delete()
668
-
669
- # delete associated sources
670
- session.query(SourceModel).filter(SourceModel.user_id == user_id).delete()
671
-
672
- # delete associated mappings
673
- session.query(AgentSourceMappingModel).filter(AgentSourceMappingModel.user_id == user_id).delete()
674
-
675
- session.commit()
676
-
677
615
  @enforce_types
678
616
  def list_tools(self, cursor: Optional[str] = None, limit: Optional[int] = 50, user_id: Optional[str] = None) -> List[ToolModel]:
679
617
  with self.session_maker() as session:
@@ -719,30 +657,6 @@ class MetadataStore:
719
657
  assert len(results) == 1, f"Expected 1 result, got {len(results)}" # should only be one result
720
658
  return results[0].to_record()
721
659
 
722
- @enforce_types
723
- def get_user(self, user_id: str) -> Optional[User]:
724
- with self.session_maker() as session:
725
- results = session.query(UserModel).filter(UserModel.id == user_id).all()
726
- if len(results) == 0:
727
- return None
728
- assert len(results) == 1, f"Expected 1 result, got {len(results)}"
729
- return results[0].to_record()
730
-
731
- @enforce_types
732
- def get_all_users(self, cursor: Optional[str] = None, limit: Optional[int] = 50):
733
- with self.session_maker() as session:
734
- query = session.query(UserModel).order_by(desc(UserModel.id))
735
- if cursor:
736
- query = query.filter(UserModel.id < cursor)
737
- results = query.limit(limit).all()
738
- if not results:
739
- return None, []
740
- user_records = [r.to_record() for r in results]
741
- next_cursor = user_records[-1].id
742
- assert isinstance(next_cursor, str)
743
-
744
- return next_cursor, user_records
745
-
746
660
  @enforce_types
747
661
  def get_source(
748
662
  self, source_id: Optional[str] = None, user_id: Optional[str] = None, source_name: Optional[str] = None
@@ -0,0 +1,6 @@
1
+ class NoResultFound(Exception):
2
+ """A record or records cannot be found given the provided search params"""
3
+
4
+
5
+ class MalformedIdError(Exception):
6
+ """An id not in the right format, most likely violating uuid4 format."""
@@ -0,0 +1,67 @@
1
+ from typing import Optional
2
+ from uuid import UUID
3
+
4
+ from sqlalchemy import ForeignKey, String
5
+ from sqlalchemy.orm import Mapped, mapped_column
6
+
7
+ from letta.orm.base import Base
8
+ from letta.orm.errors import MalformedIdError
9
+
10
+
11
+ def is_valid_uuid4(uuid_string: str) -> bool:
12
+ """Check if a string is a valid UUID4."""
13
+ try:
14
+ uuid_obj = UUID(uuid_string)
15
+ return uuid_obj.version == 4
16
+ except ValueError:
17
+ return False
18
+
19
+
20
+ def _relation_getter(instance: "Base", prop: str) -> Optional[str]:
21
+ """Get relation and return id with prefix as a string."""
22
+ prefix = prop.replace("_", "")
23
+ formatted_prop = f"_{prop}_id"
24
+ try:
25
+ id_ = getattr(instance, formatted_prop) # Get the string id directly
26
+ return f"{prefix}-{id_}"
27
+ except AttributeError:
28
+ return None
29
+
30
+
31
+ def _relation_setter(instance: "Base", prop: str, value: str) -> None:
32
+ """Set relation using the id with prefix, ensuring the id is a valid UUIDv4."""
33
+ formatted_prop = f"_{prop}_id"
34
+ prefix = prop.replace("_", "")
35
+ if not value:
36
+ setattr(instance, formatted_prop, None)
37
+ return
38
+ try:
39
+ found_prefix, id_ = value.split("-", 1)
40
+ except ValueError as e:
41
+ raise MalformedIdError(f"{value} is not a valid ID.") from e
42
+
43
+ # Ensure prefix matches
44
+ assert found_prefix == prefix, f"{found_prefix} is not a valid id prefix, expecting {prefix}"
45
+
46
+ # Validate that the id is a valid UUID4 string
47
+ if not is_valid_uuid4(id_):
48
+ raise MalformedIdError(f"Hash segment of {value} is not a valid UUID4")
49
+
50
+ setattr(instance, formatted_prop, id_) # Store id as a string
51
+
52
+
53
+ class OrganizationMixin(Base):
54
+ """Mixin for models that belong to an organization."""
55
+
56
+ __abstract__ = True
57
+
58
+ # Changed _organization_id to store string (still a valid UUID4 string)
59
+ _organization_id: Mapped[str] = mapped_column(String, ForeignKey("organization._id"))
60
+
61
+ @property
62
+ def organization_id(self) -> str:
63
+ return _relation_getter(self, "organization")
64
+
65
+ @organization_id.setter
66
+ def organization_id(self, value: str) -> None:
67
+ _relation_setter(self, "organization", value)
@@ -1,35 +1,28 @@
1
- from typing import TYPE_CHECKING
1
+ from typing import TYPE_CHECKING, List
2
2
 
3
- from sqlalchemy.exc import NoResultFound
4
- from sqlalchemy.orm import Mapped, mapped_column
3
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
5
4
 
6
5
  from letta.orm.sqlalchemy_base import SqlalchemyBase
7
6
  from letta.schemas.organization import Organization as PydanticOrganization
8
7
 
9
8
  if TYPE_CHECKING:
10
- from sqlalchemy.orm import Session
9
+
10
+ from letta.orm.user import User
11
11
 
12
12
 
13
13
  class Organization(SqlalchemyBase):
14
14
  """The highest level of the object tree. All Entities belong to one and only one Organization."""
15
15
 
16
- __tablename__ = "organizations"
16
+ __tablename__ = "organization"
17
17
  __pydantic_model__ = PydanticOrganization
18
18
 
19
19
  name: Mapped[str] = mapped_column(doc="The display name of the organization.")
20
20
 
21
+ users: Mapped[List["User"]] = relationship("User", back_populates="organization", cascade="all, delete-orphan")
22
+
21
23
  # TODO: Map these relationships later when we actually make these models
22
24
  # below is just a suggestion
23
- # users: Mapped[List["User"]] = relationship("User", back_populates="organization", cascade="all, delete-orphan")
24
25
  # agents: Mapped[List["Agent"]] = relationship("Agent", back_populates="organization", cascade="all, delete-orphan")
25
26
  # sources: Mapped[List["Source"]] = relationship("Source", back_populates="organization", cascade="all, delete-orphan")
26
27
  # tools: Mapped[List["Tool"]] = relationship("Tool", back_populates="organization", cascade="all, delete-orphan")
27
28
  # documents: Mapped[List["Document"]] = relationship("Document", back_populates="organization", cascade="all, delete-orphan")
28
-
29
- @classmethod
30
- def default(cls, db_session: "Session") -> "Organization":
31
- """Get the default org, or create it if it doesn't exist."""
32
- try:
33
- return db_session.query(cls).filter(cls.name == "Default Organization").one()
34
- except NoResultFound:
35
- return cls(name="Default Organization").create(db_session)
@@ -8,6 +8,7 @@ from sqlalchemy.orm import Mapped, mapped_column
8
8
  from letta.log import get_logger
9
9
  from letta.orm.base import Base, CommonSqlalchemyMetaMixins
10
10
  from letta.orm.errors import NoResultFound
11
+ from letta.orm.mixins import is_valid_uuid4
11
12
 
12
13
  if TYPE_CHECKING:
13
14
  from pydantic import BaseModel
@@ -42,7 +43,7 @@ class SqlalchemyBase(CommonSqlalchemyMetaMixins, Base):
42
43
  return
43
44
  prefix, id_ = value.split("-", 1)
44
45
  assert prefix == self.__prefix__(), f"{prefix} is not a valid id prefix for {self.__class__.__name__}"
45
- assert SqlalchemyBase.is_valid_uuid4(id_), f"{id_} is not a valid uuid4"
46
+ assert is_valid_uuid4(id_), f"{id_} is not a valid uuid4"
46
47
  self._id = id_
47
48
 
48
49
  @classmethod
@@ -78,22 +79,11 @@ class SqlalchemyBase(CommonSqlalchemyMetaMixins, Base):
78
79
  """
79
80
  try:
80
81
  uuid_string = identifier.split("-", 1)[1] if indifferent else identifier.replace(f"{cls.__prefix__()}-", "")
81
- assert SqlalchemyBase.is_valid_uuid4(uuid_string)
82
+ assert is_valid_uuid4(uuid_string)
82
83
  return uuid_string
83
84
  except ValueError as e:
84
85
  raise ValueError(f"{identifier} is not a valid identifier for class {cls.__name__}") from e
85
86
 
86
- @classmethod
87
- def is_valid_uuid4(cls, uuid_string: str) -> bool:
88
- try:
89
- # Try to create a UUID object from the string
90
- uuid_obj = UUID(uuid_string)
91
- # Check if the UUID is version 4
92
- return uuid_obj.version == 4
93
- except ValueError:
94
- # Raised if the string is not a valid UUID
95
- return False
96
-
97
87
  @classmethod
98
88
  def read(
99
89
  cls,
@@ -0,0 +1,25 @@
1
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
2
+
3
+ from letta.orm.mixins import OrganizationMixin
4
+ from letta.orm.organization import Organization
5
+ from letta.orm.sqlalchemy_base import SqlalchemyBase
6
+ from letta.schemas.user import User as PydanticUser
7
+
8
+
9
+ class User(SqlalchemyBase, OrganizationMixin):
10
+ """User ORM class"""
11
+
12
+ __tablename__ = "user"
13
+ __pydantic_model__ = PydanticUser
14
+
15
+ name: Mapped[str] = mapped_column(nullable=False, doc="The display name of the user.")
16
+
17
+ # relationships
18
+ organization: Mapped["Organization"] = relationship("Organization", back_populates="users")
19
+
20
+ # TODO: Add this back later potentially
21
+ # agents: Mapped[List["Agent"]] = relationship(
22
+ # "Agent", secondary="users_agents", back_populates="users", doc="the agents associated with this user."
23
+ # )
24
+ # tokens: Mapped[List["Token"]] = relationship("Token", back_populates="user", doc="the tokens associated with this user.")
25
+ # jobs: Mapped[List["Job"]] = relationship("Job", back_populates="user", doc="the jobs associated with this user.")
@@ -0,0 +1,40 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+
4
+ from pydantic import Field
5
+
6
+ from letta.constants import DEFAULT_ORG_ID
7
+ from letta.schemas.letta_base import LettaBase
8
+
9
+
10
+ class UserBase(LettaBase):
11
+ __id_prefix__ = "user"
12
+
13
+
14
+ class User(UserBase):
15
+ """
16
+ Representation of a user.
17
+
18
+ Parameters:
19
+ id (str): The unique identifier of the user.
20
+ name (str): The name of the user.
21
+ created_at (datetime): The creation date of the user.
22
+ """
23
+
24
+ id: str = Field(..., description="The id of the user.")
25
+ organization_id: Optional[str] = Field(DEFAULT_ORG_ID, description="The organization id of the user")
26
+ name: str = Field(..., description="The name of the user.")
27
+ created_at: datetime = Field(default_factory=datetime.utcnow, description="The creation date of the user.")
28
+ updated_at: datetime = Field(default_factory=datetime.utcnow, description="The update date of the user.")
29
+ is_deleted: bool = Field(False, description="Whether this user is deleted or not.")
30
+
31
+
32
+ class UserCreate(UserBase):
33
+ name: str = Field(..., description="The name of the user.")
34
+ organization_id: str = Field(..., description="The organization id of the user.")
35
+
36
+
37
+ class UserUpdate(UserBase):
38
+ id: str = Field(..., description="The id of the user to update.")
39
+ name: Optional[str] = Field(None, description="The new name of the user.")
40
+ organization_id: Optional[str] = Field(None, description="The new organization id of the user.")
@@ -42,7 +42,7 @@ def create_org(
42
42
  return org
43
43
 
44
44
 
45
- @router.delete("/", tags=["admin"], response_model=Organization, operation_id="delete_organization")
45
+ @router.delete("/", tags=["admin"], response_model=Organization, operation_id="delete_organization_by_id")
46
46
  def delete_org(
47
47
  org_id: str = Query(..., description="The org_id key to be deleted."),
48
48
  server: "SyncServer" = Depends(get_letta_server),
@@ -52,7 +52,7 @@ def delete_org(
52
52
  org = server.organization_manager.get_organization_by_id(org_id=org_id)
53
53
  if org is None:
54
54
  raise HTTPException(status_code=404, detail=f"Organization does not exist")
55
- server.organization_manager.delete_organization(org_id=org_id)
55
+ server.organization_manager.delete_organization_by_id(org_id=org_id)
56
56
  except HTTPException:
57
57
  raise
58
58
  except Exception as e:
@@ -26,7 +26,7 @@ router = APIRouter(prefix="/users", tags=["users", "admin"])
26
26
 
27
27
 
28
28
  @router.get("/", tags=["admin"], response_model=List[User], operation_id="list_users")
29
- def get_all_users(
29
+ def list_users(
30
30
  cursor: Optional[str] = Query(None),
31
31
  limit: Optional[int] = Query(50),
32
32
  server: "SyncServer" = Depends(get_letta_server),
@@ -35,8 +35,7 @@ def get_all_users(
35
35
  Get a list of all users in the database
36
36
  """
37
37
  try:
38
- next_cursor, users = server.ms.get_all_users(cursor=cursor, limit=limit)
39
- # processed_users = [{"user_id": user.id} for user in users]
38
+ next_cursor, users = server.user_manager.list_users(cursor=cursor, limit=limit)
40
39
  except HTTPException:
41
40
  raise
42
41
  except Exception as e:
@@ -53,7 +52,7 @@ def create_user(
53
52
  Create a new user in the database
54
53
  """
55
54
 
56
- user = server.create_user(request)
55
+ user = server.user_manager.create_user(request)
57
56
  return user
58
57
 
59
58
 
@@ -64,10 +63,10 @@ def delete_user(
64
63
  ):
65
64
  # TODO make a soft deletion, instead of a hard deletion
66
65
  try:
67
- user = server.ms.get_user(user_id=user_id)
66
+ user = server.user_manager.get_user_by_id(user_id=user_id)
68
67
  if user is None:
69
68
  raise HTTPException(status_code=404, detail=f"User does not exist")
70
- server.ms.delete_user(user_id=user_id)
69
+ server.user_manager.delete_user_by_id(user_id=user_id)
71
70
  except HTTPException:
72
71
  raise
73
72
  except Exception as e:
@@ -95,7 +94,7 @@ def get_api_keys(
95
94
  """
96
95
  Get a list of all API keys for a user
97
96
  """
98
- if server.ms.get_user(user_id=user_id) is None:
97
+ if server.user_manager.get_user_by_id(user_id=user_id) is None:
99
98
  raise HTTPException(status_code=404, detail=f"User does not exist")
100
99
  api_keys = server.ms.get_all_api_keys_for_user(user_id=user_id)
101
100
  return api_keys