letta-nightly 0.5.0.dev20241023104105__tar.gz → 0.5.1.dev20241024104118__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.
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/PKG-INFO +1 -1
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/__init__.py +1 -1
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/constants.py +3 -3
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/metadata.py +0 -86
- letta_nightly-0.5.1.dev20241024104118/letta/orm/errors.py +6 -0
- letta_nightly-0.5.1.dev20241024104118/letta/orm/mixins.py +67 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/orm/organization.py +7 -14
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/orm/sqlalchemy_base.py +3 -13
- letta_nightly-0.5.1.dev20241024104118/letta/orm/user.py +25 -0
- letta_nightly-0.5.1.dev20241024104118/letta/schemas/user.py +40 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/organizations.py +2 -2
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/users.py +6 -7
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/server.py +47 -66
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/services/organization_manager.py +17 -7
- letta_nightly-0.5.1.dev20241024104118/letta/services/user_manager.py +99 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/settings.py +5 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/pyproject.toml +1 -1
- letta_nightly-0.5.0.dev20241023104105/letta/orm/errors.py +0 -2
- letta_nightly-0.5.0.dev20241023104105/letta/orm/mixins.py +0 -40
- letta_nightly-0.5.0.dev20241023104105/letta/schemas/user.py +0 -33
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/LICENSE +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/README.md +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/__main__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/agent.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/agent_store/chroma.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/agent_store/db.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/agent_store/lancedb.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/agent_store/milvus.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/agent_store/qdrant.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/agent_store/storage.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/benchmark/benchmark.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/benchmark/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/cli/cli.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/cli/cli_config.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/cli/cli_load.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/client/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/client/client.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/client/streaming.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/client/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/config.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/credentials.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/data_sources/connectors.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/data_sources/connectors_helper.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/embeddings.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/errors.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/functions/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/functions/function_sets/base.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/functions/function_sets/extras.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/functions/functions.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/functions/helpers.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/functions/schema_generator.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/humans/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/humans/examples/basic.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/humans/examples/cs_phd.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/interface.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/anthropic.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/azure_openai.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/azure_openai_constants.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/cohere.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/google_ai.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/helpers.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/llm_api_tools.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/mistral.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/llm_api/openai.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/README.md +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/chat_completion_proxy.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/function_parser.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/grammars/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/grammars/json.gbnf +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/json_parser.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/koboldcpp/api.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/koboldcpp/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llamacpp/api.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llamacpp/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/lmstudio/api.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/lmstudio/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/ollama/api.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/ollama/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/settings/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/settings/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/settings/simple.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/vllm/api.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/webui/api.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/webui/legacy_api.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/webui/legacy_settings.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/local_llm/webui/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/log.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/main.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/memory.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/o1_agent.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/openai_backcompat/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/openai_backcompat/openai_object.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/orm/__all__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/orm/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/orm/base.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/orm/enums.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/persistence_manager.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/anna_pa.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/google_search_persona.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/memgpt_doc.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/memgpt_starter.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/o1_persona.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/sam.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/sam_pov.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/personas/examples/sqldb/test.db +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/gpt_summarize.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/gpt_system.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_base.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_chat.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_doc.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/prompts/system/memgpt_modified_o1.txt +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/providers.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/pytest.ini +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/agent.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/api_key.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/block.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/embedding_config.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/enums.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/file.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/health.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/job.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/letta_base.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/letta_message.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/letta_request.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/letta_response.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/llm_config.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/memory.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/message.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/openai/chat_completion_request.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/openai/chat_completion_response.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/openai/chat_completions.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/openai/embedding_response.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/openai/openai.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/organization.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/passage.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/source.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/tool.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/schemas/usage.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/admin/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/admin/agents.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/admin/tools.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/admin/users.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/app.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/auth/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/auth/index.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/auth_token.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/interface.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/openai/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/agents.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/blocks.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/health.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/jobs.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/llms.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/sources.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/routers/v1/tools.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/static_files.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/rest_api/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/startup.sh +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/static_files/assets/index-d6b3669a.js +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/static_files/favicon.ico +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/static_files/index.html +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/ws_api/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/ws_api/example_client.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/ws_api/interface.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/ws_api/protocol.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/server/ws_api/server.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/services/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/streaming_interface.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/streaming_utils.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/system.py +0 -0
- {letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/utils.py +0 -0
{letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/constants.py
RENAMED
|
@@ -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 = "
|
|
13
|
-
DEFAULT_ORG_NAME = "
|
|
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
|
{letta_nightly-0.5.0.dev20241023104105 → letta_nightly-0.5.1.dev20241024104118}/letta/metadata.py
RENAMED
|
@@ -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,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.
|
|
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
|
-
|
|
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__ = "
|
|
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
|
|
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
|
|
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="
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|