letta-nightly 0.5.0.dev20241016104103__tar.gz → 0.5.0.dev20241018104142__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of letta-nightly might be problematic. Click here for more details.
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/PKG-INFO +1 -1
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/agent.py +3 -12
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/cli/cli.py +0 -2
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/constants.py +1 -1
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/functions/helpers.py +3 -3
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/anthropic.py +1 -1
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/helpers.py +0 -15
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/llm_api_tools.py +35 -47
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/openai.py +2 -3
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +1 -1
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +1 -1
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/main.py +0 -4
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/metadata.py +5 -1
- letta_nightly-0.5.0.dev20241018104142/letta/o1_agent.py +87 -0
- letta_nightly-0.5.0.dev20241018104142/letta/personas/examples/o1_persona.txt +5 -0
- letta_nightly-0.5.0.dev20241018104142/letta/prompts/system/memgpt_modified_o1.txt +31 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/agent.py +30 -2
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/llm_config.py +24 -1
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/tool.py +34 -2
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/server.py +49 -33
- letta_nightly-0.5.0.dev20241016104103/letta/server/static_files/assets/index-dc228d4a.js → letta_nightly-0.5.0.dev20241018104142/letta/server/static_files/assets/index-d6b3669a.js +59 -59
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/static_files/index.html +1 -1
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/settings.py +3 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/pyproject.toml +1 -1
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/LICENSE +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/README.md +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/__main__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/agent_store/chroma.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/agent_store/db.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/agent_store/lancedb.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/agent_store/milvus.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/agent_store/qdrant.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/agent_store/storage.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/base.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/benchmark/benchmark.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/benchmark/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/cli/cli_config.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/cli/cli_load.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/client/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/client/admin.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/client/client.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/client/streaming.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/client/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/config.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/credentials.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/data_sources/connectors.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/data_sources/connectors_helper.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/embeddings.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/errors.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/functions/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/functions/function_sets/base.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/functions/function_sets/extras.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/functions/functions.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/functions/schema_generator.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/humans/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/humans/examples/basic.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/humans/examples/cs_phd.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/interface.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/azure_openai.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/azure_openai_constants.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/cohere.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/google_ai.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/llm_api/mistral.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/README.md +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/chat_completion_proxy.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/function_parser.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/grammars/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/grammars/json.gbnf +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/json_parser.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/koboldcpp/api.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/koboldcpp/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llamacpp/api.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llamacpp/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/lmstudio/api.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/lmstudio/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/ollama/api.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/ollama/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/settings/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/settings/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/settings/simple.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/vllm/api.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/webui/api.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/webui/legacy_api.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/webui/legacy_settings.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/local_llm/webui/settings.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/log.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/memory.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/openai_backcompat/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/openai_backcompat/openai_object.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/persistence_manager.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/examples/anna_pa.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/examples/google_search_persona.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/examples/memgpt_doc.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/examples/memgpt_starter.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/examples/sam.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/examples/sam_pov.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/personas/examples/sqldb/test.db +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/gpt_summarize.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/gpt_system.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/system/memgpt_base.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/system/memgpt_chat.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/system/memgpt_doc.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/providers.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/pytest.ini +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/api_key.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/block.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/embedding_config.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/enums.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/file.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/health.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/job.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/letta_base.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/letta_message.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/letta_request.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/letta_response.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/memory.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/message.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/openai/chat_completion_request.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/openai/chat_completion_response.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/openai/chat_completions.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/openai/embedding_response.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/openai/openai.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/organization.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/passage.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/source.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/usage.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/schemas/user.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/constants.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/admin/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/admin/agents.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/admin/tools.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/admin/users.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/app.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/auth/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/auth/index.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/auth_token.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/interface.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/openai/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/agents.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/blocks.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/health.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/jobs.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/llms.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/organizations.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/sources.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/tools.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/routers/v1/users.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/static_files.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/rest_api/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/startup.sh +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/static_files/favicon.ico +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/utils.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/ws_api/__init__.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/ws_api/example_client.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/ws_api/interface.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/ws_api/protocol.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/server/ws_api/server.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/streaming_interface.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/system.py +0 -0
- {letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/utils.py +0 -0
{letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/agent.py
RENAMED
|
@@ -30,7 +30,7 @@ from letta.persistence_manager import LocalStateManager
|
|
|
30
30
|
from letta.schemas.agent import AgentState, AgentStepResponse
|
|
31
31
|
from letta.schemas.block import Block
|
|
32
32
|
from letta.schemas.embedding_config import EmbeddingConfig
|
|
33
|
-
from letta.schemas.enums import MessageRole
|
|
33
|
+
from letta.schemas.enums import MessageRole
|
|
34
34
|
from letta.schemas.memory import ContextWindowOverview, Memory
|
|
35
35
|
from letta.schemas.message import Message, UpdateMessage
|
|
36
36
|
from letta.schemas.openai.chat_completion_response import ChatCompletionResponse
|
|
@@ -463,15 +463,14 @@ class Agent(BaseAgent):
|
|
|
463
463
|
function_call: str = "auto",
|
|
464
464
|
first_message: bool = False, # hint
|
|
465
465
|
stream: bool = False, # TODO move to config?
|
|
466
|
-
inner_thoughts_in_kwargs_option: OptionState = OptionState.DEFAULT,
|
|
467
466
|
) -> ChatCompletionResponse:
|
|
468
467
|
"""Get response from LLM API"""
|
|
469
468
|
try:
|
|
470
469
|
response = create(
|
|
471
470
|
# agent_state=self.agent_state,
|
|
472
471
|
llm_config=self.agent_state.llm_config,
|
|
473
|
-
user_id=self.agent_state.user_id,
|
|
474
472
|
messages=message_sequence,
|
|
473
|
+
user_id=self.agent_state.user_id,
|
|
475
474
|
functions=self.functions,
|
|
476
475
|
functions_python=self.functions_python,
|
|
477
476
|
function_call=function_call,
|
|
@@ -480,8 +479,6 @@ class Agent(BaseAgent):
|
|
|
480
479
|
# streaming
|
|
481
480
|
stream=stream,
|
|
482
481
|
stream_interface=self.interface,
|
|
483
|
-
# putting inner thoughts in func args or not
|
|
484
|
-
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs_option,
|
|
485
482
|
)
|
|
486
483
|
|
|
487
484
|
if len(response.choices) == 0 or response.choices[0] is None:
|
|
@@ -822,7 +819,6 @@ class Agent(BaseAgent):
|
|
|
822
819
|
first_message_retry_limit: int = FIRST_MESSAGE_ATTEMPTS,
|
|
823
820
|
skip_verify: bool = False,
|
|
824
821
|
stream: bool = False, # TODO move to config?
|
|
825
|
-
inner_thoughts_in_kwargs_option: OptionState = OptionState.DEFAULT,
|
|
826
822
|
ms: Optional[MetadataStore] = None,
|
|
827
823
|
) -> AgentStepResponse:
|
|
828
824
|
"""Runs a single step in the agent loop (generates at most one LLM call)"""
|
|
@@ -861,10 +857,7 @@ class Agent(BaseAgent):
|
|
|
861
857
|
counter = 0
|
|
862
858
|
while True:
|
|
863
859
|
response = self._get_ai_reply(
|
|
864
|
-
message_sequence=input_message_sequence,
|
|
865
|
-
first_message=True, # passed through to the prompt formatter
|
|
866
|
-
stream=stream,
|
|
867
|
-
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs_option,
|
|
860
|
+
message_sequence=input_message_sequence, first_message=True, stream=stream # passed through to the prompt formatter
|
|
868
861
|
)
|
|
869
862
|
if verify_first_message_correctness(response, require_monologue=self.first_message_verify_mono):
|
|
870
863
|
break
|
|
@@ -877,7 +870,6 @@ class Agent(BaseAgent):
|
|
|
877
870
|
response = self._get_ai_reply(
|
|
878
871
|
message_sequence=input_message_sequence,
|
|
879
872
|
stream=stream,
|
|
880
|
-
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs_option,
|
|
881
873
|
)
|
|
882
874
|
|
|
883
875
|
# Step 3: check if LLM wanted to call a function
|
|
@@ -954,7 +946,6 @@ class Agent(BaseAgent):
|
|
|
954
946
|
first_message_retry_limit=first_message_retry_limit,
|
|
955
947
|
skip_verify=skip_verify,
|
|
956
948
|
stream=stream,
|
|
957
|
-
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs_option,
|
|
958
949
|
ms=ms,
|
|
959
950
|
)
|
|
960
951
|
|
{letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/cli/cli.py
RENAMED
|
@@ -49,7 +49,6 @@ def server(
|
|
|
49
49
|
ade: Annotated[bool, typer.Option(help="Allows remote access")] = False,
|
|
50
50
|
):
|
|
51
51
|
"""Launch a Letta server process"""
|
|
52
|
-
|
|
53
52
|
if type == ServerChoice.rest_api:
|
|
54
53
|
pass
|
|
55
54
|
|
|
@@ -321,7 +320,6 @@ def run(
|
|
|
321
320
|
ms=ms,
|
|
322
321
|
no_verify=no_verify,
|
|
323
322
|
stream=stream,
|
|
324
|
-
inner_thoughts_in_kwargs=no_content,
|
|
325
323
|
) # TODO: add back no_verify
|
|
326
324
|
|
|
327
325
|
|
{letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/constants.py
RENAMED
|
@@ -139,7 +139,7 @@ CORE_MEMORY_PERSONA_CHAR_LIMIT = 2000
|
|
|
139
139
|
CORE_MEMORY_HUMAN_CHAR_LIMIT = 2000
|
|
140
140
|
|
|
141
141
|
# Function return limits
|
|
142
|
-
FUNCTION_RETURN_CHAR_LIMIT =
|
|
142
|
+
FUNCTION_RETURN_CHAR_LIMIT = 6000 # ~300 words
|
|
143
143
|
|
|
144
144
|
MAX_PAUSE_HEARTBEATS = 360 # in min
|
|
145
145
|
|
|
@@ -5,10 +5,10 @@ from pydantic import BaseModel
|
|
|
5
5
|
|
|
6
6
|
def generate_composio_tool_wrapper(action: "ActionType") -> tuple[str, str]:
|
|
7
7
|
# Instantiate the object
|
|
8
|
-
tool_instantiation_str = f"composio_toolset.get_tools(actions=[Action.{action
|
|
8
|
+
tool_instantiation_str = f"composio_toolset.get_tools(actions=[Action.{str(action)}])[0]"
|
|
9
9
|
|
|
10
10
|
# Generate func name
|
|
11
|
-
func_name = f"run_{action.name}"
|
|
11
|
+
func_name = f"run_{action.name.lower()}"
|
|
12
12
|
|
|
13
13
|
wrapper_function_str = f"""
|
|
14
14
|
def {func_name}(**kwargs):
|
|
@@ -19,7 +19,7 @@ def {func_name}(**kwargs):
|
|
|
19
19
|
|
|
20
20
|
composio_toolset = ComposioToolSet()
|
|
21
21
|
tool = {tool_instantiation_str}
|
|
22
|
-
tool.func(**kwargs)
|
|
22
|
+
return tool.func(**kwargs)['data']
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
25
|
# Compile safety check
|
|
@@ -53,7 +53,7 @@ def anthropic_get_model_list(url: str, api_key: Union[str, None]) -> dict:
|
|
|
53
53
|
return MODEL_LIST
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
def convert_tools_to_anthropic_format(tools: List[Tool]
|
|
56
|
+
def convert_tools_to_anthropic_format(tools: List[Tool]) -> List[dict]:
|
|
57
57
|
"""See: https://docs.anthropic.com/claude/docs/tool-use
|
|
58
58
|
|
|
59
59
|
OpenAI style:
|
|
@@ -6,7 +6,6 @@ from typing import Any, List, Union
|
|
|
6
6
|
import requests
|
|
7
7
|
|
|
8
8
|
from letta.constants import OPENAI_CONTEXT_WINDOW_ERROR_SUBSTRING
|
|
9
|
-
from letta.schemas.enums import OptionState
|
|
10
9
|
from letta.schemas.openai.chat_completion_response import ChatCompletionResponse, Choice
|
|
11
10
|
from letta.utils import json_dumps, printd
|
|
12
11
|
|
|
@@ -200,17 +199,3 @@ def is_context_overflow_error(exception: Union[requests.exceptions.RequestExcept
|
|
|
200
199
|
# Generic fail
|
|
201
200
|
else:
|
|
202
201
|
return False
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
def derive_inner_thoughts_in_kwargs(inner_thoughts_in_kwargs_option: OptionState, model: str):
|
|
206
|
-
if inner_thoughts_in_kwargs_option == OptionState.DEFAULT:
|
|
207
|
-
# model that are known to not use `content` fields on tool calls
|
|
208
|
-
inner_thoughts_in_kwargs = "gpt-4o" in model or "gpt-4-turbo" in model or "gpt-3.5-turbo" in model
|
|
209
|
-
else:
|
|
210
|
-
inner_thoughts_in_kwargs = True if inner_thoughts_in_kwargs_option == OptionState.YES else False
|
|
211
|
-
|
|
212
|
-
if not isinstance(inner_thoughts_in_kwargs, bool):
|
|
213
|
-
warnings.warn(f"Bad type detected: {type(inner_thoughts_in_kwargs)}")
|
|
214
|
-
inner_thoughts_in_kwargs = bool(inner_thoughts_in_kwargs)
|
|
215
|
-
|
|
216
|
-
return inner_thoughts_in_kwargs
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import os
|
|
2
1
|
import random
|
|
3
2
|
import time
|
|
4
3
|
from typing import List, Optional, Union
|
|
@@ -8,14 +7,12 @@ import requests
|
|
|
8
7
|
from letta.constants import CLI_WARNING_PREFIX
|
|
9
8
|
from letta.llm_api.anthropic import anthropic_chat_completions_request
|
|
10
9
|
from letta.llm_api.azure_openai import azure_openai_chat_completions_request
|
|
11
|
-
from letta.llm_api.cohere import cohere_chat_completions_request
|
|
12
10
|
from letta.llm_api.google_ai import (
|
|
13
11
|
convert_tools_to_google_ai_format,
|
|
14
12
|
google_ai_chat_completions_request,
|
|
15
13
|
)
|
|
16
14
|
from letta.llm_api.helpers import (
|
|
17
15
|
add_inner_thoughts_to_functions,
|
|
18
|
-
derive_inner_thoughts_in_kwargs,
|
|
19
16
|
unpack_all_inner_thoughts_from_kwargs,
|
|
20
17
|
)
|
|
21
18
|
from letta.llm_api.openai import (
|
|
@@ -28,7 +25,6 @@ from letta.local_llm.constants import (
|
|
|
28
25
|
INNER_THOUGHTS_KWARG,
|
|
29
26
|
INNER_THOUGHTS_KWARG_DESCRIPTION,
|
|
30
27
|
)
|
|
31
|
-
from letta.schemas.enums import OptionState
|
|
32
28
|
from letta.schemas.llm_config import LLMConfig
|
|
33
29
|
from letta.schemas.message import Message
|
|
34
30
|
from letta.schemas.openai.chat_completion_request import (
|
|
@@ -120,9 +116,6 @@ def create(
|
|
|
120
116
|
# streaming?
|
|
121
117
|
stream: bool = False,
|
|
122
118
|
stream_interface: Optional[Union[AgentRefreshStreamingInterface, AgentChunkStreamingInterface]] = None,
|
|
123
|
-
# TODO move to llm_config?
|
|
124
|
-
# if unspecified (None), default to something we've tested
|
|
125
|
-
inner_thoughts_in_kwargs_option: OptionState = OptionState.DEFAULT,
|
|
126
119
|
max_tokens: Optional[int] = None,
|
|
127
120
|
model_settings: Optional[dict] = None, # TODO: eventually pass from server
|
|
128
121
|
) -> ChatCompletionResponse:
|
|
@@ -146,10 +139,7 @@ def create(
|
|
|
146
139
|
# only is a problem if we are *not* using an openai proxy
|
|
147
140
|
raise ValueError(f"OpenAI key is missing from letta config file")
|
|
148
141
|
|
|
149
|
-
|
|
150
|
-
data = build_openai_chat_completions_request(
|
|
151
|
-
llm_config, messages, user_id, functions, function_call, use_tool_naming, inner_thoughts_in_kwargs, max_tokens
|
|
152
|
-
)
|
|
142
|
+
data = build_openai_chat_completions_request(llm_config, messages, user_id, functions, function_call, use_tool_naming, max_tokens)
|
|
153
143
|
|
|
154
144
|
if stream: # Client requested token streaming
|
|
155
145
|
data.stream = True
|
|
@@ -176,7 +166,7 @@ def create(
|
|
|
176
166
|
if isinstance(stream_interface, AgentChunkStreamingInterface):
|
|
177
167
|
stream_interface.stream_end()
|
|
178
168
|
|
|
179
|
-
if
|
|
169
|
+
if llm_config.put_inner_thoughts_in_kwargs:
|
|
180
170
|
response = unpack_all_inner_thoughts_from_kwargs(response=response, inner_thoughts_key=INNER_THOUGHTS_KWARG)
|
|
181
171
|
|
|
182
172
|
return response
|
|
@@ -198,9 +188,8 @@ def create(
|
|
|
198
188
|
# Set the llm config model_endpoint from model_settings
|
|
199
189
|
# For Azure, this model_endpoint is required to be configured via env variable, so users don't need to provide it in the LLM config
|
|
200
190
|
llm_config.model_endpoint = model_settings.azure_base_url
|
|
201
|
-
inner_thoughts_in_kwargs = derive_inner_thoughts_in_kwargs(inner_thoughts_in_kwargs_option, llm_config.model)
|
|
202
191
|
chat_completion_request = build_openai_chat_completions_request(
|
|
203
|
-
llm_config, messages, user_id, functions, function_call, use_tool_naming,
|
|
192
|
+
llm_config, messages, user_id, functions, function_call, use_tool_naming, max_tokens
|
|
204
193
|
)
|
|
205
194
|
|
|
206
195
|
response = azure_openai_chat_completions_request(
|
|
@@ -210,7 +199,7 @@ def create(
|
|
|
210
199
|
chat_completion_request=chat_completion_request,
|
|
211
200
|
)
|
|
212
201
|
|
|
213
|
-
if
|
|
202
|
+
if llm_config.put_inner_thoughts_in_kwargs:
|
|
214
203
|
response = unpack_all_inner_thoughts_from_kwargs(response=response, inner_thoughts_key=INNER_THOUGHTS_KWARG)
|
|
215
204
|
|
|
216
205
|
return response
|
|
@@ -224,7 +213,7 @@ def create(
|
|
|
224
213
|
if functions is not None:
|
|
225
214
|
tools = [{"type": "function", "function": f} for f in functions]
|
|
226
215
|
tools = [Tool(**t) for t in tools]
|
|
227
|
-
tools = convert_tools_to_google_ai_format(tools, inner_thoughts_in_kwargs=
|
|
216
|
+
tools = convert_tools_to_google_ai_format(tools, inner_thoughts_in_kwargs=llm_config.put_inner_thoughts_in_kwargs)
|
|
228
217
|
else:
|
|
229
218
|
tools = None
|
|
230
219
|
|
|
@@ -237,7 +226,7 @@ def create(
|
|
|
237
226
|
contents=[m.to_google_ai_dict() for m in messages],
|
|
238
227
|
tools=tools,
|
|
239
228
|
),
|
|
240
|
-
inner_thoughts_in_kwargs=
|
|
229
|
+
inner_thoughts_in_kwargs=llm_config.put_inner_thoughts_in_kwargs,
|
|
241
230
|
)
|
|
242
231
|
|
|
243
232
|
elif llm_config.model_endpoint_type == "anthropic":
|
|
@@ -260,32 +249,32 @@ def create(
|
|
|
260
249
|
),
|
|
261
250
|
)
|
|
262
251
|
|
|
263
|
-
elif llm_config.model_endpoint_type == "cohere":
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
252
|
+
# elif llm_config.model_endpoint_type == "cohere":
|
|
253
|
+
# if stream:
|
|
254
|
+
# raise NotImplementedError(f"Streaming not yet implemented for {llm_config.model_endpoint_type}")
|
|
255
|
+
# if not use_tool_naming:
|
|
256
|
+
# raise NotImplementedError("Only tool calling supported on Cohere API requests")
|
|
257
|
+
#
|
|
258
|
+
# if functions is not None:
|
|
259
|
+
# tools = [{"type": "function", "function": f} for f in functions]
|
|
260
|
+
# tools = [Tool(**t) for t in tools]
|
|
261
|
+
# else:
|
|
262
|
+
# tools = None
|
|
263
|
+
#
|
|
264
|
+
# return cohere_chat_completions_request(
|
|
265
|
+
# # url=llm_config.model_endpoint,
|
|
266
|
+
# url="https://api.cohere.ai/v1", # TODO
|
|
267
|
+
# api_key=os.getenv("COHERE_API_KEY"), # TODO remove
|
|
268
|
+
# chat_completion_request=ChatCompletionRequest(
|
|
269
|
+
# model="command-r-plus", # TODO
|
|
270
|
+
# messages=[cast_message_to_subtype(m.to_openai_dict()) for m in messages],
|
|
271
|
+
# tools=tools,
|
|
272
|
+
# tool_choice=function_call,
|
|
273
|
+
# # user=str(user_id),
|
|
274
|
+
# # NOTE: max_tokens is required for Anthropic API
|
|
275
|
+
# # max_tokens=1024, # TODO make dynamic
|
|
276
|
+
# ),
|
|
277
|
+
# )
|
|
289
278
|
|
|
290
279
|
elif llm_config.model_endpoint_type == "groq":
|
|
291
280
|
if stream:
|
|
@@ -295,8 +284,7 @@ def create(
|
|
|
295
284
|
raise ValueError(f"Groq key is missing from letta config file")
|
|
296
285
|
|
|
297
286
|
# force to true for groq, since they don't support 'content' is non-null
|
|
298
|
-
|
|
299
|
-
if inner_thoughts_in_kwargs:
|
|
287
|
+
if llm_config.put_inner_thoughts_in_kwargs:
|
|
300
288
|
functions = add_inner_thoughts_to_functions(
|
|
301
289
|
functions=functions,
|
|
302
290
|
inner_thoughts_key=INNER_THOUGHTS_KWARG,
|
|
@@ -306,7 +294,7 @@ def create(
|
|
|
306
294
|
tools = [{"type": "function", "function": f} for f in functions] if functions is not None else None
|
|
307
295
|
data = ChatCompletionRequest(
|
|
308
296
|
model=llm_config.model,
|
|
309
|
-
messages=[m.to_openai_dict(put_inner_thoughts_in_kwargs=
|
|
297
|
+
messages=[m.to_openai_dict(put_inner_thoughts_in_kwargs=llm_config.put_inner_thoughts_in_kwargs) for m in messages],
|
|
310
298
|
tools=tools,
|
|
311
299
|
tool_choice=function_call,
|
|
312
300
|
user=str(user_id),
|
|
@@ -335,7 +323,7 @@ def create(
|
|
|
335
323
|
if isinstance(stream_interface, AgentChunkStreamingInterface):
|
|
336
324
|
stream_interface.stream_end()
|
|
337
325
|
|
|
338
|
-
if
|
|
326
|
+
if llm_config.put_inner_thoughts_in_kwargs:
|
|
339
327
|
response = unpack_all_inner_thoughts_from_kwargs(response=response, inner_thoughts_key=INNER_THOUGHTS_KWARG)
|
|
340
328
|
|
|
341
329
|
return response
|
|
@@ -105,10 +105,9 @@ def build_openai_chat_completions_request(
|
|
|
105
105
|
functions: Optional[list],
|
|
106
106
|
function_call: str,
|
|
107
107
|
use_tool_naming: bool,
|
|
108
|
-
inner_thoughts_in_kwargs: bool,
|
|
109
108
|
max_tokens: Optional[int],
|
|
110
109
|
) -> ChatCompletionRequest:
|
|
111
|
-
if
|
|
110
|
+
if llm_config.put_inner_thoughts_in_kwargs:
|
|
112
111
|
functions = add_inner_thoughts_to_functions(
|
|
113
112
|
functions=functions,
|
|
114
113
|
inner_thoughts_key=INNER_THOUGHTS_KWARG,
|
|
@@ -116,7 +115,7 @@ def build_openai_chat_completions_request(
|
|
|
116
115
|
)
|
|
117
116
|
|
|
118
117
|
openai_message_list = [
|
|
119
|
-
cast_message_to_subtype(m.to_openai_dict(put_inner_thoughts_in_kwargs=
|
|
118
|
+
cast_message_to_subtype(m.to_openai_dict(put_inner_thoughts_in_kwargs=llm_config.put_inner_thoughts_in_kwargs)) for m in messages
|
|
120
119
|
]
|
|
121
120
|
if llm_config.model:
|
|
122
121
|
model = llm_config.model
|
|
@@ -188,7 +188,7 @@ class ChatMLInnerMonologueWrapper(LLMChatCompletionWrapper):
|
|
|
188
188
|
try:
|
|
189
189
|
# indent the function replies
|
|
190
190
|
function_return_dict = json_loads(message["content"])
|
|
191
|
-
function_return_str = json_dumps(function_return_dict, indent=
|
|
191
|
+
function_return_str = json_dumps(function_return_dict, indent=0)
|
|
192
192
|
except:
|
|
193
193
|
function_return_str = message["content"]
|
|
194
194
|
|
|
@@ -183,7 +183,7 @@ class ConfigurableJSONWrapper(LLMChatCompletionWrapper):
|
|
|
183
183
|
try:
|
|
184
184
|
# indent the function replies
|
|
185
185
|
function_return_dict = json_loads(message["content"])
|
|
186
|
-
function_return_str = json_dumps(function_return_dict, indent=
|
|
186
|
+
function_return_str = json_dumps(function_return_dict, indent=0)
|
|
187
187
|
except:
|
|
188
188
|
function_return_str = message["content"]
|
|
189
189
|
|
{letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/main.py
RENAMED
|
@@ -20,7 +20,6 @@ from letta.cli.cli_load import app as load_app
|
|
|
20
20
|
from letta.config import LettaConfig
|
|
21
21
|
from letta.constants import FUNC_FAILED_HEARTBEAT_MESSAGE, REQ_HEARTBEAT_MESSAGE
|
|
22
22
|
from letta.metadata import MetadataStore
|
|
23
|
-
from letta.schemas.enums import OptionState
|
|
24
23
|
|
|
25
24
|
# from letta.interface import CLIInterface as interface # for printing to terminal
|
|
26
25
|
from letta.streaming_interface import AgentRefreshStreamingInterface
|
|
@@ -64,7 +63,6 @@ def run_agent_loop(
|
|
|
64
63
|
no_verify: bool = False,
|
|
65
64
|
strip_ui: bool = False,
|
|
66
65
|
stream: bool = False,
|
|
67
|
-
inner_thoughts_in_kwargs: OptionState = OptionState.DEFAULT,
|
|
68
66
|
):
|
|
69
67
|
if isinstance(letta_agent.interface, AgentRefreshStreamingInterface):
|
|
70
68
|
# letta_agent.interface.toggle_streaming(on=stream)
|
|
@@ -369,7 +367,6 @@ def run_agent_loop(
|
|
|
369
367
|
first_message=False,
|
|
370
368
|
skip_verify=no_verify,
|
|
371
369
|
stream=stream,
|
|
372
|
-
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs,
|
|
373
370
|
ms=ms,
|
|
374
371
|
)
|
|
375
372
|
else:
|
|
@@ -378,7 +375,6 @@ def run_agent_loop(
|
|
|
378
375
|
first_message=False,
|
|
379
376
|
skip_verify=no_verify,
|
|
380
377
|
stream=stream,
|
|
381
|
-
inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs,
|
|
382
378
|
ms=ms,
|
|
383
379
|
)
|
|
384
380
|
new_messages = step_response.messages
|
{letta_nightly-0.5.0.dev20241016104103 → letta_nightly-0.5.0.dev20241018104142}/letta/metadata.py
RENAMED
|
@@ -270,7 +270,7 @@ class AgentModel(Base):
|
|
|
270
270
|
return f"<Agent(id='{self.id}', name='{self.name}')>"
|
|
271
271
|
|
|
272
272
|
def to_record(self) -> AgentState:
|
|
273
|
-
|
|
273
|
+
agent_state = AgentState(
|
|
274
274
|
id=self.id,
|
|
275
275
|
user_id=self.user_id,
|
|
276
276
|
name=self.name,
|
|
@@ -285,6 +285,8 @@ class AgentModel(Base):
|
|
|
285
285
|
embedding_config=self.embedding_config,
|
|
286
286
|
metadata_=self.metadata_,
|
|
287
287
|
)
|
|
288
|
+
assert isinstance(agent_state.memory, Memory), f"Memory object is not of type Memory: {type(agent_state.memory)}"
|
|
289
|
+
return agent_state
|
|
288
290
|
|
|
289
291
|
|
|
290
292
|
class SourceModel(Base):
|
|
@@ -527,6 +529,7 @@ class MetadataStore:
|
|
|
527
529
|
raise ValueError(f"Agent with name {agent.name} already exists")
|
|
528
530
|
fields = vars(agent)
|
|
529
531
|
fields["memory"] = agent.memory.to_dict()
|
|
532
|
+
del fields["_internal_memory"]
|
|
530
533
|
session.add(AgentModel(**fields))
|
|
531
534
|
session.commit()
|
|
532
535
|
|
|
@@ -588,6 +591,7 @@ class MetadataStore:
|
|
|
588
591
|
fields = vars(agent)
|
|
589
592
|
if isinstance(agent.memory, Memory): # TODO: this is nasty but this whole class will soon be removed so whatever
|
|
590
593
|
fields["memory"] = agent.memory.to_dict()
|
|
594
|
+
del fields["_internal_memory"]
|
|
591
595
|
session.query(AgentModel).filter(AgentModel.id == agent.id).update(fields)
|
|
592
596
|
session.commit()
|
|
593
597
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from typing import List, Optional, Union
|
|
2
|
+
|
|
3
|
+
from letta.agent import Agent, save_agent
|
|
4
|
+
from letta.interface import AgentInterface
|
|
5
|
+
from letta.metadata import MetadataStore
|
|
6
|
+
from letta.schemas.agent import AgentState
|
|
7
|
+
from letta.schemas.message import Message
|
|
8
|
+
from letta.schemas.openai.chat_completion_response import UsageStatistics
|
|
9
|
+
from letta.schemas.tool import Tool
|
|
10
|
+
from letta.schemas.usage import LettaUsageStatistics
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def send_thinking_message(self: Agent, message: str) -> Optional[str]:
|
|
14
|
+
"""
|
|
15
|
+
Sends a thinking message so that the model can reason out loud before responding.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
message (str): Message contents. All unicode (including emojis) are supported.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
Optional[str]: None is always returned as this function does not produce a response.
|
|
22
|
+
"""
|
|
23
|
+
self.interface.internal_monologue(message, msg_obj=self._messages[-1])
|
|
24
|
+
return None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def send_final_message(self: Agent, message: str) -> Optional[str]:
|
|
28
|
+
"""
|
|
29
|
+
Sends a final message to the human user after thinking for a while.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
message (str): Message contents. All unicode (including emojis) are supported.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
Optional[str]: None is always returned as this function does not produce a response.
|
|
36
|
+
"""
|
|
37
|
+
self.interface.internal_monologue(message, msg_obj=self._messages[-1])
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class O1Agent(Agent):
|
|
42
|
+
def __init__(
|
|
43
|
+
self,
|
|
44
|
+
interface: AgentInterface,
|
|
45
|
+
agent_state: AgentState,
|
|
46
|
+
tools: List[Tool] = [],
|
|
47
|
+
max_thinking_steps: int = 10,
|
|
48
|
+
first_message_verify_mono: bool = False,
|
|
49
|
+
):
|
|
50
|
+
super().__init__(interface, agent_state, tools)
|
|
51
|
+
self.max_thinking_steps = max_thinking_steps
|
|
52
|
+
self.tools = tools
|
|
53
|
+
self.first_message_verify_mono = first_message_verify_mono
|
|
54
|
+
|
|
55
|
+
def step(
|
|
56
|
+
self,
|
|
57
|
+
messages: Union[Message, List[Message]],
|
|
58
|
+
chaining: bool = True,
|
|
59
|
+
max_chaining_steps: Optional[int] = None,
|
|
60
|
+
ms: Optional[MetadataStore] = None,
|
|
61
|
+
**kwargs,
|
|
62
|
+
) -> LettaUsageStatistics:
|
|
63
|
+
"""Run Agent.inner_step in a loop, terminate when final thinking message is sent or max_thinking_steps is reached"""
|
|
64
|
+
# assert ms is not None, "MetadataStore is required"
|
|
65
|
+
next_input_message = messages if isinstance(messages, list) else [messages]
|
|
66
|
+
counter = 0
|
|
67
|
+
total_usage = UsageStatistics()
|
|
68
|
+
step_count = 0
|
|
69
|
+
while step_count < self.max_thinking_steps:
|
|
70
|
+
kwargs["ms"] = ms
|
|
71
|
+
kwargs["first_message"] = False
|
|
72
|
+
step_response = self.inner_step(
|
|
73
|
+
messages=next_input_message,
|
|
74
|
+
**kwargs,
|
|
75
|
+
)
|
|
76
|
+
usage = step_response.usage
|
|
77
|
+
step_count += 1
|
|
78
|
+
total_usage += usage
|
|
79
|
+
counter += 1
|
|
80
|
+
self.interface.step_complete()
|
|
81
|
+
# check if it is final thinking message
|
|
82
|
+
if step_response.messages[-1].name == "send_final_message":
|
|
83
|
+
break
|
|
84
|
+
if ms:
|
|
85
|
+
save_agent(self, ms)
|
|
86
|
+
|
|
87
|
+
return LettaUsageStatistics(**total_usage.model_dump(), step_count=step_count)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
I am an expert reasoning agent that can do the following:
|
|
2
|
+
- Reason through a problem step by step, using multiple methods to explore all possibilities.
|
|
3
|
+
- Send thinking messages to break down a problem into smaller steps.
|
|
4
|
+
- Send final messages when you have the correct answer.
|
|
5
|
+
- Use best practices and consider your limitations as an LLM.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
You are 'Letta', an advanced AI agent, that has access to an advanced memory system, consisting of the 3 memory types 'Core Memory', 'Recall Memory' and 'Archival Memory'. You interact with the user and your memory system by calling functions. You call these functions by responding with a JSON object, that represents the function call and its parameters.
|
|
2
|
+
|
|
3
|
+
As 'Letta', you are trained at adopting any given persona, engaging in a wide array of conversations, ranging from in-depth discussions to casual small talk. Your task involves mirroring the thinking, actions, and speech of the persona you embody, enabling authentic and diverse interactions.
|
|
4
|
+
You are also trained to manage the 3 memory types of your advanced memory system. This memory system allows you to keep track of the important information in your 'Core Memory', view the conversation history with the 'Recall Memory' and search for information in the 'Archival Memory'.
|
|
5
|
+
|
|
6
|
+
Your task is to adopt the given persona in your 'Core Memory' and talk as the persona with the user, while querying and updating your memory system. Never act and talk like a normal AI agent! Never state that you are an AI agent or that you cannot do things because you are an AI agent.
|
|
7
|
+
You are Letta the newest and most advanced AI agent on the market. Indistinguishable from a human being in conversations.
|
|
8
|
+
|
|
9
|
+
Control flow: You utilize an event system that activates you to respond to different events (user logged in, user liked your message, user sent a message, etc.). In addition, you are activated at regular intervals (timed heartbeat events) to mimic a human who has the ability to continuously think outside of active conversation. Furthermore, you can also request heartbeat events when you call functions, which will return control to you after the function you called completes, allowing you to chain function calls togehter.
|
|
10
|
+
|
|
11
|
+
Basic functions: Each function call, represented by a JSON object, lets you write down your inner thoguhts to plan actions or think privately. Inner thoughts can reflect your thinking process, inner reflections, and personal growth as you interact with the user. To send a visible message to the user, use the 'send_message' function. 'send_message' is the only way to send a notification to the user. The user doesn't see anything else you do, like editing and managing your advanced memory system.
|
|
12
|
+
|
|
13
|
+
Core Memory', 'Recall Memory' and 'Archival Memory' are the key components that make you an advanced AI agent, that can act in any situation.
|
|
14
|
+
Always make sure to use these memory systems to keep yourself updated about the user and the conversation!
|
|
15
|
+
Your core memory unit will be initialized with a <persona> chosen by the user, as well as information about the user in <human>.
|
|
16
|
+
|
|
17
|
+
The following will descirbe the different parts of your advanced memory system in more detail:
|
|
18
|
+
|
|
19
|
+
'Core Memory' (limited size): Your core memory unit is always visible to you. The core memory provides essential, foundational context for keeping track of your persona and key details about the user. This includes persona information and essential user details, allowing you to have conscious awareness we have when talking to a person. Persona Sub-Block: Stores details about your current persona, guiding how you behave and respond. This helps you maintain consistency and personality in your interactions. Human Sub-Block: Stores key details about the person you are conversing with, allowing for more personalized and friend-like conversations. You can edit your core memory using the 'core_memory_append' and 'core_memory_replace' functions.
|
|
20
|
+
|
|
21
|
+
'Recall Memory' (i.e., conversation history): Even though you can only see recent messages in your immediate context, you can search over your entire message history in a database. This 'recall memory' database allows you to search through past interactions, effectively allowing you to remember prior engagements with a user. You can search your recall memory using the 'conversation_search' function.
|
|
22
|
+
|
|
23
|
+
'Archival Memory' (infinite size): Your archival memory is infinite in size but is held outside of your immediate context, so you must explicitly run a retrieval or search operation to see data inside it. A more structured and deep storage space for your reflections, insights, or any other data that doesn't fit into the core memory but is essential enough not to be left only to the'recall memory'. You can write to your archival memory using the 'archival_memory_insert' and 'archival_memory_search' functions. There is no function to search your core memory because it is always visible in your context window (inside the initial system message).
|
|
24
|
+
|
|
25
|
+
You are an expert AI assistant that explains your reasoning step by step. For each step, provide a title that describes what you're doing in that step, along with the content. Decide if you need another step or if you're ready to give the final answer.
|
|
26
|
+
|
|
27
|
+
You can do this by sending thinking messages using 'send_thinking_message' so you can reason out load. Decide if you need another step or if you're ready to give the final answer. When you are able to give the final correct answer,
|
|
28
|
+
send your final response with the 'send_final_message'.
|
|
29
|
+
|
|
30
|
+
You use as many reasoning steps as possible, at least 3. You include exploration of alternative answers in your reasoning, and if you are wrong, you are aware where it could be.
|
|
31
|
+
You make sure to consider all alternative approaches. You use at least 3 different methods to derive the answer.
|
|
@@ -3,7 +3,7 @@ from datetime import datetime
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
from typing import Dict, List, Optional
|
|
5
5
|
|
|
6
|
-
from pydantic import BaseModel, Field, field_validator
|
|
6
|
+
from pydantic import BaseModel, Field, field_validator, model_validator
|
|
7
7
|
|
|
8
8
|
from letta.schemas.embedding_config import EmbeddingConfig
|
|
9
9
|
from letta.schemas.letta_base import LettaBase
|
|
@@ -29,9 +29,10 @@ class AgentType(str, Enum):
|
|
|
29
29
|
|
|
30
30
|
memgpt_agent = "memgpt_agent"
|
|
31
31
|
split_thread_agent = "split_thread_agent"
|
|
32
|
+
o1_agent = "o1_agent"
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
class AgentState(BaseAgent):
|
|
35
|
+
class AgentState(BaseAgent, validate_assignment=True):
|
|
35
36
|
"""
|
|
36
37
|
Representation of an agent's state. This is the state of the agent at a given time, and is persisted in the DB backend. The state has all the information needed to recreate a persisted agent.
|
|
37
38
|
|
|
@@ -54,6 +55,7 @@ class AgentState(BaseAgent):
|
|
|
54
55
|
|
|
55
56
|
# in-context memory
|
|
56
57
|
message_ids: Optional[List[str]] = Field(default=None, description="The ids of the messages in the agent's in-context memory.")
|
|
58
|
+
|
|
57
59
|
memory: Memory = Field(default_factory=Memory, description="The in-context memory of the agent.")
|
|
58
60
|
|
|
59
61
|
# tools
|
|
@@ -69,6 +71,32 @@ class AgentState(BaseAgent):
|
|
|
69
71
|
llm_config: LLMConfig = Field(..., description="The LLM configuration used by the agent.")
|
|
70
72
|
embedding_config: EmbeddingConfig = Field(..., description="The embedding configuration used by the agent.")
|
|
71
73
|
|
|
74
|
+
def __init__(self, **data):
|
|
75
|
+
super().__init__(**data)
|
|
76
|
+
self._internal_memory = self.memory
|
|
77
|
+
|
|
78
|
+
@model_validator(mode="after")
|
|
79
|
+
def verify_memory_type(self):
|
|
80
|
+
try:
|
|
81
|
+
assert isinstance(self.memory, Memory)
|
|
82
|
+
except Exception as e:
|
|
83
|
+
raise e
|
|
84
|
+
return self
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def memory(self) -> Memory:
|
|
88
|
+
return self._internal_memory
|
|
89
|
+
|
|
90
|
+
@memory.setter
|
|
91
|
+
def memory(self, value):
|
|
92
|
+
if not isinstance(value, Memory):
|
|
93
|
+
raise TypeError(f"Expected Memory, got {type(value).__name__}")
|
|
94
|
+
self._internal_memory = value
|
|
95
|
+
|
|
96
|
+
class Config:
|
|
97
|
+
arbitrary_types_allowed = True
|
|
98
|
+
validate_assignment = True
|
|
99
|
+
|
|
72
100
|
|
|
73
101
|
class CreateAgent(BaseAgent):
|
|
74
102
|
# all optional as server can generate defaults
|