letta-nightly 0.6.1.dev20241209104258__tar.gz → 0.6.2.dev20241210030252__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.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/PKG-INFO +1 -1
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/__init__.py +1 -1
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/agent.py +7 -1
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/cli/cli.py +1 -0
- letta_nightly-0.6.2.dev20241210030252/letta/cli/cli_load.py +68 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/client/client.py +68 -12
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/main.py +0 -1
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/offline_memory_agent.py +2 -5
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/tool.py +6 -8
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/tool.py +5 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/app.py +4 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/agents.py +100 -1
- letta_nightly-0.6.2.dev20241210030252/letta/server/startup.sh +49 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/utils.py +5 -6
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/pyproject.toml +3 -3
- letta_nightly-0.6.1.dev20241209104258/letta/cli/cli_load.py +0 -116
- letta_nightly-0.6.1.dev20241209104258/letta/server/startup.sh +0 -17
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/LICENSE +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/README.md +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/__main__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/agent_store/chroma.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/agent_store/db.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/agent_store/milvus.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/agent_store/qdrant.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/agent_store/storage.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/benchmark/benchmark.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/benchmark/constants.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/chat_only_agent.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/cli/cli_config.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/client/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/client/streaming.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/client/utils.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/config.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/constants.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/credentials.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/data_sources/connectors.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/data_sources/connectors_helper.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/embeddings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/errors.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/functions/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/functions/function_sets/base.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/functions/function_sets/extras.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/functions/functions.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/functions/helpers.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/functions/schema_generator.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/helpers/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/helpers/tool_rule_solver.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/humans/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/humans/examples/basic.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/humans/examples/cs_phd.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/interface.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/anthropic.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/azure_openai.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/azure_openai_constants.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/cohere.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/google_ai.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/helpers.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/llm_api_tools.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/mistral.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/llm_api/openai.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/README.md +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/chat_completion_proxy.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/constants.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/function_parser.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/grammars/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/grammars/json.gbnf +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/json_parser.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/koboldcpp/api.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/koboldcpp/settings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llamacpp/api.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llamacpp/settings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/lmstudio/api.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/lmstudio/settings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/ollama/api.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/ollama/settings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/settings/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/settings/settings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/settings/simple.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/utils.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/vllm/api.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/webui/api.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/webui/legacy_api.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/webui/legacy_settings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/local_llm/webui/settings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/log.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/memory.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/metadata.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/o1_agent.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/openai_backcompat/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/openai_backcompat/openai_object.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/__all__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/agents_tags.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/base.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/block.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/blocks_agents.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/enums.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/errors.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/file.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/job.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/message.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/mixins.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/organization.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/sandbox_config.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/source.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/sqlalchemy_base.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/tools_agents.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/user.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/anna_pa.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/google_search_persona.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/memgpt_doc.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/memgpt_starter.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/o1_persona.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/offline_memory_persona.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/sam.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/sam_pov.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/personas/examples/sqldb/test.db +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/gpt_summarize.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/gpt_system.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_base.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_chat.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_convo_only.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_doc.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_modified_o1.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_offline_memory.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/prompts/system/memgpt_offline_memory_chat.txt +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/providers.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/pytest.ini +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/agent.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/agents_tags.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/api_key.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/block.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/blocks_agents.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/embedding_config.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/enums.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/file.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/health.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/job.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/letta_base.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/letta_message.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/letta_request.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/letta_response.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/llm_config.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/memory.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/message.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/openai/chat_completion_request.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/openai/chat_completion_response.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/openai/chat_completions.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/openai/embedding_response.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/openai/openai.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/organization.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/passage.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/sandbox_config.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/source.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/tool_rule.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/tools_agents.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/usage.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/schemas/user.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/constants.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/generate_openapi_schema.sh +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/auth/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/auth/index.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/auth_token.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/interface.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/openai/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/blocks.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/health.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/jobs.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/llms.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/organizations.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/sandbox_configs.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/sources.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/tools.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/routers/v1/users.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/static_files.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/rest_api/utils.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/server.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/static_files/assets/index-43ab4d62.css +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/static_files/assets/index-4848e3d7.js +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/static_files/favicon.ico +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/static_files/index.html +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/utils.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/ws_api/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/ws_api/example_client.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/ws_api/interface.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/ws_api/protocol.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/server/ws_api/server.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/__init__.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/agents_tags_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/block_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/blocks_agents_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/job_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/message_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/organization_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/per_agent_lock_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/sandbox_config_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/source_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/tool_execution_sandbox.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/tool_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/tool_sandbox_env/.gitkeep +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/tools_agents_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/services/user_manager.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/settings.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/streaming_interface.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/streaming_utils.py +0 -0
- {letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/system.py +0 -0
{letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/agent.py
RENAMED
|
@@ -801,7 +801,13 @@ class Agent(BaseAgent):
|
|
|
801
801
|
# but by default, we add a truncation safeguard to prevent bad functions from
|
|
802
802
|
# overflow the agent context window
|
|
803
803
|
truncate = True
|
|
804
|
-
|
|
804
|
+
|
|
805
|
+
# get the function response limit
|
|
806
|
+
tool_obj = [tool for tool in self.agent_state.tools if tool.name == function_name][0]
|
|
807
|
+
return_char_limit = tool_obj.return_char_limit
|
|
808
|
+
function_response_string = validate_function_response(
|
|
809
|
+
function_response, return_char_limit=return_char_limit, truncate=truncate
|
|
810
|
+
)
|
|
805
811
|
function_args.pop("self", None)
|
|
806
812
|
function_response = package_function_response(True, function_response_string)
|
|
807
813
|
function_failed = False
|
{letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/cli/cli.py
RENAMED
|
@@ -51,6 +51,7 @@ def server(
|
|
|
51
51
|
port: Annotated[Optional[int], typer.Option(help="Port to run the server on")] = None,
|
|
52
52
|
host: Annotated[Optional[str], typer.Option(help="Host to run the server on (default to localhost)")] = None,
|
|
53
53
|
debug: Annotated[bool, typer.Option(help="Turn debugging output on")] = False,
|
|
54
|
+
ade: Annotated[bool, typer.Option(help="Allows remote access")] = False, # NOTE: deprecated
|
|
54
55
|
secure: Annotated[bool, typer.Option(help="Adds simple security access")] = False,
|
|
55
56
|
):
|
|
56
57
|
"""Launch a Letta server process"""
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file contains functions for loading data into Letta's archival storage.
|
|
3
|
+
|
|
4
|
+
Data can be loaded with the following command, once a load function is defined:
|
|
5
|
+
```
|
|
6
|
+
letta load <data-connector-type> --name <dataset-name> [ADDITIONAL ARGS]
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import uuid
|
|
12
|
+
from typing import Annotated, List, Optional
|
|
13
|
+
|
|
14
|
+
import questionary
|
|
15
|
+
import typer
|
|
16
|
+
|
|
17
|
+
from letta import create_client
|
|
18
|
+
from letta.data_sources.connectors import DirectoryConnector
|
|
19
|
+
|
|
20
|
+
app = typer.Typer()
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
default_extensions = ".txt,.md,.pdf"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@app.command("directory")
|
|
27
|
+
def load_directory(
|
|
28
|
+
name: Annotated[str, typer.Option(help="Name of dataset to load.")],
|
|
29
|
+
input_dir: Annotated[Optional[str], typer.Option(help="Path to directory containing dataset.")] = None,
|
|
30
|
+
input_files: Annotated[List[str], typer.Option(help="List of paths to files containing dataset.")] = [],
|
|
31
|
+
recursive: Annotated[bool, typer.Option(help="Recursively search for files in directory.")] = False,
|
|
32
|
+
extensions: Annotated[str, typer.Option(help="Comma separated list of file extensions to load")] = default_extensions,
|
|
33
|
+
user_id: Annotated[Optional[uuid.UUID], typer.Option(help="User ID to associate with dataset.")] = None, # TODO: remove
|
|
34
|
+
description: Annotated[Optional[str], typer.Option(help="Description of the source.")] = None,
|
|
35
|
+
):
|
|
36
|
+
client = create_client()
|
|
37
|
+
|
|
38
|
+
# create connector
|
|
39
|
+
connector = DirectoryConnector(input_files=input_files, input_directory=input_dir, recursive=recursive, extensions=extensions)
|
|
40
|
+
|
|
41
|
+
# choose form list of embedding configs
|
|
42
|
+
embedding_configs = client.list_embedding_configs()
|
|
43
|
+
embedding_options = [embedding_config.embedding_model for embedding_config in embedding_configs]
|
|
44
|
+
|
|
45
|
+
embedding_choices = [
|
|
46
|
+
questionary.Choice(title=embedding_config.pretty_print(), value=embedding_config) for embedding_config in embedding_configs
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
# select model
|
|
50
|
+
if len(embedding_options) == 0:
|
|
51
|
+
raise ValueError("No embedding models found. Please enable a provider.")
|
|
52
|
+
elif len(embedding_options) == 1:
|
|
53
|
+
embedding_model_name = embedding_options[0]
|
|
54
|
+
else:
|
|
55
|
+
embedding_model_name = questionary.select("Select embedding model:", choices=embedding_choices).ask().embedding_model
|
|
56
|
+
embedding_config = [
|
|
57
|
+
embedding_config for embedding_config in embedding_configs if embedding_config.embedding_model == embedding_model_name
|
|
58
|
+
][0]
|
|
59
|
+
|
|
60
|
+
# create source
|
|
61
|
+
source = client.create_source(name=name, embedding_config=embedding_config)
|
|
62
|
+
|
|
63
|
+
# load data
|
|
64
|
+
try:
|
|
65
|
+
client.load_data(connector, source_name=name)
|
|
66
|
+
except Exception as e:
|
|
67
|
+
typer.secho(f"Failed to load data from provided information.\n{e}", fg=typer.colors.RED)
|
|
68
|
+
client.delete_source(source.id)
|
|
@@ -11,6 +11,7 @@ from letta.constants import (
|
|
|
11
11
|
BASE_TOOLS,
|
|
12
12
|
DEFAULT_HUMAN,
|
|
13
13
|
DEFAULT_PERSONA,
|
|
14
|
+
FUNCTION_RETURN_CHAR_LIMIT,
|
|
14
15
|
)
|
|
15
16
|
from letta.data_sources.connectors import DataConnector
|
|
16
17
|
from letta.functions.functions import parse_source_code
|
|
@@ -200,18 +201,12 @@ class AbstractClient(object):
|
|
|
200
201
|
raise NotImplementedError
|
|
201
202
|
|
|
202
203
|
def create_tool(
|
|
203
|
-
self,
|
|
204
|
-
func,
|
|
205
|
-
name: Optional[str] = None,
|
|
206
|
-
tags: Optional[List[str]] = None,
|
|
204
|
+
self, func, name: Optional[str] = None, tags: Optional[List[str]] = None, return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT
|
|
207
205
|
) -> Tool:
|
|
208
206
|
raise NotImplementedError
|
|
209
207
|
|
|
210
208
|
def create_or_update_tool(
|
|
211
|
-
self,
|
|
212
|
-
func,
|
|
213
|
-
name: Optional[str] = None,
|
|
214
|
-
tags: Optional[List[str]] = None,
|
|
209
|
+
self, func, name: Optional[str] = None, tags: Optional[List[str]] = None, return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT
|
|
215
210
|
) -> Tool:
|
|
216
211
|
raise NotImplementedError
|
|
217
212
|
|
|
@@ -222,6 +217,7 @@ class AbstractClient(object):
|
|
|
222
217
|
description: Optional[str] = None,
|
|
223
218
|
func: Optional[Callable] = None,
|
|
224
219
|
tags: Optional[List[str]] = None,
|
|
220
|
+
return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT,
|
|
225
221
|
) -> Tool:
|
|
226
222
|
raise NotImplementedError
|
|
227
223
|
|
|
@@ -960,7 +956,6 @@ class RESTClient(AbstractClient):
|
|
|
960
956
|
# TODO: figure out how to handle stream_steps and stream_tokens
|
|
961
957
|
|
|
962
958
|
# When streaming steps is True, stream_tokens must be False
|
|
963
|
-
request = LettaRequest(messages=messages)
|
|
964
959
|
if stream_tokens or stream_steps:
|
|
965
960
|
from letta.client.streaming import _sse_post
|
|
966
961
|
|
|
@@ -985,6 +980,39 @@ class RESTClient(AbstractClient):
|
|
|
985
980
|
|
|
986
981
|
return response
|
|
987
982
|
|
|
983
|
+
def send_message_async(
|
|
984
|
+
self,
|
|
985
|
+
message: str,
|
|
986
|
+
role: str,
|
|
987
|
+
agent_id: Optional[str] = None,
|
|
988
|
+
name: Optional[str] = None,
|
|
989
|
+
) -> Job:
|
|
990
|
+
"""
|
|
991
|
+
Send a message to an agent (async, returns a job)
|
|
992
|
+
|
|
993
|
+
Args:
|
|
994
|
+
message (str): Message to send
|
|
995
|
+
role (str): Role of the message
|
|
996
|
+
agent_id (str): ID of the agent
|
|
997
|
+
name(str): Name of the sender
|
|
998
|
+
|
|
999
|
+
Returns:
|
|
1000
|
+
job (Job): Information about the async job
|
|
1001
|
+
"""
|
|
1002
|
+
messages = [MessageCreate(role=MessageRole(role), text=message, name=name)]
|
|
1003
|
+
|
|
1004
|
+
request = LettaRequest(messages=messages)
|
|
1005
|
+
response = requests.post(
|
|
1006
|
+
f"{self.base_url}/{self.api_prefix}/agents/{agent_id}/messages/async",
|
|
1007
|
+
json=request.model_dump(),
|
|
1008
|
+
headers=self.headers,
|
|
1009
|
+
)
|
|
1010
|
+
if response.status_code != 200:
|
|
1011
|
+
raise ValueError(f"Failed to send message: {response.text}")
|
|
1012
|
+
response = Job(**response.json())
|
|
1013
|
+
|
|
1014
|
+
return response
|
|
1015
|
+
|
|
988
1016
|
# humans / personas
|
|
989
1017
|
|
|
990
1018
|
def list_blocks(self, label: Optional[str] = None, templates_only: Optional[bool] = True) -> List[Block]:
|
|
@@ -1319,6 +1347,7 @@ class RESTClient(AbstractClient):
|
|
|
1319
1347
|
Returns:
|
|
1320
1348
|
source (Source): Created source
|
|
1321
1349
|
"""
|
|
1350
|
+
assert embedding_config or self._default_embedding_config, f"Must specify embedding_config for source"
|
|
1322
1351
|
source_create = SourceCreate(name=name, embedding_config=embedding_config or self._default_embedding_config)
|
|
1323
1352
|
payload = source_create.model_dump()
|
|
1324
1353
|
response = requests.post(f"{self.base_url}/{self.api_prefix}/sources", json=payload, headers=self.headers)
|
|
@@ -1432,6 +1461,7 @@ class RESTClient(AbstractClient):
|
|
|
1432
1461
|
func: Callable,
|
|
1433
1462
|
name: Optional[str] = None,
|
|
1434
1463
|
tags: Optional[List[str]] = None,
|
|
1464
|
+
return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT,
|
|
1435
1465
|
) -> Tool:
|
|
1436
1466
|
"""
|
|
1437
1467
|
Create a tool. This stores the source code of function on the server, so that the server can execute the function and generate an OpenAI JSON schemas for it when using with an agent.
|
|
@@ -1440,6 +1470,7 @@ class RESTClient(AbstractClient):
|
|
|
1440
1470
|
func (callable): The function to create a tool for.
|
|
1441
1471
|
name: (str): Name of the tool (must be unique per-user.)
|
|
1442
1472
|
tags (Optional[List[str]], optional): Tags for the tool. Defaults to None.
|
|
1473
|
+
return_char_limit (int): The character limit for the tool's return value. Defaults to FUNCTION_RETURN_CHAR_LIMIT.
|
|
1443
1474
|
|
|
1444
1475
|
Returns:
|
|
1445
1476
|
tool (Tool): The created tool.
|
|
@@ -1448,7 +1479,9 @@ class RESTClient(AbstractClient):
|
|
|
1448
1479
|
source_type = "python"
|
|
1449
1480
|
|
|
1450
1481
|
# call server function
|
|
1451
|
-
request = ToolCreate(source_type=source_type, source_code=source_code, name=name,
|
|
1482
|
+
request = ToolCreate(source_type=source_type, source_code=source_code, name=name, return_char_limit=return_char_limit)
|
|
1483
|
+
if tags:
|
|
1484
|
+
request.tags = tags
|
|
1452
1485
|
response = requests.post(f"{self.base_url}/{self.api_prefix}/tools", json=request.model_dump(), headers=self.headers)
|
|
1453
1486
|
if response.status_code != 200:
|
|
1454
1487
|
raise ValueError(f"Failed to create tool: {response.text}")
|
|
@@ -1459,6 +1492,7 @@ class RESTClient(AbstractClient):
|
|
|
1459
1492
|
func: Callable,
|
|
1460
1493
|
name: Optional[str] = None,
|
|
1461
1494
|
tags: Optional[List[str]] = None,
|
|
1495
|
+
return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT,
|
|
1462
1496
|
) -> Tool:
|
|
1463
1497
|
"""
|
|
1464
1498
|
Creates or updates a tool. This stores the source code of function on the server, so that the server can execute the function and generate an OpenAI JSON schemas for it when using with an agent.
|
|
@@ -1467,6 +1501,7 @@ class RESTClient(AbstractClient):
|
|
|
1467
1501
|
func (callable): The function to create a tool for.
|
|
1468
1502
|
name: (str): Name of the tool (must be unique per-user.)
|
|
1469
1503
|
tags (Optional[List[str]], optional): Tags for the tool. Defaults to None.
|
|
1504
|
+
return_char_limit (int): The character limit for the tool's return value. Defaults to FUNCTION_RETURN_CHAR_LIMIT.
|
|
1470
1505
|
|
|
1471
1506
|
Returns:
|
|
1472
1507
|
tool (Tool): The created tool.
|
|
@@ -1475,7 +1510,9 @@ class RESTClient(AbstractClient):
|
|
|
1475
1510
|
source_type = "python"
|
|
1476
1511
|
|
|
1477
1512
|
# call server function
|
|
1478
|
-
request = ToolCreate(source_type=source_type, source_code=source_code, name=name,
|
|
1513
|
+
request = ToolCreate(source_type=source_type, source_code=source_code, name=name, return_char_limit=return_char_limit)
|
|
1514
|
+
if tags:
|
|
1515
|
+
request.tags = tags
|
|
1479
1516
|
response = requests.put(f"{self.base_url}/{self.api_prefix}/tools", json=request.model_dump(), headers=self.headers)
|
|
1480
1517
|
if response.status_code != 200:
|
|
1481
1518
|
raise ValueError(f"Failed to create tool: {response.text}")
|
|
@@ -1488,6 +1525,7 @@ class RESTClient(AbstractClient):
|
|
|
1488
1525
|
description: Optional[str] = None,
|
|
1489
1526
|
func: Optional[Callable] = None,
|
|
1490
1527
|
tags: Optional[List[str]] = None,
|
|
1528
|
+
return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT,
|
|
1491
1529
|
) -> Tool:
|
|
1492
1530
|
"""
|
|
1493
1531
|
Update a tool with provided parameters (name, func, tags)
|
|
@@ -1497,6 +1535,7 @@ class RESTClient(AbstractClient):
|
|
|
1497
1535
|
name (str): Name of the tool
|
|
1498
1536
|
func (callable): Function to wrap in a tool
|
|
1499
1537
|
tags (List[str]): Tags for the tool
|
|
1538
|
+
return_char_limit (int): The character limit for the tool's return value. Defaults to FUNCTION_RETURN_CHAR_LIMIT.
|
|
1500
1539
|
|
|
1501
1540
|
Returns:
|
|
1502
1541
|
tool (Tool): Updated tool
|
|
@@ -1508,7 +1547,14 @@ class RESTClient(AbstractClient):
|
|
|
1508
1547
|
|
|
1509
1548
|
source_type = "python"
|
|
1510
1549
|
|
|
1511
|
-
request = ToolUpdate(
|
|
1550
|
+
request = ToolUpdate(
|
|
1551
|
+
description=description,
|
|
1552
|
+
source_type=source_type,
|
|
1553
|
+
source_code=source_code,
|
|
1554
|
+
tags=tags,
|
|
1555
|
+
name=name,
|
|
1556
|
+
return_char_limit=return_char_limit,
|
|
1557
|
+
)
|
|
1512
1558
|
response = requests.patch(f"{self.base_url}/{self.api_prefix}/tools/{id}", json=request.model_dump(), headers=self.headers)
|
|
1513
1559
|
if response.status_code != 200:
|
|
1514
1560
|
raise ValueError(f"Failed to update tool: {response.text}")
|
|
@@ -2693,6 +2739,7 @@ class LocalClient(AbstractClient):
|
|
|
2693
2739
|
name: Optional[str] = None,
|
|
2694
2740
|
tags: Optional[List[str]] = None,
|
|
2695
2741
|
description: Optional[str] = None,
|
|
2742
|
+
return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT,
|
|
2696
2743
|
) -> Tool:
|
|
2697
2744
|
"""
|
|
2698
2745
|
Create a tool. This stores the source code of function on the server, so that the server can execute the function and generate an OpenAI JSON schemas for it when using with an agent.
|
|
@@ -2702,6 +2749,7 @@ class LocalClient(AbstractClient):
|
|
|
2702
2749
|
name: (str): Name of the tool (must be unique per-user.)
|
|
2703
2750
|
tags (Optional[List[str]], optional): Tags for the tool. Defaults to None.
|
|
2704
2751
|
description (str, optional): The description.
|
|
2752
|
+
return_char_limit (int): The character limit for the tool's return value. Defaults to FUNCTION_RETURN_CHAR_LIMIT.
|
|
2705
2753
|
|
|
2706
2754
|
Returns:
|
|
2707
2755
|
tool (Tool): The created tool.
|
|
@@ -2722,6 +2770,7 @@ class LocalClient(AbstractClient):
|
|
|
2722
2770
|
name=name,
|
|
2723
2771
|
tags=tags,
|
|
2724
2772
|
description=description,
|
|
2773
|
+
return_char_limit=return_char_limit,
|
|
2725
2774
|
),
|
|
2726
2775
|
actor=self.user,
|
|
2727
2776
|
)
|
|
@@ -2732,6 +2781,7 @@ class LocalClient(AbstractClient):
|
|
|
2732
2781
|
name: Optional[str] = None,
|
|
2733
2782
|
tags: Optional[List[str]] = None,
|
|
2734
2783
|
description: Optional[str] = None,
|
|
2784
|
+
return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT,
|
|
2735
2785
|
) -> Tool:
|
|
2736
2786
|
"""
|
|
2737
2787
|
Creates or updates a tool. This stores the source code of function on the server, so that the server can execute the function and generate an OpenAI JSON schemas for it when using with an agent.
|
|
@@ -2741,6 +2791,7 @@ class LocalClient(AbstractClient):
|
|
|
2741
2791
|
name: (str): Name of the tool (must be unique per-user.)
|
|
2742
2792
|
tags (Optional[List[str]], optional): Tags for the tool. Defaults to None.
|
|
2743
2793
|
description (str, optional): The description.
|
|
2794
|
+
return_char_limit (int): The character limit for the tool's return value. Defaults to FUNCTION_RETURN_CHAR_LIMIT.
|
|
2744
2795
|
|
|
2745
2796
|
Returns:
|
|
2746
2797
|
tool (Tool): The created tool.
|
|
@@ -2758,6 +2809,7 @@ class LocalClient(AbstractClient):
|
|
|
2758
2809
|
name=name,
|
|
2759
2810
|
tags=tags,
|
|
2760
2811
|
description=description,
|
|
2812
|
+
return_char_limit=return_char_limit,
|
|
2761
2813
|
),
|
|
2762
2814
|
actor=self.user,
|
|
2763
2815
|
)
|
|
@@ -2769,6 +2821,7 @@ class LocalClient(AbstractClient):
|
|
|
2769
2821
|
description: Optional[str] = None,
|
|
2770
2822
|
func: Optional[callable] = None,
|
|
2771
2823
|
tags: Optional[List[str]] = None,
|
|
2824
|
+
return_char_limit: int = FUNCTION_RETURN_CHAR_LIMIT,
|
|
2772
2825
|
) -> Tool:
|
|
2773
2826
|
"""
|
|
2774
2827
|
Update a tool with provided parameters (name, func, tags)
|
|
@@ -2778,6 +2831,7 @@ class LocalClient(AbstractClient):
|
|
|
2778
2831
|
name (str): Name of the tool
|
|
2779
2832
|
func (callable): Function to wrap in a tool
|
|
2780
2833
|
tags (List[str]): Tags for the tool
|
|
2834
|
+
return_char_limit (int): The character limit for the tool's return value. Defaults to FUNCTION_RETURN_CHAR_LIMIT.
|
|
2781
2835
|
|
|
2782
2836
|
Returns:
|
|
2783
2837
|
tool (Tool): Updated tool
|
|
@@ -2788,6 +2842,7 @@ class LocalClient(AbstractClient):
|
|
|
2788
2842
|
"tags": tags,
|
|
2789
2843
|
"name": name,
|
|
2790
2844
|
"description": description,
|
|
2845
|
+
"return_char_limit": return_char_limit,
|
|
2791
2846
|
}
|
|
2792
2847
|
|
|
2793
2848
|
# Filter out any None values from the dictionary
|
|
@@ -2896,6 +2951,7 @@ class LocalClient(AbstractClient):
|
|
|
2896
2951
|
Returns:
|
|
2897
2952
|
source (Source): Created source
|
|
2898
2953
|
"""
|
|
2954
|
+
assert embedding_config or self._default_embedding_config, f"Must specify embedding_config for source"
|
|
2899
2955
|
source = Source(
|
|
2900
2956
|
name=name, embedding_config=embedding_config or self._default_embedding_config, organization_id=self.user.organization_id
|
|
2901
2957
|
)
|
{letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/main.py
RENAMED
|
@@ -191,7 +191,6 @@ def run_agent_loop(
|
|
|
191
191
|
print(f"\nDumping memory contents:\n")
|
|
192
192
|
print(f"{letta_agent.agent_state.memory.compile()}")
|
|
193
193
|
print(f"{letta_agent.archival_memory.compile()}")
|
|
194
|
-
print(f"{letta_agent.recall_memory.compile()}")
|
|
195
194
|
continue
|
|
196
195
|
|
|
197
196
|
elif user_input.lower() == "/model":
|
|
@@ -150,11 +150,8 @@ class OfflineMemoryAgent(Agent):
|
|
|
150
150
|
step_count = 0
|
|
151
151
|
|
|
152
152
|
while counter < self.max_memory_rethinks:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
for m in next_input_message:
|
|
156
|
-
m.id = m._generate_id()
|
|
157
|
-
|
|
153
|
+
if counter > 0:
|
|
154
|
+
next_input_message = []
|
|
158
155
|
kwargs["ms"] = ms
|
|
159
156
|
kwargs["first_message"] = False
|
|
160
157
|
step_response = self.inner_step(
|
{letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/orm/tool.py
RENAMED
|
@@ -30,6 +30,7 @@ class Tool(SqlalchemyBase, OrganizationMixin):
|
|
|
30
30
|
__table_args__ = (UniqueConstraint("name", "organization_id", name="uix_name_organization"),)
|
|
31
31
|
|
|
32
32
|
name: Mapped[str] = mapped_column(doc="The display name of the tool.")
|
|
33
|
+
return_char_limit: Mapped[int] = mapped_column(nullable=True, doc="The maximum number of characters the tool can return.")
|
|
33
34
|
description: Mapped[Optional[str]] = mapped_column(nullable=True, doc="The description of the tool.")
|
|
34
35
|
tags: Mapped[List] = mapped_column(JSON, doc="Metadata tags used to filter tools.")
|
|
35
36
|
source_type: Mapped[ToolSourceType] = mapped_column(String, doc="The type of the source code.", default=ToolSourceType.json)
|
|
@@ -45,19 +46,16 @@ class Tool(SqlalchemyBase, OrganizationMixin):
|
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
# Add event listener to update tool_name in ToolsAgents when Tool name changes
|
|
48
|
-
@event.listens_for(Tool,
|
|
49
|
+
@event.listens_for(Tool, "before_update")
|
|
49
50
|
def update_tool_name_in_tools_agents(mapper, connection, target):
|
|
50
51
|
"""Update tool_name in ToolsAgents when Tool name changes."""
|
|
51
52
|
state = target._sa_instance_state
|
|
52
|
-
history = state.get_history(
|
|
53
|
+
history = state.get_history("name", passive=True)
|
|
53
54
|
if not history.has_changes():
|
|
54
55
|
return
|
|
55
|
-
|
|
56
|
+
|
|
56
57
|
# Get the new name and update all associated ToolsAgents records
|
|
57
58
|
new_name = target.name
|
|
58
59
|
from letta.orm.tools_agents import ToolsAgents
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
ToolsAgents.tool_id == target.id
|
|
62
|
-
).values(tool_name=new_name)
|
|
63
|
-
)
|
|
60
|
+
|
|
61
|
+
connection.execute(ToolsAgents.__table__.update().where(ToolsAgents.tool_id == target.id).values(tool_name=new_name))
|
|
@@ -2,6 +2,7 @@ from typing import Dict, List, Optional
|
|
|
2
2
|
|
|
3
3
|
from pydantic import Field, model_validator
|
|
4
4
|
|
|
5
|
+
from letta.constants import FUNCTION_RETURN_CHAR_LIMIT
|
|
5
6
|
from letta.functions.functions import derive_openai_json_schema
|
|
6
7
|
from letta.functions.helpers import (
|
|
7
8
|
generate_composio_tool_wrapper,
|
|
@@ -41,6 +42,9 @@ class Tool(BaseTool):
|
|
|
41
42
|
source_code: str = Field(..., description="The source code of the function.")
|
|
42
43
|
json_schema: Optional[Dict] = Field(None, description="The JSON schema of the function.")
|
|
43
44
|
|
|
45
|
+
# tool configuration
|
|
46
|
+
return_char_limit: int = Field(FUNCTION_RETURN_CHAR_LIMIT, description="The maximum number of characters in the response.")
|
|
47
|
+
|
|
44
48
|
# metadata fields
|
|
45
49
|
created_by_id: Optional[str] = Field(None, description="The id of the user that made this Tool.")
|
|
46
50
|
last_updated_by_id: Optional[str] = Field(None, description="The id of the user that made this Tool.")
|
|
@@ -91,6 +95,7 @@ class ToolCreate(LettaBase):
|
|
|
91
95
|
json_schema: Optional[Dict] = Field(
|
|
92
96
|
None, description="The JSON schema of the function (auto-generated from source_code if not provided)"
|
|
93
97
|
)
|
|
98
|
+
return_char_limit: int = Field(FUNCTION_RETURN_CHAR_LIMIT, description="The maximum number of characters in the response.")
|
|
94
99
|
|
|
95
100
|
@classmethod
|
|
96
101
|
def from_composio(cls, action_name: str, api_key: Optional[str] = None) -> "ToolCreate":
|
|
@@ -152,6 +152,10 @@ def create_application() -> "FastAPI":
|
|
|
152
152
|
|
|
153
153
|
# Print the stack trace
|
|
154
154
|
print(f"Stack trace: {exc.__traceback__}")
|
|
155
|
+
if (os.getenv("SENTRY_DSN") is not None) and (os.getenv("SENTRY_DSN") != ""):
|
|
156
|
+
import sentry_sdk
|
|
157
|
+
|
|
158
|
+
sentry_sdk.capture_exception(exc)
|
|
155
159
|
|
|
156
160
|
return JSONResponse(
|
|
157
161
|
status_code=500,
|
|
@@ -3,7 +3,16 @@ import warnings
|
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from typing import List, Optional, Union
|
|
5
5
|
|
|
6
|
-
from fastapi import
|
|
6
|
+
from fastapi import (
|
|
7
|
+
APIRouter,
|
|
8
|
+
BackgroundTasks,
|
|
9
|
+
Body,
|
|
10
|
+
Depends,
|
|
11
|
+
Header,
|
|
12
|
+
HTTPException,
|
|
13
|
+
Query,
|
|
14
|
+
status,
|
|
15
|
+
)
|
|
7
16
|
from fastapi.responses import JSONResponse, StreamingResponse
|
|
8
17
|
|
|
9
18
|
from letta.constants import DEFAULT_MESSAGE_TOOL, DEFAULT_MESSAGE_TOOL_KWARG
|
|
@@ -14,6 +23,7 @@ from letta.schemas.block import ( # , BlockLabelUpdate, BlockLimitUpdate
|
|
|
14
23
|
CreateBlock,
|
|
15
24
|
)
|
|
16
25
|
from letta.schemas.enums import MessageStreamStatus
|
|
26
|
+
from letta.schemas.job import Job, JobStatus, JobUpdate
|
|
17
27
|
from letta.schemas.letta_message import (
|
|
18
28
|
LegacyLettaMessage,
|
|
19
29
|
LettaMessage,
|
|
@@ -32,6 +42,7 @@ from letta.schemas.message import Message, MessageCreate, MessageUpdate
|
|
|
32
42
|
from letta.schemas.passage import Passage
|
|
33
43
|
from letta.schemas.source import Source
|
|
34
44
|
from letta.schemas.tool import Tool
|
|
45
|
+
from letta.schemas.user import User
|
|
35
46
|
from letta.server.rest_api.interface import StreamingServerInterface
|
|
36
47
|
from letta.server.rest_api.utils import get_letta_server, sse_async_generator
|
|
37
48
|
from letta.server.server import SyncServer
|
|
@@ -502,6 +513,94 @@ async def send_message_streaming(
|
|
|
502
513
|
return result
|
|
503
514
|
|
|
504
515
|
|
|
516
|
+
async def process_message_background(
|
|
517
|
+
job_id: str,
|
|
518
|
+
server: SyncServer,
|
|
519
|
+
actor: User,
|
|
520
|
+
agent_id: str,
|
|
521
|
+
user_id: str,
|
|
522
|
+
messages: list,
|
|
523
|
+
assistant_message_tool_name: str,
|
|
524
|
+
assistant_message_tool_kwarg: str,
|
|
525
|
+
) -> None:
|
|
526
|
+
"""Background task to process the message and update job status."""
|
|
527
|
+
try:
|
|
528
|
+
# TODO(matt) we should probably make this stream_steps and log each step as it progresses, so the job update GET can see the total steps so far + partial usage?
|
|
529
|
+
result = await send_message_to_agent(
|
|
530
|
+
server=server,
|
|
531
|
+
agent_id=agent_id,
|
|
532
|
+
user_id=user_id,
|
|
533
|
+
messages=messages,
|
|
534
|
+
stream_steps=False, # NOTE(matt)
|
|
535
|
+
stream_tokens=False,
|
|
536
|
+
assistant_message_tool_name=assistant_message_tool_name,
|
|
537
|
+
assistant_message_tool_kwarg=assistant_message_tool_kwarg,
|
|
538
|
+
)
|
|
539
|
+
|
|
540
|
+
# Update job status to completed
|
|
541
|
+
job_update = JobUpdate(
|
|
542
|
+
status=JobStatus.completed,
|
|
543
|
+
completed_at=datetime.utcnow(),
|
|
544
|
+
metadata_={"result": result.model_dump()}, # Store the result in metadata
|
|
545
|
+
)
|
|
546
|
+
server.job_manager.update_job_by_id(job_id=job_id, job_update=job_update, actor=actor)
|
|
547
|
+
|
|
548
|
+
except Exception as e:
|
|
549
|
+
# Update job status to failed
|
|
550
|
+
job_update = JobUpdate(
|
|
551
|
+
status=JobStatus.failed,
|
|
552
|
+
completed_at=datetime.utcnow(),
|
|
553
|
+
metadata_={"error": str(e)},
|
|
554
|
+
)
|
|
555
|
+
server.job_manager.update_job_by_id(job_id=job_id, job_update=job_update, actor=actor)
|
|
556
|
+
raise
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
@router.post(
|
|
560
|
+
"/{agent_id}/messages/async",
|
|
561
|
+
response_model=Job,
|
|
562
|
+
operation_id="create_agent_message_async",
|
|
563
|
+
)
|
|
564
|
+
async def send_message_async(
|
|
565
|
+
agent_id: str,
|
|
566
|
+
background_tasks: BackgroundTasks,
|
|
567
|
+
server: SyncServer = Depends(get_letta_server),
|
|
568
|
+
request: LettaRequest = Body(...),
|
|
569
|
+
user_id: Optional[str] = Header(None, alias="user_id"),
|
|
570
|
+
):
|
|
571
|
+
"""
|
|
572
|
+
Asynchronously process a user message and return a job ID.
|
|
573
|
+
The actual processing happens in the background, and the status can be checked using the job ID.
|
|
574
|
+
"""
|
|
575
|
+
actor = server.get_user_or_default(user_id=user_id)
|
|
576
|
+
|
|
577
|
+
# Create a new job
|
|
578
|
+
job = Job(
|
|
579
|
+
user_id=actor.id,
|
|
580
|
+
status=JobStatus.created,
|
|
581
|
+
metadata_={
|
|
582
|
+
"job_type": "send_message_async",
|
|
583
|
+
"agent_id": agent_id,
|
|
584
|
+
},
|
|
585
|
+
)
|
|
586
|
+
job = server.job_manager.create_job(pydantic_job=job, actor=actor)
|
|
587
|
+
|
|
588
|
+
# Add the background task
|
|
589
|
+
background_tasks.add_task(
|
|
590
|
+
process_message_background,
|
|
591
|
+
job_id=job.id,
|
|
592
|
+
server=server,
|
|
593
|
+
actor=actor,
|
|
594
|
+
agent_id=agent_id,
|
|
595
|
+
user_id=actor.id,
|
|
596
|
+
messages=request.messages,
|
|
597
|
+
assistant_message_tool_name=request.assistant_message_tool_name,
|
|
598
|
+
assistant_message_tool_kwarg=request.assistant_message_tool_kwarg,
|
|
599
|
+
)
|
|
600
|
+
|
|
601
|
+
return job
|
|
602
|
+
|
|
603
|
+
|
|
505
604
|
# TODO: move this into server.py?
|
|
506
605
|
async def send_message_to_agent(
|
|
507
606
|
server: SyncServer,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -e # Exit on any error
|
|
3
|
+
|
|
4
|
+
HOST="${HOST:-0.0.0.0}"
|
|
5
|
+
PORT="${PORT:-8283}"
|
|
6
|
+
|
|
7
|
+
# Function to wait for PostgreSQL to be ready
|
|
8
|
+
wait_for_postgres() {
|
|
9
|
+
until pg_isready -U "${POSTGRES_USER:-letta}" -h localhost; do
|
|
10
|
+
echo "Waiting for PostgreSQL to be ready..."
|
|
11
|
+
sleep 2
|
|
12
|
+
done
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# Check if we're configured for external Postgres
|
|
16
|
+
if [ -n "$LETTA_PG_URI" ]; then
|
|
17
|
+
echo "External Postgres configuration detected, using $LETTA_PG_URI"
|
|
18
|
+
else
|
|
19
|
+
echo "No external Postgres configuration detected, starting internal PostgreSQL..."
|
|
20
|
+
# Start PostgreSQL using the base image's entrypoint script
|
|
21
|
+
/usr/local/bin/docker-entrypoint.sh postgres &
|
|
22
|
+
|
|
23
|
+
# Wait for PostgreSQL to be ready
|
|
24
|
+
wait_for_postgres
|
|
25
|
+
|
|
26
|
+
# Set default connection URI for internal postgres
|
|
27
|
+
export LETTA_PG_URI="postgresql://${POSTGRES_USER:-letta}:${POSTGRES_PASSWORD:-letta}@localhost:5432/${POSTGRES_DB:-letta}"
|
|
28
|
+
echo "Using internal PostgreSQL at: $LETTA_PG_URI"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Attempt database migration
|
|
32
|
+
echo "Attempting to migrate database..."
|
|
33
|
+
if ! alembic upgrade head; then
|
|
34
|
+
echo "ERROR: Database migration failed!"
|
|
35
|
+
echo "Please check your database connection and try again."
|
|
36
|
+
echo "If the problem persists, check the logs for more details."
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
echo "Database migration completed successfully."
|
|
40
|
+
|
|
41
|
+
# If ADE is enabled, add the --ade flag to the command
|
|
42
|
+
CMD="letta server --host $HOST --port $PORT"
|
|
43
|
+
if [ "${SECURE:-false}" = "true" ]; then
|
|
44
|
+
CMD="$CMD --secure"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
echo "Starting Letta server at http://$HOST:$PORT..."
|
|
48
|
+
echo "Executing: $CMD"
|
|
49
|
+
exec $CMD
|
{letta_nightly-0.6.1.dev20241209104258 → letta_nightly-0.6.2.dev20241210030252}/letta/utils.py
RENAMED
|
@@ -28,7 +28,6 @@ from letta.constants import (
|
|
|
28
28
|
CLI_WARNING_PREFIX,
|
|
29
29
|
CORE_MEMORY_HUMAN_CHAR_LIMIT,
|
|
30
30
|
CORE_MEMORY_PERSONA_CHAR_LIMIT,
|
|
31
|
-
FUNCTION_RETURN_CHAR_LIMIT,
|
|
32
31
|
LETTA_DIR,
|
|
33
32
|
MAX_FILENAME_LENGTH,
|
|
34
33
|
TOOL_CALL_ID_MAX_LEN,
|
|
@@ -906,8 +905,8 @@ def parse_json(string) -> dict:
|
|
|
906
905
|
raise e
|
|
907
906
|
|
|
908
907
|
|
|
909
|
-
def validate_function_response(function_response_string: any, strict: bool = False, truncate: bool = True) -> str:
|
|
910
|
-
"""Check to make sure that a function used by Letta returned a valid response
|
|
908
|
+
def validate_function_response(function_response_string: any, return_char_limit: int, strict: bool = False, truncate: bool = True) -> str:
|
|
909
|
+
"""Check to make sure that a function used by Letta returned a valid response. Truncates to return_char_limit if necessary.
|
|
911
910
|
|
|
912
911
|
Responses need to be strings (or None) that fall under a certain text count limit.
|
|
913
912
|
"""
|
|
@@ -943,11 +942,11 @@ def validate_function_response(function_response_string: any, strict: bool = Fal
|
|
|
943
942
|
|
|
944
943
|
# Now check the length and make sure it doesn't go over the limit
|
|
945
944
|
# TODO we should change this to a max token limit that's variable based on tokens remaining (or context-window)
|
|
946
|
-
if truncate and len(function_response_string) >
|
|
945
|
+
if truncate and len(function_response_string) > return_char_limit:
|
|
947
946
|
print(
|
|
948
|
-
f"{CLI_WARNING_PREFIX}function return was over limit ({len(function_response_string)} > {
|
|
947
|
+
f"{CLI_WARNING_PREFIX}function return was over limit ({len(function_response_string)} > {return_char_limit}) and was truncated"
|
|
949
948
|
)
|
|
950
|
-
function_response_string = f"{function_response_string[:
|
|
949
|
+
function_response_string = f"{function_response_string[:return_char_limit]}... [NOTE: function output was truncated since it exceeded the character limit ({len(function_response_string)} > {return_char_limit})]"
|
|
951
950
|
|
|
952
951
|
return function_response_string
|
|
953
952
|
|