letta-nightly 0.5.2.dev20241112104101__tar.gz → 0.5.2.dev20241113104112__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.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/PKG-INFO +1 -1
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/agent.py +4 -2
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/cli/cli.py +1 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/client/client.py +16 -13
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/data_sources/connectors.py +3 -3
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/google_ai.py +0 -2
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/openai.py +1 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/memory.py +10 -6
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/metadata.py +3 -92
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/__init__.py +1 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/organization.py +2 -2
- letta_nightly-0.5.2.dev20241113104112/letta/orm/source.py +50 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/providers.py +0 -1
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/source.py +30 -24
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/app.py +27 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/sources.py +11 -13
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/server.py +31 -52
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/services/organization_manager.py +12 -13
- letta_nightly-0.5.2.dev20241113104112/letta/services/source_manager.py +100 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/pyproject.toml +1 -1
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/LICENSE +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/README.md +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/__main__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/agent_store/chroma.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/agent_store/db.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/agent_store/lancedb.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/agent_store/milvus.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/agent_store/qdrant.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/agent_store/storage.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/benchmark/benchmark.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/benchmark/constants.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/cli/cli_config.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/cli/cli_load.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/client/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/client/streaming.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/client/utils.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/config.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/constants.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/credentials.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/data_sources/connectors_helper.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/embeddings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/errors.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/functions/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/functions/function_sets/base.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/functions/function_sets/extras.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/functions/functions.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/functions/helpers.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/functions/schema_generator.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/helpers/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/helpers/tool_rule_solver.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/humans/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/humans/examples/basic.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/humans/examples/cs_phd.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/interface.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/anthropic.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/azure_openai.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/azure_openai_constants.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/cohere.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/helpers.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/llm_api_tools.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/llm_api/mistral.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/README.md +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/chat_completion_proxy.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/constants.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/function_parser.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/grammars/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/grammars/json.gbnf +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/json_parser.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/koboldcpp/api.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/koboldcpp/settings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llamacpp/api.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llamacpp/settings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/lmstudio/api.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/lmstudio/settings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/ollama/api.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/ollama/settings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/settings/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/settings/settings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/settings/simple.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/utils.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/vllm/api.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/webui/api.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/webui/legacy_api.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/webui/legacy_settings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/local_llm/webui/settings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/log.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/main.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/o1_agent.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/openai_backcompat/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/openai_backcompat/openai_object.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/__all__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/agents_tags.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/base.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/enums.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/errors.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/mixins.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/sqlalchemy_base.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/tool.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/orm/user.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/persistence_manager.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/anna_pa.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/google_search_persona.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/memgpt_doc.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/memgpt_starter.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/o1_persona.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/sam.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/sam_pov.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/personas/examples/sqldb/test.db +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/gpt_summarize.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/gpt_system.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_base.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_chat.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_doc.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/prompts/system/memgpt_modified_o1.txt +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/pytest.ini +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/agent.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/agents_tags.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/api_key.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/block.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/embedding_config.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/enums.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/file.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/health.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/job.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/letta_base.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/letta_message.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/letta_request.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/letta_response.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/llm_config.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/memory.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/message.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/openai/chat_completion_request.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/openai/chat_completion_response.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/openai/chat_completions.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/openai/embedding_response.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/openai/openai.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/organization.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/passage.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/tool.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/tool_rule.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/usage.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/schemas/user.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/constants.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/generate_openapi_schema.sh +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/auth/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/auth/index.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/auth_token.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/interface.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/openai/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/agents.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/blocks.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/health.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/jobs.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/llms.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/organizations.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/tools.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/routers/v1/users.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/static_files.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/rest_api/utils.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/startup.sh +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/static_files/assets/index-9fa459a2.js +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/static_files/favicon.ico +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/static_files/index.html +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/utils.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/ws_api/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/ws_api/example_client.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/ws_api/interface.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/ws_api/protocol.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/server/ws_api/server.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/services/__init__.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/services/agents_tags_manager.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/services/tool_manager.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/services/user_manager.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/settings.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/streaming_interface.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/streaming_utils.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/system.py +0 -0
- {letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/utils.py +0 -0
{letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/agent.py
RENAMED
|
@@ -46,6 +46,8 @@ from letta.schemas.passage import Passage
|
|
|
46
46
|
from letta.schemas.tool import Tool
|
|
47
47
|
from letta.schemas.tool_rule import TerminalToolRule
|
|
48
48
|
from letta.schemas.usage import LettaUsageStatistics
|
|
49
|
+
from letta.services.source_manager import SourceManager
|
|
50
|
+
from letta.services.user_manager import UserManager
|
|
49
51
|
from letta.system import (
|
|
50
52
|
get_heartbeat,
|
|
51
53
|
get_initial_boot_messages,
|
|
@@ -1311,7 +1313,7 @@ class Agent(BaseAgent):
|
|
|
1311
1313
|
def attach_source(self, source_id: str, source_connector: StorageConnector, ms: MetadataStore):
|
|
1312
1314
|
"""Attach data with name `source_name` to the agent from source_connector."""
|
|
1313
1315
|
# TODO: eventually, adding a data source should just give access to the retriever the source table, rather than modifying archival memory
|
|
1314
|
-
|
|
1316
|
+
user = UserManager().get_user_by_id(self.agent_state.user_id)
|
|
1315
1317
|
filters = {"user_id": self.agent_state.user_id, "source_id": source_id}
|
|
1316
1318
|
size = source_connector.size(filters)
|
|
1317
1319
|
page_size = 100
|
|
@@ -1339,7 +1341,7 @@ class Agent(BaseAgent):
|
|
|
1339
1341
|
self.persistence_manager.archival_memory.storage.save()
|
|
1340
1342
|
|
|
1341
1343
|
# attach to agent
|
|
1342
|
-
source =
|
|
1344
|
+
source = SourceManager().get_source_by_id(source_id=source_id, actor=user)
|
|
1343
1345
|
assert source is not None, f"Source {source_id} not found in metadata store"
|
|
1344
1346
|
ms.attach_source(agent_id=self.agent_state.id, source_id=source_id, user_id=self.agent_state.user_id)
|
|
1345
1347
|
|
{letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/cli/cli.py
RENAMED
|
@@ -47,6 +47,7 @@ def server(
|
|
|
47
47
|
host: Annotated[Optional[str], typer.Option(help="Host to run the server on (default to localhost)")] = None,
|
|
48
48
|
debug: Annotated[bool, typer.Option(help="Turn debugging output on")] = False,
|
|
49
49
|
ade: Annotated[bool, typer.Option(help="Allows remote access")] = False,
|
|
50
|
+
secure: Annotated[bool, typer.Option(help="Adds simple security access")] = False,
|
|
50
51
|
):
|
|
51
52
|
"""Launch a Letta server process"""
|
|
52
53
|
if type == ServerChoice.rest_api:
|
|
@@ -238,7 +238,7 @@ class AbstractClient(object):
|
|
|
238
238
|
def delete_file_from_source(self, source_id: str, file_id: str) -> None:
|
|
239
239
|
raise NotImplementedError
|
|
240
240
|
|
|
241
|
-
def create_source(self, name: str) -> Source:
|
|
241
|
+
def create_source(self, name: str, embedding_config: Optional[EmbeddingConfig] = None) -> Source:
|
|
242
242
|
raise NotImplementedError
|
|
243
243
|
|
|
244
244
|
def delete_source(self, source_id: str):
|
|
@@ -1188,7 +1188,7 @@ class RESTClient(AbstractClient):
|
|
|
1188
1188
|
if response.status_code not in [200, 204]:
|
|
1189
1189
|
raise ValueError(f"Failed to delete tool: {response.text}")
|
|
1190
1190
|
|
|
1191
|
-
def create_source(self, name: str) -> Source:
|
|
1191
|
+
def create_source(self, name: str, embedding_config: Optional[EmbeddingConfig] = None) -> Source:
|
|
1192
1192
|
"""
|
|
1193
1193
|
Create a source
|
|
1194
1194
|
|
|
@@ -1198,7 +1198,8 @@ class RESTClient(AbstractClient):
|
|
|
1198
1198
|
Returns:
|
|
1199
1199
|
source (Source): Created source
|
|
1200
1200
|
"""
|
|
1201
|
-
|
|
1201
|
+
source_create = SourceCreate(name=name, embedding_config=embedding_config or self._default_embedding_config)
|
|
1202
|
+
payload = source_create.model_dump()
|
|
1202
1203
|
response = requests.post(f"{self.base_url}/{self.api_prefix}/sources", json=payload, headers=self.headers)
|
|
1203
1204
|
response_json = response.json()
|
|
1204
1205
|
return Source(**response_json)
|
|
@@ -1253,7 +1254,7 @@ class RESTClient(AbstractClient):
|
|
|
1253
1254
|
Returns:
|
|
1254
1255
|
source (Source): Updated source
|
|
1255
1256
|
"""
|
|
1256
|
-
request = SourceUpdate(
|
|
1257
|
+
request = SourceUpdate(name=name)
|
|
1257
1258
|
response = requests.patch(f"{self.base_url}/{self.api_prefix}/sources/{source_id}", json=request.model_dump(), headers=self.headers)
|
|
1258
1259
|
if response.status_code != 200:
|
|
1259
1260
|
raise ValueError(f"Failed to update source: {response.text}")
|
|
@@ -2453,7 +2454,7 @@ class LocalClient(AbstractClient):
|
|
|
2453
2454
|
def list_active_jobs(self):
|
|
2454
2455
|
return self.server.list_active_jobs(user_id=self.user_id)
|
|
2455
2456
|
|
|
2456
|
-
def create_source(self, name: str) -> Source:
|
|
2457
|
+
def create_source(self, name: str, embedding_config: Optional[EmbeddingConfig] = None) -> Source:
|
|
2457
2458
|
"""
|
|
2458
2459
|
Create a source
|
|
2459
2460
|
|
|
@@ -2463,8 +2464,10 @@ class LocalClient(AbstractClient):
|
|
|
2463
2464
|
Returns:
|
|
2464
2465
|
source (Source): Created source
|
|
2465
2466
|
"""
|
|
2466
|
-
|
|
2467
|
-
|
|
2467
|
+
source = Source(
|
|
2468
|
+
name=name, embedding_config=embedding_config or self._default_embedding_config, organization_id=self.user.organization_id
|
|
2469
|
+
)
|
|
2470
|
+
return self.server.source_manager.create_source(source=source, actor=self.user)
|
|
2468
2471
|
|
|
2469
2472
|
def delete_source(self, source_id: str):
|
|
2470
2473
|
"""
|
|
@@ -2475,7 +2478,7 @@ class LocalClient(AbstractClient):
|
|
|
2475
2478
|
"""
|
|
2476
2479
|
|
|
2477
2480
|
# TODO: delete source data
|
|
2478
|
-
self.server.delete_source(source_id=source_id,
|
|
2481
|
+
self.server.delete_source(source_id=source_id, actor=self.user)
|
|
2479
2482
|
|
|
2480
2483
|
def get_source(self, source_id: str) -> Source:
|
|
2481
2484
|
"""
|
|
@@ -2487,7 +2490,7 @@ class LocalClient(AbstractClient):
|
|
|
2487
2490
|
Returns:
|
|
2488
2491
|
source (Source): Source
|
|
2489
2492
|
"""
|
|
2490
|
-
return self.server.
|
|
2493
|
+
return self.server.source_manager.get_source_by_id(source_id=source_id, actor=self.user)
|
|
2491
2494
|
|
|
2492
2495
|
def get_source_id(self, source_name: str) -> str:
|
|
2493
2496
|
"""
|
|
@@ -2499,7 +2502,7 @@ class LocalClient(AbstractClient):
|
|
|
2499
2502
|
Returns:
|
|
2500
2503
|
source_id (str): ID of the source
|
|
2501
2504
|
"""
|
|
2502
|
-
return self.server.
|
|
2505
|
+
return self.server.source_manager.get_source_by_name(source_name=source_name, actor=self.user).id
|
|
2503
2506
|
|
|
2504
2507
|
def attach_source_to_agent(self, agent_id: str, source_id: Optional[str] = None, source_name: Optional[str] = None):
|
|
2505
2508
|
"""
|
|
@@ -2532,7 +2535,7 @@ class LocalClient(AbstractClient):
|
|
|
2532
2535
|
sources (List[Source]): List of sources
|
|
2533
2536
|
"""
|
|
2534
2537
|
|
|
2535
|
-
return self.server.list_all_sources(
|
|
2538
|
+
return self.server.list_all_sources(actor=self.user)
|
|
2536
2539
|
|
|
2537
2540
|
def list_attached_sources(self, agent_id: str) -> List[Source]:
|
|
2538
2541
|
"""
|
|
@@ -2572,8 +2575,8 @@ class LocalClient(AbstractClient):
|
|
|
2572
2575
|
source (Source): Updated source
|
|
2573
2576
|
"""
|
|
2574
2577
|
# TODO should the arg here just be "source_update: Source"?
|
|
2575
|
-
request = SourceUpdate(
|
|
2576
|
-
return self.server.update_source(
|
|
2578
|
+
request = SourceUpdate(name=name)
|
|
2579
|
+
return self.server.source_manager.update_source(source_id=source_id, source_update=request, actor=self.user)
|
|
2577
2580
|
|
|
2578
2581
|
# archival memory
|
|
2579
2582
|
|
|
@@ -47,7 +47,7 @@ def load_data(
|
|
|
47
47
|
passage_store: StorageConnector,
|
|
48
48
|
file_metadata_store: StorageConnector,
|
|
49
49
|
):
|
|
50
|
-
"""Load data from a connector (generates file and passages) into a specified source_id,
|
|
50
|
+
"""Load data from a connector (generates file and passages) into a specified source_id, associated with a user_id."""
|
|
51
51
|
embedding_config = source.embedding_config
|
|
52
52
|
|
|
53
53
|
# embedding model
|
|
@@ -88,7 +88,7 @@ def load_data(
|
|
|
88
88
|
file_id=file_metadata.id,
|
|
89
89
|
source_id=source.id,
|
|
90
90
|
metadata_=passage_metadata,
|
|
91
|
-
user_id=source.
|
|
91
|
+
user_id=source.created_by_id,
|
|
92
92
|
embedding_config=source.embedding_config,
|
|
93
93
|
embedding=embedding,
|
|
94
94
|
)
|
|
@@ -155,7 +155,7 @@ class DirectoryConnector(DataConnector):
|
|
|
155
155
|
|
|
156
156
|
for metadata in extract_metadata_from_files(files):
|
|
157
157
|
yield FileMetadata(
|
|
158
|
-
user_id=source.
|
|
158
|
+
user_id=source.created_by_id,
|
|
159
159
|
source_id=source.id,
|
|
160
160
|
file_name=metadata.get("file_name"),
|
|
161
161
|
file_path=metadata.get("file_path"),
|
|
@@ -95,10 +95,8 @@ def google_ai_get_model_list(base_url: str, api_key: str, key_in_header: bool =
|
|
|
95
95
|
|
|
96
96
|
try:
|
|
97
97
|
response = requests.get(url, headers=headers)
|
|
98
|
-
printd(f"response = {response}")
|
|
99
98
|
response.raise_for_status() # Raises HTTPError for 4XX/5XX status
|
|
100
99
|
response = response.json() # convert to dict from string
|
|
101
|
-
printd(f"response.json = {response}")
|
|
102
100
|
|
|
103
101
|
# Grab the models out
|
|
104
102
|
model_list = response["models"]
|
|
@@ -126,6 +126,7 @@ def build_openai_chat_completions_request(
|
|
|
126
126
|
openai_message_list = [
|
|
127
127
|
cast_message_to_subtype(m.to_openai_dict(put_inner_thoughts_in_kwargs=llm_config.put_inner_thoughts_in_kwargs)) for m in messages
|
|
128
128
|
]
|
|
129
|
+
|
|
129
130
|
if llm_config.model:
|
|
130
131
|
model = llm_config.model
|
|
131
132
|
else:
|
{letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/memory.py
RENAMED
|
@@ -7,6 +7,7 @@ from letta.embeddings import embedding_model, parse_and_chunk_text, query_embedd
|
|
|
7
7
|
from letta.llm_api.llm_api_tools import create
|
|
8
8
|
from letta.prompts.gpt_summarize import SYSTEM as SUMMARY_PROMPT_SYSTEM
|
|
9
9
|
from letta.schemas.agent import AgentState
|
|
10
|
+
from letta.schemas.enums import MessageRole
|
|
10
11
|
from letta.schemas.memory import Memory
|
|
11
12
|
from letta.schemas.message import Message
|
|
12
13
|
from letta.schemas.passage import Passage
|
|
@@ -50,7 +51,6 @@ def _format_summary_history(message_history: List[Message]):
|
|
|
50
51
|
def summarize_messages(
|
|
51
52
|
agent_state: AgentState,
|
|
52
53
|
message_sequence_to_summarize: List[Message],
|
|
53
|
-
insert_acknowledgement_assistant_message: bool = True,
|
|
54
54
|
):
|
|
55
55
|
"""Summarize a message sequence using GPT"""
|
|
56
56
|
# we need the context_window
|
|
@@ -70,13 +70,17 @@ def summarize_messages(
|
|
|
70
70
|
dummy_user_id = agent_state.user_id
|
|
71
71
|
dummy_agent_id = agent_state.id
|
|
72
72
|
message_sequence = []
|
|
73
|
-
message_sequence.append(Message(user_id=dummy_user_id, agent_id=dummy_agent_id, role=
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
message_sequence.append(Message(user_id=dummy_user_id, agent_id=dummy_agent_id, role=MessageRole.system, text=summary_prompt))
|
|
74
|
+
message_sequence.append(
|
|
75
|
+
Message(user_id=dummy_user_id, agent_id=dummy_agent_id, role=MessageRole.assistant, text=MESSAGE_SUMMARY_REQUEST_ACK)
|
|
76
|
+
)
|
|
77
|
+
message_sequence.append(Message(user_id=dummy_user_id, agent_id=dummy_agent_id, role=MessageRole.user, text=summary_input))
|
|
77
78
|
|
|
79
|
+
# TODO: We need to eventually have a separate LLM config for the summarizer LLM
|
|
80
|
+
llm_config_no_inner_thoughts = agent_state.llm_config.model_copy(deep=True)
|
|
81
|
+
llm_config_no_inner_thoughts.put_inner_thoughts_in_kwargs = False
|
|
78
82
|
response = create(
|
|
79
|
-
llm_config=
|
|
83
|
+
llm_config=llm_config_no_inner_thoughts,
|
|
80
84
|
user_id=agent_state.user_id,
|
|
81
85
|
messages=message_sequence,
|
|
82
86
|
stream=False,
|
{letta_nightly-0.5.2.dev20241112104101 → letta_nightly-0.5.2.dev20241113104112}/letta/metadata.py
RENAMED
|
@@ -29,7 +29,6 @@ from letta.schemas.job import Job
|
|
|
29
29
|
from letta.schemas.llm_config import LLMConfig
|
|
30
30
|
from letta.schemas.memory import Memory
|
|
31
31
|
from letta.schemas.openai.chat_completions import ToolCall, ToolCallFunction
|
|
32
|
-
from letta.schemas.source import Source
|
|
33
32
|
from letta.schemas.tool_rule import (
|
|
34
33
|
BaseToolRule,
|
|
35
34
|
InitToolRule,
|
|
@@ -292,40 +291,6 @@ class AgentModel(Base):
|
|
|
292
291
|
return agent_state
|
|
293
292
|
|
|
294
293
|
|
|
295
|
-
class SourceModel(Base):
|
|
296
|
-
"""Defines data model for storing Passages (consisting of text, embedding)"""
|
|
297
|
-
|
|
298
|
-
__tablename__ = "sources"
|
|
299
|
-
__table_args__ = {"extend_existing": True}
|
|
300
|
-
|
|
301
|
-
# Assuming passage_id is the primary key
|
|
302
|
-
# id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
303
|
-
id = Column(String, primary_key=True)
|
|
304
|
-
user_id = Column(String, nullable=False)
|
|
305
|
-
name = Column(String, nullable=False)
|
|
306
|
-
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
307
|
-
embedding_config = Column(EmbeddingConfigColumn)
|
|
308
|
-
description = Column(String)
|
|
309
|
-
metadata_ = Column(JSON)
|
|
310
|
-
Index(__tablename__ + "_idx_user", user_id),
|
|
311
|
-
|
|
312
|
-
# TODO: add num passages
|
|
313
|
-
|
|
314
|
-
def __repr__(self) -> str:
|
|
315
|
-
return f"<Source(passage_id='{self.id}', name='{self.name}')>"
|
|
316
|
-
|
|
317
|
-
def to_record(self) -> Source:
|
|
318
|
-
return Source(
|
|
319
|
-
id=self.id,
|
|
320
|
-
user_id=self.user_id,
|
|
321
|
-
name=self.name,
|
|
322
|
-
created_at=self.created_at,
|
|
323
|
-
embedding_config=self.embedding_config,
|
|
324
|
-
description=self.description,
|
|
325
|
-
metadata_=self.metadata_,
|
|
326
|
-
)
|
|
327
|
-
|
|
328
|
-
|
|
329
294
|
class AgentSourceMappingModel(Base):
|
|
330
295
|
"""Stores mapping between agent -> source"""
|
|
331
296
|
|
|
@@ -497,14 +462,6 @@ class MetadataStore:
|
|
|
497
462
|
session.add(AgentModel(**fields))
|
|
498
463
|
session.commit()
|
|
499
464
|
|
|
500
|
-
@enforce_types
|
|
501
|
-
def create_source(self, source: Source):
|
|
502
|
-
with self.session_maker() as session:
|
|
503
|
-
if session.query(SourceModel).filter(SourceModel.name == source.name).filter(SourceModel.user_id == source.user_id).count() > 0:
|
|
504
|
-
raise ValueError(f"Source with name {source.name} already exists for user {source.user_id}")
|
|
505
|
-
session.add(SourceModel(**vars(source)))
|
|
506
|
-
session.commit()
|
|
507
|
-
|
|
508
465
|
@enforce_types
|
|
509
466
|
def create_block(self, block: Block):
|
|
510
467
|
with self.session_maker() as session:
|
|
@@ -522,6 +479,7 @@ class MetadataStore:
|
|
|
522
479
|
):
|
|
523
480
|
|
|
524
481
|
raise ValueError(f"Block with name {block.template_name} already exists")
|
|
482
|
+
|
|
525
483
|
session.add(BlockModel(**vars(block)))
|
|
526
484
|
session.commit()
|
|
527
485
|
|
|
@@ -536,12 +494,6 @@ class MetadataStore:
|
|
|
536
494
|
session.query(AgentModel).filter(AgentModel.id == agent.id).update(fields)
|
|
537
495
|
session.commit()
|
|
538
496
|
|
|
539
|
-
@enforce_types
|
|
540
|
-
def update_source(self, source: Source):
|
|
541
|
-
with self.session_maker() as session:
|
|
542
|
-
session.query(SourceModel).filter(SourceModel.id == source.id).update(vars(source))
|
|
543
|
-
session.commit()
|
|
544
|
-
|
|
545
497
|
@enforce_types
|
|
546
498
|
def update_block(self, block: Block):
|
|
547
499
|
with self.session_maker() as session:
|
|
@@ -591,29 +543,12 @@ class MetadataStore:
|
|
|
591
543
|
|
|
592
544
|
session.commit()
|
|
593
545
|
|
|
594
|
-
@enforce_types
|
|
595
|
-
def delete_source(self, source_id: str):
|
|
596
|
-
with self.session_maker() as session:
|
|
597
|
-
# delete from sources table
|
|
598
|
-
session.query(SourceModel).filter(SourceModel.id == source_id).delete()
|
|
599
|
-
|
|
600
|
-
# delete any mappings
|
|
601
|
-
session.query(AgentSourceMappingModel).filter(AgentSourceMappingModel.source_id == source_id).delete()
|
|
602
|
-
|
|
603
|
-
session.commit()
|
|
604
|
-
|
|
605
546
|
@enforce_types
|
|
606
547
|
def list_agents(self, user_id: str) -> List[AgentState]:
|
|
607
548
|
with self.session_maker() as session:
|
|
608
549
|
results = session.query(AgentModel).filter(AgentModel.user_id == user_id).all()
|
|
609
550
|
return [r.to_record() for r in results]
|
|
610
551
|
|
|
611
|
-
@enforce_types
|
|
612
|
-
def list_sources(self, user_id: str) -> List[Source]:
|
|
613
|
-
with self.session_maker() as session:
|
|
614
|
-
results = session.query(SourceModel).filter(SourceModel.user_id == user_id).all()
|
|
615
|
-
return [r.to_record() for r in results]
|
|
616
|
-
|
|
617
552
|
@enforce_types
|
|
618
553
|
def get_agent(
|
|
619
554
|
self, agent_id: Optional[str] = None, agent_name: Optional[str] = None, user_id: Optional[str] = None
|
|
@@ -630,21 +565,6 @@ class MetadataStore:
|
|
|
630
565
|
assert len(results) == 1, f"Expected 1 result, got {len(results)}" # should only be one result
|
|
631
566
|
return results[0].to_record()
|
|
632
567
|
|
|
633
|
-
@enforce_types
|
|
634
|
-
def get_source(
|
|
635
|
-
self, source_id: Optional[str] = None, user_id: Optional[str] = None, source_name: Optional[str] = None
|
|
636
|
-
) -> Optional[Source]:
|
|
637
|
-
with self.session_maker() as session:
|
|
638
|
-
if source_id:
|
|
639
|
-
results = session.query(SourceModel).filter(SourceModel.id == source_id).all()
|
|
640
|
-
else:
|
|
641
|
-
assert user_id is not None and source_name is not None
|
|
642
|
-
results = session.query(SourceModel).filter(SourceModel.name == source_name).filter(SourceModel.user_id == user_id).all()
|
|
643
|
-
if len(results) == 0:
|
|
644
|
-
return None
|
|
645
|
-
assert len(results) == 1, f"Expected 1 result, got {len(results)}"
|
|
646
|
-
return results[0].to_record()
|
|
647
|
-
|
|
648
568
|
@enforce_types
|
|
649
569
|
def get_block(self, block_id: str) -> Optional[Block]:
|
|
650
570
|
with self.session_maker() as session:
|
|
@@ -699,19 +619,10 @@ class MetadataStore:
|
|
|
699
619
|
session.commit()
|
|
700
620
|
|
|
701
621
|
@enforce_types
|
|
702
|
-
def
|
|
622
|
+
def list_attached_source_ids(self, agent_id: str) -> List[str]:
|
|
703
623
|
with self.session_maker() as session:
|
|
704
624
|
results = session.query(AgentSourceMappingModel).filter(AgentSourceMappingModel.agent_id == agent_id).all()
|
|
705
|
-
|
|
706
|
-
sources = []
|
|
707
|
-
# make sure source exists
|
|
708
|
-
for r in results:
|
|
709
|
-
source = self.get_source(source_id=r.source_id)
|
|
710
|
-
if source:
|
|
711
|
-
sources.append(source)
|
|
712
|
-
else:
|
|
713
|
-
printd(f"Warning: source {r.source_id} does not exist but exists in mapping database. This should never happen.")
|
|
714
|
-
return sources
|
|
625
|
+
return [r.source_id for r in results]
|
|
715
626
|
|
|
716
627
|
@enforce_types
|
|
717
628
|
def list_attached_agents(self, source_id: str) -> List[str]:
|
|
@@ -21,13 +21,13 @@ class Organization(SqlalchemyBase):
|
|
|
21
21
|
id: Mapped[str] = mapped_column(String, primary_key=True)
|
|
22
22
|
name: Mapped[str] = mapped_column(doc="The display name of the organization.")
|
|
23
23
|
|
|
24
|
+
# relationships
|
|
24
25
|
users: Mapped[List["User"]] = relationship("User", back_populates="organization", cascade="all, delete-orphan")
|
|
25
26
|
tools: Mapped[List["Tool"]] = relationship("Tool", back_populates="organization", cascade="all, delete-orphan")
|
|
27
|
+
sources: Mapped[List["Source"]] = relationship("Source", back_populates="organization", cascade="all, delete-orphan")
|
|
26
28
|
agents_tags: Mapped[List["AgentsTags"]] = relationship("AgentsTags", back_populates="organization", cascade="all, delete-orphan")
|
|
27
|
-
|
|
28
29
|
# TODO: Map these relationships later when we actually make these models
|
|
29
30
|
# below is just a suggestion
|
|
30
31
|
# agents: Mapped[List["Agent"]] = relationship("Agent", back_populates="organization", cascade="all, delete-orphan")
|
|
31
|
-
# sources: Mapped[List["Source"]] = relationship("Source", back_populates="organization", cascade="all, delete-orphan")
|
|
32
32
|
# tools: Mapped[List["Tool"]] = relationship("Tool", back_populates="organization", cascade="all, delete-orphan")
|
|
33
33
|
# documents: Mapped[List["Document"]] = relationship("Document", back_populates="organization", cascade="all, delete-orphan")
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from typing import TYPE_CHECKING, Optional
|
|
2
|
+
|
|
3
|
+
from sqlalchemy import JSON, TypeDecorator
|
|
4
|
+
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
5
|
+
|
|
6
|
+
from letta.orm.mixins import OrganizationMixin
|
|
7
|
+
from letta.orm.sqlalchemy_base import SqlalchemyBase
|
|
8
|
+
from letta.schemas.embedding_config import EmbeddingConfig
|
|
9
|
+
from letta.schemas.source import Source as PydanticSource
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from letta.orm.organization import Organization
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class EmbeddingConfigColumn(TypeDecorator):
|
|
16
|
+
"""Custom type for storing EmbeddingConfig as JSON"""
|
|
17
|
+
|
|
18
|
+
impl = JSON
|
|
19
|
+
cache_ok = True
|
|
20
|
+
|
|
21
|
+
def load_dialect_impl(self, dialect):
|
|
22
|
+
return dialect.type_descriptor(JSON())
|
|
23
|
+
|
|
24
|
+
def process_bind_param(self, value, dialect):
|
|
25
|
+
if value:
|
|
26
|
+
# return vars(value)
|
|
27
|
+
if isinstance(value, EmbeddingConfig):
|
|
28
|
+
return value.model_dump()
|
|
29
|
+
return value
|
|
30
|
+
|
|
31
|
+
def process_result_value(self, value, dialect):
|
|
32
|
+
if value:
|
|
33
|
+
return EmbeddingConfig(**value)
|
|
34
|
+
return value
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Source(SqlalchemyBase, OrganizationMixin):
|
|
38
|
+
"""A source represents an embedded text passage"""
|
|
39
|
+
|
|
40
|
+
__tablename__ = "sources"
|
|
41
|
+
__pydantic_model__ = PydanticSource
|
|
42
|
+
|
|
43
|
+
name: Mapped[str] = mapped_column(doc="the name of the source, must be unique within the org", nullable=False)
|
|
44
|
+
description: Mapped[str] = mapped_column(nullable=True, doc="a human-readable description of the source")
|
|
45
|
+
embedding_config: Mapped[EmbeddingConfig] = mapped_column(EmbeddingConfigColumn, doc="Configuration settings for embedding.")
|
|
46
|
+
metadata_: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True, doc="metadata for the source.")
|
|
47
|
+
|
|
48
|
+
# relationships
|
|
49
|
+
organization: Mapped["Organization"] = relationship("Organization", back_populates="sources")
|
|
50
|
+
# agents: Mapped[List["Agent"]] = relationship("Agent", secondary="sources_agents", back_populates="sources")
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
|
-
from
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
4
|
+
from pydantic import Field
|
|
6
5
|
|
|
7
6
|
from letta.schemas.embedding_config import EmbeddingConfig
|
|
8
7
|
from letta.schemas.letta_base import LettaBase
|
|
9
|
-
from letta.utils import get_utc_time
|
|
10
8
|
|
|
11
9
|
|
|
12
10
|
class BaseSource(LettaBase):
|
|
@@ -15,15 +13,6 @@ class BaseSource(LettaBase):
|
|
|
15
13
|
"""
|
|
16
14
|
|
|
17
15
|
__id_prefix__ = "source"
|
|
18
|
-
description: Optional[str] = Field(None, description="The description of the source.")
|
|
19
|
-
embedding_config: Optional[EmbeddingConfig] = Field(None, description="The embedding configuration used by the passage.")
|
|
20
|
-
# NOTE: .metadata is a reserved attribute on SQLModel
|
|
21
|
-
metadata_: Optional[dict] = Field(None, description="Metadata associated with the source.")
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class SourceCreate(BaseSource):
|
|
25
|
-
name: str = Field(..., description="The name of the source.")
|
|
26
|
-
description: Optional[str] = Field(None, description="The description of the source.")
|
|
27
16
|
|
|
28
17
|
|
|
29
18
|
class Source(BaseSource):
|
|
@@ -34,7 +23,6 @@ class Source(BaseSource):
|
|
|
34
23
|
id (str): The ID of the source
|
|
35
24
|
name (str): The name of the source.
|
|
36
25
|
embedding_config (EmbeddingConfig): The embedding configuration used by the source.
|
|
37
|
-
created_at (datetime): The creation date of the source.
|
|
38
26
|
user_id (str): The ID of the user that created the source.
|
|
39
27
|
metadata_ (dict): Metadata associated with the source.
|
|
40
28
|
description (str): The description of the source.
|
|
@@ -42,21 +30,39 @@ class Source(BaseSource):
|
|
|
42
30
|
|
|
43
31
|
id: str = BaseSource.generate_id_field()
|
|
44
32
|
name: str = Field(..., description="The name of the source.")
|
|
33
|
+
description: Optional[str] = Field(None, description="The description of the source.")
|
|
45
34
|
embedding_config: EmbeddingConfig = Field(..., description="The embedding configuration used by the source.")
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
organization_id: Optional[str] = Field(None, description="The ID of the organization that created the source.")
|
|
36
|
+
metadata_: Optional[dict] = Field(None, description="Metadata associated with the source.")
|
|
48
37
|
|
|
38
|
+
# metadata fields
|
|
39
|
+
created_by_id: Optional[str] = Field(None, description="The id of the user that made this Tool.")
|
|
40
|
+
last_updated_by_id: Optional[str] = Field(None, description="The id of the user that made this Tool.")
|
|
41
|
+
created_at: Optional[datetime] = Field(None, description="The timestamp when the source was created.")
|
|
42
|
+
updated_at: Optional[datetime] = Field(None, description="The timestamp when the source was last updated.")
|
|
49
43
|
|
|
50
|
-
class SourceUpdate(BaseSource):
|
|
51
|
-
id: str = Field(..., description="The ID of the source.")
|
|
52
|
-
name: Optional[str] = Field(None, description="The name of the source.")
|
|
53
44
|
|
|
45
|
+
class SourceCreate(BaseSource):
|
|
46
|
+
"""
|
|
47
|
+
Schema for creating a new Source.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
# required
|
|
51
|
+
name: str = Field(..., description="The name of the source.")
|
|
52
|
+
# TODO: @matt, make this required after shub makes the FE changes
|
|
53
|
+
embedding_config: Optional[EmbeddingConfig] = Field(None, description="The embedding configuration used by the source.")
|
|
54
|
+
|
|
55
|
+
# optional
|
|
56
|
+
description: Optional[str] = Field(None, description="The description of the source.")
|
|
57
|
+
metadata_: Optional[dict] = Field(None, description="Metadata associated with the source.")
|
|
54
58
|
|
|
55
|
-
class UploadFileToSourceRequest(BaseModel):
|
|
56
|
-
file: UploadFile = Field(..., description="The file to upload.")
|
|
57
59
|
|
|
60
|
+
class SourceUpdate(BaseSource):
|
|
61
|
+
"""
|
|
62
|
+
Schema for updating an existing Source.
|
|
63
|
+
"""
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
name: Optional[str] = Field(None, description="The name of the source.")
|
|
66
|
+
description: Optional[str] = Field(None, description="The description of the source.")
|
|
67
|
+
metadata_: Optional[dict] = Field(None, description="Metadata associated with the source.")
|
|
68
|
+
embedding_config: Optional[EmbeddingConfig] = Field(None, description="The embedding configuration used by the source.")
|
|
@@ -6,6 +6,8 @@ from typing import Optional
|
|
|
6
6
|
|
|
7
7
|
import uvicorn
|
|
8
8
|
from fastapi import FastAPI
|
|
9
|
+
from fastapi.responses import JSONResponse
|
|
10
|
+
from starlette.middleware.base import BaseHTTPMiddleware
|
|
9
11
|
from starlette.middleware.cors import CORSMiddleware
|
|
10
12
|
|
|
11
13
|
from letta.__init__ import __version__
|
|
@@ -94,6 +96,27 @@ def generate_openapi_schema(app: FastAPI):
|
|
|
94
96
|
Path(f"openapi_{name}.json").write_text(json.dumps(docs, indent=2))
|
|
95
97
|
|
|
96
98
|
|
|
99
|
+
# middleware that only allows requests to pass through if user provides a password thats randomly generated and stored in memory
|
|
100
|
+
def generate_password():
|
|
101
|
+
import secrets
|
|
102
|
+
|
|
103
|
+
return secrets.token_urlsafe(16)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
random_password = generate_password()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class CheckPasswordMiddleware(BaseHTTPMiddleware):
|
|
110
|
+
async def dispatch(self, request, call_next):
|
|
111
|
+
if request.headers.get("X-BARE-PASSWORD") == f"password {random_password}":
|
|
112
|
+
return await call_next(request)
|
|
113
|
+
|
|
114
|
+
return JSONResponse(
|
|
115
|
+
content={"detail": "Unauthorized"},
|
|
116
|
+
status_code=401,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
|
|
97
120
|
def create_application() -> "FastAPI":
|
|
98
121
|
"""the application start routine"""
|
|
99
122
|
# global server
|
|
@@ -113,6 +136,10 @@ def create_application() -> "FastAPI":
|
|
|
113
136
|
settings.cors_origins.append("https://app.letta.com")
|
|
114
137
|
print(f"▶ View using ADE at: https://app.letta.com/local-project/agents")
|
|
115
138
|
|
|
139
|
+
if "--secure" in sys.argv:
|
|
140
|
+
print(f"▶ Using secure mode with password: {random_password}")
|
|
141
|
+
app.add_middleware(CheckPasswordMiddleware)
|
|
142
|
+
|
|
116
143
|
app.add_middleware(
|
|
117
144
|
CORSMiddleware,
|
|
118
145
|
allow_origins=settings.cors_origins,
|