letta-nightly 0.5.0.dev20241022104124__tar.gz → 0.5.0.dev20241023104105__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.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/PKG-INFO +2 -1
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/__init__.py +7 -2
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/agent_store/db.py +4 -2
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/cli/cli_config.py +2 -2
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/client/client.py +13 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/constants.py +4 -1
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/embeddings.py +34 -16
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/azure_openai.py +44 -4
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/openai.py +7 -1
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/metadata.py +1 -59
- letta_nightly-0.5.0.dev20241023104105/letta/orm/base.py +75 -0
- letta_nightly-0.5.0.dev20241023104105/letta/orm/enums.py +8 -0
- letta_nightly-0.5.0.dev20241023104105/letta/orm/errors.py +2 -0
- letta_nightly-0.5.0.dev20241023104105/letta/orm/mixins.py +40 -0
- letta_nightly-0.5.0.dev20241023104105/letta/orm/organization.py +35 -0
- letta_nightly-0.5.0.dev20241023104105/letta/orm/sqlalchemy_base.py +214 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/organization.py +3 -3
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/interface.py +47 -9
- letta_nightly-0.5.0.dev20241023104105/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/organizations.py +4 -5
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/server.py +10 -25
- letta_nightly-0.5.0.dev20241023104105/letta/server/ws_api/__init__.py +0 -0
- letta_nightly-0.5.0.dev20241023104105/letta/services/__init__.py +0 -0
- letta_nightly-0.5.0.dev20241023104105/letta/services/organization_manager.py +66 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/pyproject.toml +2 -1
- letta_nightly-0.5.0.dev20241022104124/letta/base.py +0 -3
- letta_nightly-0.5.0.dev20241022104124/letta/client/admin.py +0 -171
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/LICENSE +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/README.md +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/__main__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/agent.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/agent_store/chroma.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/agent_store/lancedb.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/agent_store/milvus.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/agent_store/qdrant.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/agent_store/storage.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/benchmark/benchmark.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/benchmark/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/cli/cli.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/cli/cli_load.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/client/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/client/streaming.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/client/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/config.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/credentials.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/data_sources/connectors.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/data_sources/connectors_helper.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/errors.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/functions/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/functions/function_sets/base.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/functions/function_sets/extras.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/functions/functions.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/functions/helpers.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/functions/schema_generator.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/humans/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/humans/examples/basic.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/humans/examples/cs_phd.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/interface.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/anthropic.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/azure_openai_constants.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/cohere.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/google_ai.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/helpers.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/llm_api_tools.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/llm_api/mistral.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/README.md +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/chat_completion_proxy.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/function_parser.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/grammars/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/grammars/json.gbnf +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/json_parser.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/koboldcpp/api.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/koboldcpp/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llamacpp/api.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llamacpp/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/lmstudio/api.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/lmstudio/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/ollama/api.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/ollama/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/settings/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/settings/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/settings/simple.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/vllm/api.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/webui/api.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/webui/legacy_api.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/webui/legacy_settings.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/local_llm/webui/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/log.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/main.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/memory.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/o1_agent.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/openai_backcompat/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/openai_backcompat/openai_object.py +0 -0
- /letta_nightly-0.5.0.dev20241022104124/letta/personas/__init__.py → /letta_nightly-0.5.0.dev20241023104105/letta/orm/__all__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/prompts → letta_nightly-0.5.0.dev20241023104105/letta/orm}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/persistence_manager.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server → letta_nightly-0.5.0.dev20241023104105/letta/personas}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/anna_pa.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/google_search_persona.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/memgpt_doc.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/memgpt_starter.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/o1_persona.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/sam.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/sam_pov.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/personas/examples/sqldb/test.db +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server/rest_api → letta_nightly-0.5.0.dev20241023104105/letta/prompts}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/gpt_summarize.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/gpt_system.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_base.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_chat.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_doc.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/prompts/system/memgpt_modified_o1.txt +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/providers.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/pytest.ini +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/agent.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/api_key.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/block.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/embedding_config.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/enums.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/file.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/health.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/job.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/letta_base.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/letta_message.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/letta_request.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/letta_response.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/llm_config.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/memory.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/message.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/openai/chat_completion_request.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/openai/chat_completion_response.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/openai/chat_completions.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/openai/embedding_response.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/openai/openai.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/passage.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/source.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/tool.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/usage.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/schemas/user.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server/rest_api/admin → letta_nightly-0.5.0.dev20241023104105/letta/server}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server/rest_api/auth → letta_nightly-0.5.0.dev20241023104105/letta/server/rest_api}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server/rest_api/routers → letta_nightly-0.5.0.dev20241023104105/letta/server/rest_api/admin}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/admin/agents.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/admin/tools.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/admin/users.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/app.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server/rest_api/routers/openai → letta_nightly-0.5.0.dev20241023104105/letta/server/rest_api/auth}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/auth/index.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/auth_token.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server/rest_api/routers/openai/assistants → letta_nightly-0.5.0.dev20241023104105/letta/server/rest_api/routers}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server/rest_api/routers/openai/chat_completions → letta_nightly-0.5.0.dev20241023104105/letta/server/rest_api/routers/openai}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124/letta/server/ws_api → letta_nightly-0.5.0.dev20241023104105/letta/server/rest_api/routers/openai/assistants}/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/agents.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/blocks.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/health.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/jobs.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/llms.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/sources.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/tools.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/routers/v1/users.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/static_files.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/rest_api/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/startup.sh +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/static_files/assets/index-d6b3669a.js +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/static_files/favicon.ico +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/static_files/index.html +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/ws_api/example_client.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/ws_api/interface.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/ws_api/protocol.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/server/ws_api/server.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/streaming_interface.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/streaming_utils.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/system.py +0 -0
- {letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/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.
|
|
3
|
+
Version: 0.5.0.dev20241023104105
|
|
4
4
|
Summary: Create LLM agents with long-term memory and custom tools
|
|
5
5
|
License: Apache License
|
|
6
6
|
Author: Letta Team
|
|
@@ -55,6 +55,7 @@ Requires-Dist: prettytable (>=3.9.0,<4.0.0)
|
|
|
55
55
|
Requires-Dist: pyautogen (==0.2.22) ; extra == "autogen"
|
|
56
56
|
Requires-Dist: pydantic (>=2.7.4,<3.0.0)
|
|
57
57
|
Requires-Dist: pydantic-settings (>=2.2.1,<3.0.0)
|
|
58
|
+
Requires-Dist: pyhumps (>=3.8.0,<4.0.0)
|
|
58
59
|
Requires-Dist: pymilvus (>=2.4.3,<3.0.0) ; extra == "milvus"
|
|
59
60
|
Requires-Dist: pyright (>=1.1.347,<2.0.0) ; extra == "dev"
|
|
60
61
|
Requires-Dist: pytest-asyncio (>=0.23.2,<0.24.0) ; extra == "dev"
|
{letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/__init__.py
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
__version__ = "0.5.0"
|
|
2
2
|
|
|
3
3
|
# import clients
|
|
4
|
-
from letta.client.admin import Admin
|
|
5
4
|
from letta.client.client import LocalClient, RESTClient, create_client
|
|
6
5
|
|
|
7
6
|
# imports for easier access
|
|
@@ -13,7 +12,13 @@ from letta.schemas.file import FileMetadata
|
|
|
13
12
|
from letta.schemas.job import Job
|
|
14
13
|
from letta.schemas.letta_message import LettaMessage
|
|
15
14
|
from letta.schemas.llm_config import LLMConfig
|
|
16
|
-
from letta.schemas.memory import
|
|
15
|
+
from letta.schemas.memory import (
|
|
16
|
+
ArchivalMemorySummary,
|
|
17
|
+
BasicBlockMemory,
|
|
18
|
+
ChatMemory,
|
|
19
|
+
Memory,
|
|
20
|
+
RecallMemorySummary,
|
|
21
|
+
)
|
|
17
22
|
from letta.schemas.message import Message
|
|
18
23
|
from letta.schemas.openai.chat_completion_response import UsageStatistics
|
|
19
24
|
from letta.schemas.organization import Organization
|
|
@@ -25,10 +25,10 @@ from sqlalchemy_json import MutableJson
|
|
|
25
25
|
from tqdm import tqdm
|
|
26
26
|
|
|
27
27
|
from letta.agent_store.storage import StorageConnector, TableType
|
|
28
|
-
from letta.base import Base
|
|
29
28
|
from letta.config import LettaConfig
|
|
30
29
|
from letta.constants import MAX_EMBEDDING_DIM
|
|
31
30
|
from letta.metadata import EmbeddingConfigColumn, FileMetadataModel, ToolCallColumn
|
|
31
|
+
from letta.orm.base import Base
|
|
32
32
|
|
|
33
33
|
# from letta.schemas.message import Message, Passage, Record, RecordType, ToolCall
|
|
34
34
|
from letta.schemas.message import Message
|
|
@@ -509,8 +509,10 @@ class SQLLiteStorageConnector(SQLStorageConnector):
|
|
|
509
509
|
|
|
510
510
|
self.session_maker = db_context
|
|
511
511
|
|
|
512
|
+
# Need this in order to allow UUIDs to be stored successfully in the sqlite database
|
|
512
513
|
# import sqlite3
|
|
513
|
-
|
|
514
|
+
# import uuid
|
|
515
|
+
#
|
|
514
516
|
# sqlite3.register_adapter(uuid.UUID, lambda u: u.bytes_le)
|
|
515
517
|
# sqlite3.register_converter("UUID", lambda b: uuid.UUID(bytes_le=b))
|
|
516
518
|
|
|
@@ -105,7 +105,7 @@ def add_tool(
|
|
|
105
105
|
"""Add or update a tool from a Python file."""
|
|
106
106
|
from letta.client.client import create_client
|
|
107
107
|
|
|
108
|
-
client = create_client(
|
|
108
|
+
client = create_client()
|
|
109
109
|
|
|
110
110
|
# 1. Parse the Python file
|
|
111
111
|
with open(filename, "r", encoding="utf-8") as file:
|
|
@@ -145,7 +145,7 @@ def list_tools():
|
|
|
145
145
|
"""List all available tools."""
|
|
146
146
|
from letta.client.client import create_client
|
|
147
147
|
|
|
148
|
-
client = create_client(
|
|
148
|
+
client = create_client()
|
|
149
149
|
|
|
150
150
|
tools = client.list_tools()
|
|
151
151
|
for tool in tools:
|
|
@@ -1777,6 +1777,19 @@ class LocalClient(AbstractClient):
|
|
|
1777
1777
|
"""
|
|
1778
1778
|
self.server.delete_agent(user_id=self.user_id, agent_id=agent_id)
|
|
1779
1779
|
|
|
1780
|
+
def get_agent_by_name(self, agent_name: str, user_id: str) -> AgentState:
|
|
1781
|
+
"""
|
|
1782
|
+
Get an agent by its name
|
|
1783
|
+
|
|
1784
|
+
Args:
|
|
1785
|
+
agent_name (str): Name of the agent
|
|
1786
|
+
|
|
1787
|
+
Returns:
|
|
1788
|
+
agent_state (AgentState): State of the agent
|
|
1789
|
+
"""
|
|
1790
|
+
self.interface.clear()
|
|
1791
|
+
return self.server.get_agent(agent_name=agent_name, user_id=user_id, agent_id=None)
|
|
1792
|
+
|
|
1780
1793
|
def get_agent(self, agent_id: str) -> AgentState:
|
|
1781
1794
|
"""
|
|
1782
1795
|
Get an agent's state by its ID.
|
{letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/constants.py
RENAMED
|
@@ -5,7 +5,10 @@ LETTA_DIR = os.path.join(os.path.expanduser("~"), ".letta")
|
|
|
5
5
|
|
|
6
6
|
# Defaults
|
|
7
7
|
DEFAULT_USER_ID = "user-00000000"
|
|
8
|
-
|
|
8
|
+
# This UUID follows the UUID4 rules:
|
|
9
|
+
# The 13th character (4) indicates it's version 4.
|
|
10
|
+
# The first character of the third segment (8) ensures the variant is correctly set.
|
|
11
|
+
DEFAULT_ORG_ID = "organization-00000000-0000-4000-8000-000000000000"
|
|
9
12
|
DEFAULT_USER_NAME = "default"
|
|
10
13
|
DEFAULT_ORG_NAME = "default"
|
|
11
14
|
|
{letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/embeddings.py
RENAMED
|
@@ -21,7 +21,6 @@ from letta.constants import (
|
|
|
21
21
|
EMBEDDING_TO_TOKENIZER_MAP,
|
|
22
22
|
MAX_EMBEDDING_DIM,
|
|
23
23
|
)
|
|
24
|
-
from letta.credentials import LettaCredentials
|
|
25
24
|
from letta.schemas.embedding_config import EmbeddingConfig
|
|
26
25
|
from letta.utils import is_valid_url, printd
|
|
27
26
|
|
|
@@ -138,6 +137,18 @@ class EmbeddingEndpoint:
|
|
|
138
137
|
return self._call_api(text)
|
|
139
138
|
|
|
140
139
|
|
|
140
|
+
class AzureOpenAIEmbedding:
|
|
141
|
+
def __init__(self, api_endpoint: str, api_key: str, api_version: str, model: str):
|
|
142
|
+
from openai import AzureOpenAI
|
|
143
|
+
|
|
144
|
+
self.client = AzureOpenAI(api_key=api_key, api_version=api_version, azure_endpoint=api_endpoint)
|
|
145
|
+
self.model = model
|
|
146
|
+
|
|
147
|
+
def get_text_embedding(self, text: str):
|
|
148
|
+
embeddings = self.client.embeddings.create(input=[text], model=self.model).data[0].embedding
|
|
149
|
+
return embeddings
|
|
150
|
+
|
|
151
|
+
|
|
141
152
|
def default_embedding_model():
|
|
142
153
|
# default to hugging face model running local
|
|
143
154
|
# warning: this is a terrible model
|
|
@@ -161,8 +172,8 @@ def embedding_model(config: EmbeddingConfig, user_id: Optional[uuid.UUID] = None
|
|
|
161
172
|
|
|
162
173
|
endpoint_type = config.embedding_endpoint_type
|
|
163
174
|
|
|
164
|
-
# TODO refactor to pass
|
|
165
|
-
|
|
175
|
+
# TODO: refactor to pass in settings from server
|
|
176
|
+
from letta.settings import model_settings
|
|
166
177
|
|
|
167
178
|
if endpoint_type == "openai":
|
|
168
179
|
from llama_index.embeddings.openai import OpenAIEmbedding
|
|
@@ -170,7 +181,7 @@ def embedding_model(config: EmbeddingConfig, user_id: Optional[uuid.UUID] = None
|
|
|
170
181
|
additional_kwargs = {"user_id": user_id} if user_id else {}
|
|
171
182
|
model = OpenAIEmbedding(
|
|
172
183
|
api_base=config.embedding_endpoint,
|
|
173
|
-
api_key=
|
|
184
|
+
api_key=model_settings.openai_api_key,
|
|
174
185
|
additional_kwargs=additional_kwargs,
|
|
175
186
|
)
|
|
176
187
|
return model
|
|
@@ -178,22 +189,29 @@ def embedding_model(config: EmbeddingConfig, user_id: Optional[uuid.UUID] = None
|
|
|
178
189
|
elif endpoint_type == "azure":
|
|
179
190
|
assert all(
|
|
180
191
|
[
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
model_settings.azure_api_key is not None,
|
|
193
|
+
model_settings.azure_base_url is not None,
|
|
194
|
+
model_settings.azure_api_version is not None,
|
|
184
195
|
]
|
|
185
196
|
)
|
|
186
|
-
from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding
|
|
197
|
+
# from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding
|
|
198
|
+
|
|
199
|
+
## https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#embeddings
|
|
200
|
+
# model = "text-embedding-ada-002"
|
|
201
|
+
# deployment = credentials.azure_embedding_deployment if credentials.azure_embedding_deployment is not None else model
|
|
202
|
+
# return AzureOpenAIEmbedding(
|
|
203
|
+
# model=model,
|
|
204
|
+
# deployment_name=deployment,
|
|
205
|
+
# api_key=credentials.azure_key,
|
|
206
|
+
# azure_endpoint=credentials.azure_endpoint,
|
|
207
|
+
# api_version=credentials.azure_version,
|
|
208
|
+
# )
|
|
187
209
|
|
|
188
|
-
# https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#embeddings
|
|
189
|
-
model = "text-embedding-ada-002"
|
|
190
|
-
deployment = credentials.azure_embedding_deployment if credentials.azure_embedding_deployment is not None else model
|
|
191
210
|
return AzureOpenAIEmbedding(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
api_version=credentials.azure_version,
|
|
211
|
+
api_endpoint=model_settings.azure_base_url,
|
|
212
|
+
api_key=model_settings.azure_api_key,
|
|
213
|
+
api_version=model_settings.azure_api_version,
|
|
214
|
+
model=config.embedding_model,
|
|
197
215
|
)
|
|
198
216
|
|
|
199
217
|
elif endpoint_type == "hugging-face":
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from collections import defaultdict
|
|
2
|
+
|
|
1
3
|
import requests
|
|
2
4
|
|
|
3
5
|
from letta.llm_api.helpers import make_post_request
|
|
@@ -20,7 +22,14 @@ def get_azure_model_list_endpoint(base_url: str, api_version: str):
|
|
|
20
22
|
return f"{base_url}/openai/models?api-version={api_version}"
|
|
21
23
|
|
|
22
24
|
|
|
23
|
-
def
|
|
25
|
+
def get_azure_deployment_list_endpoint(base_url: str):
|
|
26
|
+
# Please note that it has to be 2023-03-15-preview
|
|
27
|
+
# That's the only api version that works with this deployments endpoint
|
|
28
|
+
# TODO: Use the Azure Client library here instead
|
|
29
|
+
return f"{base_url}/openai/deployments?api-version=2023-03-15-preview"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def azure_openai_get_deployed_model_list(base_url: str, api_key: str, api_version: str) -> list:
|
|
24
33
|
"""https://learn.microsoft.com/en-us/rest/api/azureopenai/models/list?view=rest-azureopenai-2023-05-15&tabs=HTTP"""
|
|
25
34
|
|
|
26
35
|
# https://xxx.openai.azure.com/openai/models?api-version=xxx
|
|
@@ -28,18 +37,48 @@ def azure_openai_get_model_list(base_url: str, api_key: str, api_version: str) -
|
|
|
28
37
|
if api_key is not None:
|
|
29
38
|
headers["api-key"] = f"{api_key}"
|
|
30
39
|
|
|
40
|
+
# 1. Get all available models
|
|
31
41
|
url = get_azure_model_list_endpoint(base_url, api_version)
|
|
32
42
|
try:
|
|
33
43
|
response = requests.get(url, headers=headers)
|
|
34
44
|
response.raise_for_status()
|
|
35
45
|
except requests.RequestException as e:
|
|
36
46
|
raise RuntimeError(f"Failed to retrieve model list: {e}")
|
|
47
|
+
all_available_models = response.json().get("data", [])
|
|
37
48
|
|
|
38
|
-
|
|
49
|
+
# 2. Get all the deployed models
|
|
50
|
+
url = get_azure_deployment_list_endpoint(base_url)
|
|
51
|
+
try:
|
|
52
|
+
response = requests.get(url, headers=headers)
|
|
53
|
+
response.raise_for_status()
|
|
54
|
+
except requests.RequestException as e:
|
|
55
|
+
raise RuntimeError(f"Failed to retrieve model list: {e}")
|
|
56
|
+
|
|
57
|
+
deployed_models = response.json().get("data", [])
|
|
58
|
+
deployed_model_names = set([m["id"] for m in deployed_models])
|
|
59
|
+
|
|
60
|
+
# 3. Only return the models in available models if they have been deployed
|
|
61
|
+
deployed_models = [m for m in all_available_models if m["id"] in deployed_model_names]
|
|
62
|
+
|
|
63
|
+
# 4. Remove redundant deployments, only include the ones with the latest deployment
|
|
64
|
+
# Create a dictionary to store the latest model for each ID
|
|
65
|
+
latest_models = defaultdict()
|
|
66
|
+
|
|
67
|
+
# Iterate through the models and update the dictionary with the most recent model
|
|
68
|
+
for model in deployed_models:
|
|
69
|
+
model_id = model["id"]
|
|
70
|
+
updated_at = model["created_at"]
|
|
71
|
+
|
|
72
|
+
# If the model ID is new or the current model has a more recent created_at, update the dictionary
|
|
73
|
+
if model_id not in latest_models or updated_at > latest_models[model_id]["created_at"]:
|
|
74
|
+
latest_models[model_id] = model
|
|
75
|
+
|
|
76
|
+
# Extract the unique models
|
|
77
|
+
return list(latest_models.values())
|
|
39
78
|
|
|
40
79
|
|
|
41
80
|
def azure_openai_get_chat_completion_model_list(base_url: str, api_key: str, api_version: str) -> list:
|
|
42
|
-
model_list =
|
|
81
|
+
model_list = azure_openai_get_deployed_model_list(base_url, api_key, api_version)
|
|
43
82
|
# Extract models that support text generation
|
|
44
83
|
model_options = [m for m in model_list if m.get("capabilities").get("chat_completion") == True]
|
|
45
84
|
return model_options
|
|
@@ -53,10 +92,11 @@ def azure_openai_get_embeddings_model_list(base_url: str, api_key: str, api_vers
|
|
|
53
92
|
|
|
54
93
|
return m.get("capabilities").get("embeddings") == True and valid_name
|
|
55
94
|
|
|
56
|
-
model_list =
|
|
95
|
+
model_list = azure_openai_get_deployed_model_list(base_url, api_key, api_version)
|
|
57
96
|
# Extract models that support embeddings
|
|
58
97
|
|
|
59
98
|
model_options = [m for m in model_list if valid_embedding_model(m)]
|
|
99
|
+
|
|
60
100
|
return model_options
|
|
61
101
|
|
|
62
102
|
|
|
@@ -314,11 +314,17 @@ def openai_chat_completions_process_stream(
|
|
|
314
314
|
for _ in range(len(tool_calls_delta))
|
|
315
315
|
]
|
|
316
316
|
|
|
317
|
+
# There may be many tool calls in a tool calls delta (e.g. parallel tool calls)
|
|
317
318
|
for tool_call_delta in tool_calls_delta:
|
|
318
319
|
if tool_call_delta.id is not None:
|
|
319
320
|
# TODO assert that we're not overwriting?
|
|
320
321
|
# TODO += instead of =?
|
|
321
|
-
|
|
322
|
+
if tool_call_delta.index not in range(len(accum_message.tool_calls)):
|
|
323
|
+
warnings.warn(
|
|
324
|
+
f"Tool call index out of range ({tool_call_delta.index})\ncurrent tool calls: {accum_message.tool_calls}\ncurrent delta: {tool_call_delta}"
|
|
325
|
+
)
|
|
326
|
+
else:
|
|
327
|
+
accum_message.tool_calls[tool_call_delta.index].id = tool_call_delta.id
|
|
322
328
|
if tool_call_delta.function is not None:
|
|
323
329
|
if tool_call_delta.function.name is not None:
|
|
324
330
|
# TODO assert that we're not overwriting?
|
{letta_nightly-0.5.0.dev20241022104124 → letta_nightly-0.5.0.dev20241023104105}/letta/metadata.py
RENAMED
|
@@ -20,8 +20,8 @@ from sqlalchemy import (
|
|
|
20
20
|
)
|
|
21
21
|
from sqlalchemy.sql import func
|
|
22
22
|
|
|
23
|
-
from letta.base import Base
|
|
24
23
|
from letta.config import LettaConfig
|
|
24
|
+
from letta.orm.base import Base
|
|
25
25
|
from letta.schemas.agent import AgentState
|
|
26
26
|
from letta.schemas.api_key import APIKey
|
|
27
27
|
from letta.schemas.block import Block, Human, Persona
|
|
@@ -34,7 +34,6 @@ from letta.schemas.memory import Memory
|
|
|
34
34
|
|
|
35
35
|
# from letta.schemas.message import Message, Passage, Record, RecordType, ToolCall
|
|
36
36
|
from letta.schemas.openai.chat_completions import ToolCall, ToolCallFunction
|
|
37
|
-
from letta.schemas.organization import Organization
|
|
38
37
|
from letta.schemas.source import Source
|
|
39
38
|
from letta.schemas.tool import Tool
|
|
40
39
|
from letta.schemas.user import User
|
|
@@ -174,21 +173,6 @@ class UserModel(Base):
|
|
|
174
173
|
return User(id=self.id, name=self.name, created_at=self.created_at, org_id=self.org_id)
|
|
175
174
|
|
|
176
175
|
|
|
177
|
-
class OrganizationModel(Base):
|
|
178
|
-
__tablename__ = "organizations"
|
|
179
|
-
__table_args__ = {"extend_existing": True}
|
|
180
|
-
|
|
181
|
-
id = Column(String, primary_key=True)
|
|
182
|
-
name = Column(String, nullable=False)
|
|
183
|
-
created_at = Column(DateTime(timezone=True))
|
|
184
|
-
|
|
185
|
-
def __repr__(self) -> str:
|
|
186
|
-
return f"<Organization(id='{self.id}' name='{self.name}')>"
|
|
187
|
-
|
|
188
|
-
def to_record(self) -> Organization:
|
|
189
|
-
return Organization(id=self.id, name=self.name, created_at=self.created_at)
|
|
190
|
-
|
|
191
|
-
|
|
192
176
|
# TODO: eventually store providers?
|
|
193
177
|
# class Provider(Base):
|
|
194
178
|
# __tablename__ = "providers"
|
|
@@ -551,14 +535,6 @@ class MetadataStore:
|
|
|
551
535
|
session.add(UserModel(**vars(user)))
|
|
552
536
|
session.commit()
|
|
553
537
|
|
|
554
|
-
@enforce_types
|
|
555
|
-
def create_organization(self, organization: Organization):
|
|
556
|
-
with self.session_maker() as session:
|
|
557
|
-
if session.query(OrganizationModel).filter(OrganizationModel.id == organization.id).count() > 0:
|
|
558
|
-
raise ValueError(f"Organization with id {organization.id} already exists")
|
|
559
|
-
session.add(OrganizationModel(**vars(organization)))
|
|
560
|
-
session.commit()
|
|
561
|
-
|
|
562
538
|
@enforce_types
|
|
563
539
|
def create_block(self, block: Block):
|
|
564
540
|
with self.session_maker() as session:
|
|
@@ -698,16 +674,6 @@ class MetadataStore:
|
|
|
698
674
|
|
|
699
675
|
session.commit()
|
|
700
676
|
|
|
701
|
-
@enforce_types
|
|
702
|
-
def delete_organization(self, org_id: str):
|
|
703
|
-
with self.session_maker() as session:
|
|
704
|
-
# delete from organizations table
|
|
705
|
-
session.query(OrganizationModel).filter(OrganizationModel.id == org_id).delete()
|
|
706
|
-
|
|
707
|
-
# TODO: delete associated data
|
|
708
|
-
|
|
709
|
-
session.commit()
|
|
710
|
-
|
|
711
677
|
@enforce_types
|
|
712
678
|
def list_tools(self, cursor: Optional[str] = None, limit: Optional[int] = 50, user_id: Optional[str] = None) -> List[ToolModel]:
|
|
713
679
|
with self.session_maker() as session:
|
|
@@ -762,30 +728,6 @@ class MetadataStore:
|
|
|
762
728
|
assert len(results) == 1, f"Expected 1 result, got {len(results)}"
|
|
763
729
|
return results[0].to_record()
|
|
764
730
|
|
|
765
|
-
@enforce_types
|
|
766
|
-
def get_organization(self, org_id: str) -> Optional[Organization]:
|
|
767
|
-
with self.session_maker() as session:
|
|
768
|
-
results = session.query(OrganizationModel).filter(OrganizationModel.id == org_id).all()
|
|
769
|
-
if len(results) == 0:
|
|
770
|
-
return None
|
|
771
|
-
assert len(results) == 1, f"Expected 1 result, got {len(results)}"
|
|
772
|
-
return results[0].to_record()
|
|
773
|
-
|
|
774
|
-
@enforce_types
|
|
775
|
-
def list_organizations(self, cursor: Optional[str] = None, limit: Optional[int] = 50):
|
|
776
|
-
with self.session_maker() as session:
|
|
777
|
-
query = session.query(OrganizationModel).order_by(desc(OrganizationModel.id))
|
|
778
|
-
if cursor:
|
|
779
|
-
query = query.filter(OrganizationModel.id < cursor)
|
|
780
|
-
results = query.limit(limit).all()
|
|
781
|
-
if not results:
|
|
782
|
-
return None, []
|
|
783
|
-
organization_records = [r.to_record() for r in results]
|
|
784
|
-
next_cursor = organization_records[-1].id
|
|
785
|
-
assert isinstance(next_cursor, str)
|
|
786
|
-
|
|
787
|
-
return next_cursor, organization_records
|
|
788
|
-
|
|
789
731
|
@enforce_types
|
|
790
732
|
def get_all_users(self, cursor: Optional[str] = None, limit: Optional[int] = 50):
|
|
791
733
|
with self.session_maker() as session:
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
|
|
5
|
+
from sqlalchemy import UUID as SQLUUID
|
|
6
|
+
from sqlalchemy import Boolean, DateTime, func, text
|
|
7
|
+
from sqlalchemy.orm import (
|
|
8
|
+
DeclarativeBase,
|
|
9
|
+
Mapped,
|
|
10
|
+
declarative_mixin,
|
|
11
|
+
declared_attr,
|
|
12
|
+
mapped_column,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Base(DeclarativeBase):
|
|
17
|
+
"""absolute base for sqlalchemy classes"""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@declarative_mixin
|
|
21
|
+
class CommonSqlalchemyMetaMixins(Base):
|
|
22
|
+
__abstract__ = True
|
|
23
|
+
|
|
24
|
+
created_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
|
25
|
+
updated_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), server_default=func.now(), server_onupdate=func.now())
|
|
26
|
+
is_deleted: Mapped[bool] = mapped_column(Boolean, server_default=text("FALSE"))
|
|
27
|
+
|
|
28
|
+
@declared_attr
|
|
29
|
+
def _created_by_id(cls):
|
|
30
|
+
return cls._user_by_id()
|
|
31
|
+
|
|
32
|
+
@declared_attr
|
|
33
|
+
def _last_updated_by_id(cls):
|
|
34
|
+
return cls._user_by_id()
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def _user_by_id(cls):
|
|
38
|
+
"""a flexible non-constrained record of a user.
|
|
39
|
+
This way users can get added, deleted etc without history freaking out
|
|
40
|
+
"""
|
|
41
|
+
return mapped_column(SQLUUID(), nullable=True)
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def last_updated_by_id(self) -> Optional[str]:
|
|
45
|
+
return self._user_id_getter("last_updated")
|
|
46
|
+
|
|
47
|
+
@last_updated_by_id.setter
|
|
48
|
+
def last_updated_by_id(self, value: str) -> None:
|
|
49
|
+
self._user_id_setter("last_updated", value)
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def created_by_id(self) -> Optional[str]:
|
|
53
|
+
return self._user_id_getter("created")
|
|
54
|
+
|
|
55
|
+
@created_by_id.setter
|
|
56
|
+
def created_by_id(self, value: str) -> None:
|
|
57
|
+
self._user_id_setter("created", value)
|
|
58
|
+
|
|
59
|
+
def _user_id_getter(self, prop: str) -> Optional[str]:
|
|
60
|
+
"""returns the user id for the specified property"""
|
|
61
|
+
full_prop = f"_{prop}_by_id"
|
|
62
|
+
prop_value = getattr(self, full_prop, None)
|
|
63
|
+
if not prop_value:
|
|
64
|
+
return
|
|
65
|
+
return f"user-{prop_value}"
|
|
66
|
+
|
|
67
|
+
def _user_id_setter(self, prop: str, value: str) -> None:
|
|
68
|
+
"""returns the user id for the specified property"""
|
|
69
|
+
full_prop = f"_{prop}_by_id"
|
|
70
|
+
if not value:
|
|
71
|
+
setattr(self, full_prop, None)
|
|
72
|
+
return
|
|
73
|
+
prefix, id_ = value.split("-", 1)
|
|
74
|
+
assert prefix == "user", f"{prefix} is not a valid id prefix for a user id"
|
|
75
|
+
setattr(self, full_prop, UUID(id_))
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from typing import Optional, Type
|
|
2
|
+
from uuid import UUID
|
|
3
|
+
|
|
4
|
+
from letta.orm.base import Base
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MalformedIdError(Exception):
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _relation_getter(instance: "Base", prop: str) -> Optional[str]:
|
|
12
|
+
prefix = prop.replace("_", "")
|
|
13
|
+
formatted_prop = f"_{prop}_id"
|
|
14
|
+
try:
|
|
15
|
+
uuid_ = getattr(instance, formatted_prop)
|
|
16
|
+
return f"{prefix}-{uuid_}"
|
|
17
|
+
except AttributeError:
|
|
18
|
+
return None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _relation_setter(instance: Type["Base"], prop: str, value: str) -> None:
|
|
22
|
+
formatted_prop = f"_{prop}_id"
|
|
23
|
+
prefix = prop.replace("_", "")
|
|
24
|
+
if not value:
|
|
25
|
+
setattr(instance, formatted_prop, None)
|
|
26
|
+
return
|
|
27
|
+
try:
|
|
28
|
+
found_prefix, id_ = value.split("-", 1)
|
|
29
|
+
except ValueError as e:
|
|
30
|
+
raise MalformedIdError(f"{value} is not a valid ID.") from e
|
|
31
|
+
assert (
|
|
32
|
+
# TODO: should be able to get this from the Mapped typing, not sure how though
|
|
33
|
+
# prefix = getattr(?, "prefix")
|
|
34
|
+
found_prefix
|
|
35
|
+
== prefix
|
|
36
|
+
), f"{found_prefix} is not a valid id prefix, expecting {prefix}"
|
|
37
|
+
try:
|
|
38
|
+
setattr(instance, formatted_prop, UUID(id_))
|
|
39
|
+
except ValueError as e:
|
|
40
|
+
raise MalformedIdError("Hash segment of {value} is not a valid UUID") from e
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
|
|
3
|
+
from sqlalchemy.exc import NoResultFound
|
|
4
|
+
from sqlalchemy.orm import Mapped, mapped_column
|
|
5
|
+
|
|
6
|
+
from letta.orm.sqlalchemy_base import SqlalchemyBase
|
|
7
|
+
from letta.schemas.organization import Organization as PydanticOrganization
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from sqlalchemy.orm import Session
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Organization(SqlalchemyBase):
|
|
14
|
+
"""The highest level of the object tree. All Entities belong to one and only one Organization."""
|
|
15
|
+
|
|
16
|
+
__tablename__ = "organizations"
|
|
17
|
+
__pydantic_model__ = PydanticOrganization
|
|
18
|
+
|
|
19
|
+
name: Mapped[str] = mapped_column(doc="The display name of the organization.")
|
|
20
|
+
|
|
21
|
+
# TODO: Map these relationships later when we actually make these models
|
|
22
|
+
# below is just a suggestion
|
|
23
|
+
# users: Mapped[List["User"]] = relationship("User", back_populates="organization", cascade="all, delete-orphan")
|
|
24
|
+
# agents: Mapped[List["Agent"]] = relationship("Agent", back_populates="organization", cascade="all, delete-orphan")
|
|
25
|
+
# sources: Mapped[List["Source"]] = relationship("Source", back_populates="organization", cascade="all, delete-orphan")
|
|
26
|
+
# tools: Mapped[List["Tool"]] = relationship("Tool", back_populates="organization", cascade="all, delete-orphan")
|
|
27
|
+
# 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)
|