letta-nightly 0.1.7.dev20241001104147__tar.gz → 0.1.7.dev20241003104113__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.

Files changed (191) hide show
  1. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/PKG-INFO +14 -10
  2. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/README.md +4 -4
  3. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/__init__.py +1 -1
  4. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/agent.py +18 -55
  5. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/client/client.py +1 -1
  6. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/functions/functions.py +1 -24
  7. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/functions/helpers.py +74 -12
  8. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/llm_api/openai.py +2 -0
  9. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/block.py +1 -9
  10. letta_nightly-0.1.7.dev20241003104113/letta/schemas/health.py +10 -0
  11. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/tool.py +52 -3
  12. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/__init__.py +2 -0
  13. letta_nightly-0.1.7.dev20241003104113/letta/server/rest_api/routers/v1/health.py +20 -0
  14. letta_nightly-0.1.7.dev20241001104147/letta/server/static_files/assets/index-0cbf7ad5.js → letta_nightly-0.1.7.dev20241003104113/letta/server/static_files/assets/index-4d08d8a3.js +75 -75
  15. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/static_files/index.html +1 -1
  16. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/pyproject.toml +6 -2
  17. letta_nightly-0.1.7.dev20241001104147/letta/server/static_files/assets/index-486e3228.js +0 -274
  18. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/LICENSE +0 -0
  19. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/__main__.py +0 -0
  20. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/agent_store/chroma.py +0 -0
  21. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/agent_store/db.py +0 -0
  22. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/agent_store/lancedb.py +0 -0
  23. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/agent_store/milvus.py +0 -0
  24. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/agent_store/qdrant.py +0 -0
  25. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/agent_store/storage.py +0 -0
  26. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/benchmark/benchmark.py +0 -0
  27. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/benchmark/constants.py +0 -0
  28. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/cli/cli.py +0 -0
  29. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/cli/cli_config.py +0 -0
  30. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/cli/cli_load.py +0 -0
  31. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/client/__init__.py +0 -0
  32. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/client/admin.py +0 -0
  33. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/client/streaming.py +0 -0
  34. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/client/utils.py +0 -0
  35. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/config.py +0 -0
  36. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/configs/anthropic.json +0 -0
  37. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/configs/letta_hosted.json +0 -0
  38. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/configs/openai.json +0 -0
  39. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/constants.py +0 -0
  40. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/credentials.py +0 -0
  41. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/data_sources/connectors.py +0 -0
  42. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/embeddings.py +0 -0
  43. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/errors.py +0 -0
  44. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/functions/__init__.py +0 -0
  45. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/functions/function_sets/base.py +0 -0
  46. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/functions/function_sets/extras.py +0 -0
  47. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/functions/schema_generator.py +0 -0
  48. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/humans/__init__.py +0 -0
  49. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/humans/examples/basic.txt +0 -0
  50. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/humans/examples/cs_phd.txt +0 -0
  51. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/interface.py +0 -0
  52. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/llm_api/__init__.py +0 -0
  53. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/llm_api/anthropic.py +0 -0
  54. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/llm_api/azure_openai.py +0 -0
  55. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/llm_api/cohere.py +0 -0
  56. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/llm_api/google_ai.py +0 -0
  57. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/llm_api/llm_api_tools.py +0 -0
  58. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/README.md +0 -0
  59. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/__init__.py +0 -0
  60. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/chat_completion_proxy.py +0 -0
  61. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/constants.py +0 -0
  62. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/function_parser.py +0 -0
  63. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/grammars/__init__.py +0 -0
  64. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
  65. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/grammars/json.gbnf +0 -0
  66. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
  67. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/groq/api.py +0 -0
  68. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/json_parser.py +0 -0
  69. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/koboldcpp/api.py +0 -0
  70. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/koboldcpp/settings.py +0 -0
  71. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llamacpp/api.py +0 -0
  72. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llamacpp/settings.py +0 -0
  73. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
  74. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
  75. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
  76. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
  77. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
  78. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
  79. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
  80. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
  81. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
  82. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/lmstudio/api.py +0 -0
  83. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/lmstudio/settings.py +0 -0
  84. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/ollama/api.py +0 -0
  85. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/ollama/settings.py +0 -0
  86. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/settings/__init__.py +0 -0
  87. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
  88. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/settings/settings.py +0 -0
  89. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/settings/simple.py +0 -0
  90. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/utils.py +0 -0
  91. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/vllm/api.py +0 -0
  92. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/webui/api.py +0 -0
  93. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/webui/legacy_api.py +0 -0
  94. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/webui/legacy_settings.py +0 -0
  95. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/local_llm/webui/settings.py +0 -0
  96. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/log.py +0 -0
  97. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/main.py +0 -0
  98. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/memory.py +0 -0
  99. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/metadata.py +0 -0
  100. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/openai_backcompat/__init__.py +0 -0
  101. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/openai_backcompat/openai_object.py +0 -0
  102. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/persistence_manager.py +0 -0
  103. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/__init__.py +0 -0
  104. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/examples/anna_pa.txt +0 -0
  105. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/examples/google_search_persona.txt +0 -0
  106. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/examples/memgpt_doc.txt +0 -0
  107. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/examples/memgpt_starter.txt +0 -0
  108. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/examples/sam.txt +0 -0
  109. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/examples/sam_pov.txt +0 -0
  110. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
  111. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/personas/examples/sqldb/test.db +0 -0
  112. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/__init__.py +0 -0
  113. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/gpt_summarize.py +0 -0
  114. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/gpt_system.py +0 -0
  115. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/system/memgpt_base.txt +0 -0
  116. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/system/memgpt_chat.txt +0 -0
  117. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
  118. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
  119. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/system/memgpt_doc.txt +0 -0
  120. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
  121. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
  122. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
  123. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/pytest.ini +0 -0
  124. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/agent.py +0 -0
  125. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/api_key.py +0 -0
  126. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/document.py +0 -0
  127. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/embedding_config.py +0 -0
  128. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/enums.py +0 -0
  129. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/job.py +0 -0
  130. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/letta_base.py +0 -0
  131. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/letta_message.py +0 -0
  132. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/letta_request.py +0 -0
  133. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/letta_response.py +0 -0
  134. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/llm_config.py +0 -0
  135. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/memory.py +0 -0
  136. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/message.py +0 -0
  137. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/openai/chat_completion_request.py +0 -0
  138. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/openai/chat_completion_response.py +0 -0
  139. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/openai/chat_completions.py +0 -0
  140. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/openai/embedding_response.py +0 -0
  141. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/openai/openai.py +0 -0
  142. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/organization.py +0 -0
  143. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/passage.py +0 -0
  144. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/source.py +0 -0
  145. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/usage.py +0 -0
  146. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/schemas/user.py +0 -0
  147. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/__init__.py +0 -0
  148. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/constants.py +0 -0
  149. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/__init__.py +0 -0
  150. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/admin/__init__.py +0 -0
  151. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/admin/agents.py +0 -0
  152. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/admin/tools.py +0 -0
  153. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/admin/users.py +0 -0
  154. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/app.py +0 -0
  155. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/auth/__init__.py +0 -0
  156. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/auth/index.py +0 -0
  157. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/auth_token.py +0 -0
  158. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/interface.py +0 -0
  159. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/__init__.py +0 -0
  160. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/openai/__init__.py +0 -0
  161. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
  162. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
  163. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
  164. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
  165. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
  166. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
  167. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/agents.py +0 -0
  168. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/blocks.py +0 -0
  169. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/jobs.py +0 -0
  170. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/llms.py +0 -0
  171. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/organizations.py +0 -0
  172. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/sources.py +0 -0
  173. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/tools.py +0 -0
  174. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/routers/v1/users.py +0 -0
  175. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/static_files.py +0 -0
  176. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/rest_api/utils.py +0 -0
  177. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/server.py +0 -0
  178. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/startup.sh +0 -0
  179. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/static_files/assets/index-156816da.css +0 -0
  180. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/static_files/favicon.ico +0 -0
  181. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
  182. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/utils.py +0 -0
  183. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/ws_api/__init__.py +0 -0
  184. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/ws_api/example_client.py +0 -0
  185. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/ws_api/interface.py +0 -0
  186. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/ws_api/protocol.py +0 -0
  187. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/server/ws_api/server.py +0 -0
  188. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/settings.py +0 -0
  189. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/streaming_interface.py +0 -0
  190. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/system.py +0 -0
  191. {letta_nightly-0.1.7.dev20241001104147 → letta_nightly-0.1.7.dev20241003104113}/letta/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-nightly
3
- Version: 0.1.7.dev20241001104147
3
+ Version: 0.1.7.dev20241003104113
4
4
  Summary: Create LLM agents with long-term memory and custom tools
5
5
  License: Apache License
6
6
  Author: Letta Team
@@ -12,8 +12,8 @@ Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Provides-Extra: autogen
15
- Provides-Extra: crewai-tools
16
15
  Provides-Extra: dev
16
+ Provides-Extra: external-tools
17
17
  Provides-Extra: milvus
18
18
  Provides-Extra: ollama
19
19
  Provides-Extra: postgres
@@ -23,11 +23,13 @@ Provides-Extra: tests
23
23
  Requires-Dist: autoflake (>=2.3.0,<3.0.0) ; extra == "dev"
24
24
  Requires-Dist: black[jupyter] (>=24.2.0,<25.0.0) ; extra == "dev"
25
25
  Requires-Dist: chromadb (>=0.4.24,<0.5.0)
26
- Requires-Dist: crewai (>=0.41.1,<0.42.0) ; extra == "crewai-tools"
27
- Requires-Dist: crewai-tools (>=0.8.3,<0.9.0) ; extra == "crewai-tools"
26
+ Requires-Dist: composio-core (>=0.5.28,<0.6.0) ; extra == "external-tools"
27
+ Requires-Dist: composio-langchain (>=0.5.28,<0.6.0) ; extra == "external-tools"
28
+ Requires-Dist: crewai (>=0.41.1,<0.42.0) ; extra == "external-tools"
29
+ Requires-Dist: crewai-tools (>=0.8.3,<0.9.0) ; extra == "external-tools"
28
30
  Requires-Dist: datasets (>=2.14.6,<3.0.0) ; extra == "dev"
29
31
  Requires-Dist: demjson3 (>=3.0.6,<4.0.0)
30
- Requires-Dist: docker (>=7.1.0,<8.0.0) ; extra == "crewai-tools"
32
+ Requires-Dist: docker (>=7.1.0,<8.0.0) ; extra == "external-tools"
31
33
  Requires-Dist: docstring-parser (>=0.16,<0.17)
32
34
  Requires-Dist: docx2txt (>=0.8,<0.9)
33
35
  Requires-Dist: fastapi (>=0.104.1,<0.105.0) ; extra == "server"
@@ -36,6 +38,8 @@ Requires-Dist: httpx (>=0.27.2,<0.28.0)
36
38
  Requires-Dist: httpx-sse (>=0.4.0,<0.5.0)
37
39
  Requires-Dist: isort (>=5.13.2,<6.0.0) ; extra == "dev"
38
40
  Requires-Dist: jinja2 (>=3.1.4,<4.0.0)
41
+ Requires-Dist: langchain (>=0.2.16,<0.3.0) ; extra == "external-tools"
42
+ Requires-Dist: langchain-community (>=0.2.17,<0.3.0) ; extra == "external-tools"
39
43
  Requires-Dist: llama-index (>=0.11.9,<0.12.0)
40
44
  Requires-Dist: llama-index-embeddings-ollama (>=0.3.1,<0.4.0) ; extra == "ollama"
41
45
  Requires-Dist: llama-index-embeddings-openai (>=0.2.5,<0.3.0)
@@ -70,7 +74,7 @@ Requires-Dist: tqdm (>=4.66.1,<5.0.0)
70
74
  Requires-Dist: typer[all] (>=0.9.0,<0.10.0)
71
75
  Requires-Dist: uvicorn (>=0.24.0.post1,<0.25.0) ; extra == "server"
72
76
  Requires-Dist: websockets (>=12.0,<13.0) ; extra == "server"
73
- Requires-Dist: wikipedia (>=1.4.0,<2.0.0) ; extra == "tests"
77
+ Requires-Dist: wikipedia (>=1.4.0,<2.0.0) ; extra == "external-tools" or extra == "tests"
74
78
  Description-Content-Type: text/markdown
75
79
 
76
80
  # Letta (previously MemGPT)
@@ -79,13 +83,13 @@ Description-Content-Type: text/markdown
79
83
  [![arxiv 2310.08560](https://img.shields.io/badge/arXiv-2310.08560-B31B1B?logo=arxiv&style=flat-square)](https://arxiv.org/abs/2310.08560)
80
84
 
81
85
  > [!NOTE]
82
- > **Looking for MemGPT?**
86
+ > **Looking for MemGPT?** You're in the right place!
83
87
  >
84
- > The MemGPT package and Docker image have been renamed to `letta` to clarify the distinction between **MemGPT agents** and the API server / runtime that runs LLM agents as *services*.
88
+ > The MemGPT package and Docker image have been renamed to `letta` to clarify the distinction between MemGPT agents and the API server / runtime that runs LLM agents as *services*.
85
89
  >
86
- > You use the **Letta framework** to create **MemGPT agents**. Read more about the relationship between MemGPT and Letta [here](https://www.letta.com/blog/memgpt-and-letta).
90
+ > You use the **Letta _framework_** to create **MemGPT _agents_**. Read more about the relationship between MemGPT and Letta [here](https://www.letta.com/blog/memgpt-and-letta).
87
91
 
88
- See [documentation](https://docs.letta.com/introduction) for setup and usage.
92
+ Visit our [documentation page](https://docs.letta.com) for information on setup and usage.
89
93
 
90
94
  ## How to Get Involved
91
95
  * **Contribute to the Project**: Interested in contributing? Start by reading our [Contribution Guidelines](https://github.com/cpacker/MemGPT/tree/main/CONTRIBUTING.md).
@@ -4,13 +4,13 @@
4
4
  [![arxiv 2310.08560](https://img.shields.io/badge/arXiv-2310.08560-B31B1B?logo=arxiv&style=flat-square)](https://arxiv.org/abs/2310.08560)
5
5
 
6
6
  > [!NOTE]
7
- > **Looking for MemGPT?**
7
+ > **Looking for MemGPT?** You're in the right place!
8
8
  >
9
- > The MemGPT package and Docker image have been renamed to `letta` to clarify the distinction between **MemGPT agents** and the API server / runtime that runs LLM agents as *services*.
9
+ > The MemGPT package and Docker image have been renamed to `letta` to clarify the distinction between MemGPT agents and the API server / runtime that runs LLM agents as *services*.
10
10
  >
11
- > You use the **Letta framework** to create **MemGPT agents**. Read more about the relationship between MemGPT and Letta [here](https://www.letta.com/blog/memgpt-and-letta).
11
+ > You use the **Letta _framework_** to create **MemGPT _agents_**. Read more about the relationship between MemGPT and Letta [here](https://www.letta.com/blog/memgpt-and-letta).
12
12
 
13
- See [documentation](https://docs.letta.com/introduction) for setup and usage.
13
+ Visit our [documentation page](https://docs.letta.com) for information on setup and usage.
14
14
 
15
15
  ## How to Get Involved
16
16
  * **Contribute to the Project**: Interested in contributing? Start by reading our [Contribution Guidelines](https://github.com/cpacker/MemGPT/tree/main/CONTRIBUTING.md).
@@ -1,4 +1,4 @@
1
- __version__ = "0.1.17"
1
+ __version__ = "0.1.7"
2
2
 
3
3
  # import clients
4
4
  from letta.client.admin import Admin
@@ -237,10 +237,8 @@ class Agent(BaseAgent):
237
237
  self.agent_state = agent_state
238
238
  assert isinstance(self.agent_state.memory, Memory), f"Memory object is not of type Memory: {type(self.agent_state.memory)}"
239
239
 
240
- try:
241
- self.link_tools(tools)
242
- except Exception as e:
243
- raise ValueError(f"Encountered an error while trying to link agent tools during initialization:\n{str(e)}")
240
+ # link tools
241
+ self.link_tools(tools)
244
242
 
245
243
  # gpt-4, gpt-3.5-turbo, ...
246
244
  self.model = self.agent_state.llm_config.model
@@ -345,16 +343,18 @@ class Agent(BaseAgent):
345
343
  env = {}
346
344
  env.update(globals())
347
345
  for tool in tools:
348
- # WARNING: name may not be consistent?
349
- if tool.module: # execute the whole module
350
- exec(tool.module, env)
351
- else:
352
- exec(tool.source_code, env)
353
- from pprint import pprint
346
+ try:
347
+ # WARNING: name may not be consistent?
348
+ if tool.module: # execute the whole module
349
+ exec(tool.module, env)
350
+ else:
351
+ exec(tool.source_code, env)
354
352
 
355
- pprint(tool.json_schema)
356
- self.functions_python[tool.name] = env[tool.json_schema["name"]]
357
- self.functions.append(tool.json_schema)
353
+ self.functions_python[tool.json_schema["name"]] = env[tool.json_schema["name"]]
354
+ self.functions.append(tool.json_schema)
355
+ except Exception as e:
356
+ warnings.warn(f"WARNING: tool {tool.name} failed to link")
357
+ print(e)
358
358
  assert all([callable(f) for k, f in self.functions_python.items()]), self.functions_python
359
359
 
360
360
  def _load_messages_from_recall(self, message_ids: List[str]) -> List[Message]:
@@ -551,18 +551,19 @@ class Agent(BaseAgent):
551
551
  ) # extend conversation with assistant's reply
552
552
  printd(f"Function call message: {messages[-1]}")
553
553
 
554
- # The content if then internal monologue, not chat
555
- self.interface.internal_monologue(response_message.content, msg_obj=messages[-1])
554
+ if response_message.content:
555
+ # The content if then internal monologue, not chat
556
+ self.interface.internal_monologue(response_message.content, msg_obj=messages[-1])
556
557
 
557
558
  # Step 3: call the function
558
559
  # Note: the JSON response may not always be valid; be sure to handle errors
559
-
560
- # Failure case 1: function name is wrong
561
560
  function_call = (
562
561
  response_message.function_call if response_message.function_call is not None else response_message.tool_calls[0].function
563
562
  )
564
563
  function_name = function_call.name
565
564
  printd(f"Request to call function {function_name} with tool_call_id: {tool_call_id}")
565
+
566
+ # Failure case 1: function name is wrong
566
567
  try:
567
568
  function_to_call = self.functions_python[function_name]
568
569
  except KeyError:
@@ -1117,48 +1118,10 @@ class Agent(BaseAgent):
1117
1118
  def add_function(self, function_name: str) -> str:
1118
1119
  # TODO: refactor
1119
1120
  raise NotImplementedError
1120
- # if function_name in self.functions_python.keys():
1121
- # msg = f"Function {function_name} already loaded"
1122
- # printd(msg)
1123
- # return msg
1124
-
1125
- # available_functions = load_all_function_sets()
1126
- # if function_name not in available_functions.keys():
1127
- # raise ValueError(f"Function {function_name} not found in function library")
1128
-
1129
- # self.functions.append(available_functions[function_name]["json_schema"])
1130
- # self.functions_python[function_name] = available_functions[function_name]["python_function"]
1131
-
1132
- # msg = f"Added function {function_name}"
1133
- ## self.save()
1134
- # self.update_state()
1135
- # printd(msg)
1136
- # return msg
1137
1121
 
1138
1122
  def remove_function(self, function_name: str) -> str:
1139
1123
  # TODO: refactor
1140
1124
  raise NotImplementedError
1141
- # if function_name not in self.functions_python.keys():
1142
- # msg = f"Function {function_name} not loaded, ignoring"
1143
- # printd(msg)
1144
- # return msg
1145
-
1146
- ## only allow removal of user defined functions
1147
- # user_func_path = Path(USER_FUNCTIONS_DIR)
1148
- # func_path = Path(inspect.getfile(self.functions_python[function_name]))
1149
- # is_subpath = func_path.resolve().parts[: len(user_func_path.resolve().parts)] == user_func_path.resolve().parts
1150
-
1151
- # if not is_subpath:
1152
- # raise ValueError(f"Function {function_name} is not user defined and cannot be removed")
1153
-
1154
- # self.functions = [f_schema for f_schema in self.functions if f_schema["name"] != function_name]
1155
- # self.functions_python.pop(function_name)
1156
-
1157
- # msg = f"Removed function {function_name}"
1158
- ## self.save()
1159
- # self.update_state()
1160
- # printd(msg)
1161
- # return msg
1162
1125
 
1163
1126
  def update_state(self) -> AgentState:
1164
1127
  message_ids = [msg.id for msg in self._messages]
@@ -1562,7 +1562,7 @@ class LocalClient(AbstractClient):
1562
1562
 
1563
1563
  def get_agent(self, agent_id: str) -> AgentState:
1564
1564
  """
1565
- Get an agent's state by it's ID.
1565
+ Get an agent's state by its ID.
1566
1566
 
1567
1567
  Args:
1568
1568
  agent_id (str): ID of the agent
@@ -1,17 +1,12 @@
1
1
  import importlib
2
2
  import inspect
3
3
  import os
4
- import sys
5
4
  from textwrap import dedent # remove indentation
6
5
  from types import ModuleType
7
6
 
8
- from letta.constants import CLI_WARNING_PREFIX, LETTA_DIR
7
+ from letta.constants import CLI_WARNING_PREFIX
9
8
  from letta.functions.schema_generator import generate_schema
10
9
 
11
- USER_FUNCTIONS_DIR = os.path.join(LETTA_DIR, "functions")
12
-
13
- sys.path.append(USER_FUNCTIONS_DIR)
14
-
15
10
 
16
11
  def parse_source_code(func) -> str:
17
12
  """Parse the source code of a function and remove indendation"""
@@ -68,24 +63,6 @@ def validate_function(module_name, module_full_path):
68
63
  return True, None
69
64
 
70
65
 
71
- def write_function(module_name: str, function_name: str, function_code: str):
72
- """Write a function to a file in the user functions directory"""
73
- # Create the user functions directory if it doesn't exist
74
- if not os.path.exists(USER_FUNCTIONS_DIR):
75
- os.makedirs(USER_FUNCTIONS_DIR)
76
-
77
- # Write the function to a file
78
- file_path = os.path.join(USER_FUNCTIONS_DIR, f"{module_name}.py")
79
- with open(file_path, "w", encoding="utf-8") as f:
80
- f.write(function_code)
81
- succ, error = validate_function(module_name, file_path)
82
-
83
- # raise error if function cannot be loaded
84
- if not succ:
85
- raise ValueError(error)
86
- return file_path
87
-
88
-
89
66
  def load_function_file(filepath: str) -> dict:
90
67
  file = os.path.basename(filepath)
91
68
  module_name = file[:-3] # Remove '.py' from filename
@@ -3,21 +3,40 @@ from typing import Any, Optional, Union
3
3
  from pydantic import BaseModel
4
4
 
5
5
 
6
- def generate_langchain_tool_wrapper(tool: "LangChainBaseTool", additional_imports_module_attr_map: dict = None) -> tuple[str, str]:
6
+ def generate_composio_tool_wrapper(action: "ActionType") -> tuple[str, str]:
7
+ # Instantiate the object
8
+ tool_instantiation_str = f"composio_toolset.get_tools(actions=[Action.{action.name}])[0]"
9
+
10
+ # Generate func name
11
+ func_name = f"run_{action.name}"
12
+
13
+ wrapper_function_str = f"""
14
+ def {func_name}(**kwargs):
15
+ if 'self' in kwargs:
16
+ del kwargs['self']
17
+ from composio import Action, App, Tag
18
+ from composio_langchain import ComposioToolSet
19
+
20
+ composio_toolset = ComposioToolSet()
21
+ tool = {tool_instantiation_str}
22
+ tool.func(**kwargs)
23
+ """
24
+
25
+ # Compile safety check
26
+ assert_code_gen_compilable(wrapper_function_str)
27
+
28
+ return func_name, wrapper_function_str
29
+
30
+
31
+ def generate_langchain_tool_wrapper(
32
+ tool: "LangChainBaseTool", additional_imports_module_attr_map: dict[str, str] = None
33
+ ) -> tuple[str, str]:
7
34
  tool_name = tool.__class__.__name__
8
35
  import_statement = f"from langchain_community.tools import {tool_name}"
9
36
  extra_module_imports = generate_import_code(additional_imports_module_attr_map)
10
37
 
11
38
  # Safety check that user has passed in all required imports:
12
- current_class_imports = {tool_name}
13
- if additional_imports_module_attr_map:
14
- current_class_imports.update(set(additional_imports_module_attr_map.values()))
15
- required_class_imports = set(find_required_class_names_for_import(tool))
16
-
17
- if not current_class_imports.issuperset(required_class_imports):
18
- err_msg = f"[ERROR] You are missing module_attr pairs in `additional_imports_module_attr_map`. Currently, you have imports for {current_class_imports}, but the required classes for import are {required_class_imports}"
19
- print(err_msg)
20
- raise RuntimeError(err_msg)
39
+ assert_all_classes_are_imported(tool, additional_imports_module_attr_map)
21
40
 
22
41
  tool_instantiation = f"tool = {generate_imported_tool_instantiation_call_str(tool)}"
23
42
  run_call = f"return tool._run(**kwargs)"
@@ -34,12 +53,21 @@ def {func_name}(**kwargs):
34
53
  {tool_instantiation}
35
54
  {run_call}
36
55
  """
56
+
57
+ # Compile safety check
58
+ assert_code_gen_compilable(wrapper_function_str)
59
+
37
60
  return func_name, wrapper_function_str
38
61
 
39
62
 
40
- def generate_crewai_tool_wrapper(tool: "CrewAIBaseTool") -> tuple[str, str]:
63
+ def generate_crewai_tool_wrapper(tool: "CrewAIBaseTool", additional_imports_module_attr_map: dict[str, str] = None) -> tuple[str, str]:
41
64
  tool_name = tool.__class__.__name__
42
65
  import_statement = f"from crewai_tools import {tool_name}"
66
+ extra_module_imports = generate_import_code(additional_imports_module_attr_map)
67
+
68
+ # Safety check that user has passed in all required imports:
69
+ assert_all_classes_are_imported(tool, additional_imports_module_attr_map)
70
+
43
71
  tool_instantiation = f"tool = {generate_imported_tool_instantiation_call_str(tool)}"
44
72
  run_call = f"return tool._run(**kwargs)"
45
73
  func_name = f"run_{tool_name.lower()}"
@@ -49,13 +77,42 @@ def generate_crewai_tool_wrapper(tool: "CrewAIBaseTool") -> tuple[str, str]:
49
77
  def {func_name}(**kwargs):
50
78
  if 'self' in kwargs:
51
79
  del kwargs['self']
80
+ import importlib
52
81
  {import_statement}
82
+ {extra_module_imports}
53
83
  {tool_instantiation}
54
84
  {run_call}
55
85
  """
86
+
87
+ # Compile safety check
88
+ assert_code_gen_compilable(wrapper_function_str)
89
+
56
90
  return func_name, wrapper_function_str
57
91
 
58
92
 
93
+ def assert_code_gen_compilable(code_str):
94
+ try:
95
+ compile(code_str, "<string>", "exec")
96
+ except SyntaxError as e:
97
+ print(f"Syntax error in code: {e}")
98
+
99
+
100
+ def assert_all_classes_are_imported(
101
+ tool: Union["LangChainBaseTool", "CrewAIBaseTool"], additional_imports_module_attr_map: dict[str, str]
102
+ ) -> None:
103
+ # Safety check that user has passed in all required imports:
104
+ tool_name = tool.__class__.__name__
105
+ current_class_imports = {tool_name}
106
+ if additional_imports_module_attr_map:
107
+ current_class_imports.update(set(additional_imports_module_attr_map.values()))
108
+ required_class_imports = set(find_required_class_names_for_import(tool))
109
+
110
+ if not current_class_imports.issuperset(required_class_imports):
111
+ err_msg = f"[ERROR] You are missing module_attr pairs in `additional_imports_module_attr_map`. Currently, you have imports for {current_class_imports}, but the required classes for import are {required_class_imports}"
112
+ print(err_msg)
113
+ raise RuntimeError(err_msg)
114
+
115
+
59
116
  def find_required_class_names_for_import(obj: Union["LangChainBaseTool", "CrewAIBaseTool", BaseModel]) -> list[str]:
60
117
  """
61
118
  Finds all the class names for required imports when instantiating the `obj`.
@@ -113,7 +170,7 @@ def generate_imported_tool_instantiation_call_str(obj: Any) -> Optional[str]:
113
170
  # e.g. {arg}={value}
114
171
  # The reason why this is recursive, is because the value can be another BaseModel that we need to stringify
115
172
  model_name = obj.__class__.__name__
116
- fields = dict(obj)
173
+ fields = obj.dict()
117
174
  # Generate code for each field, skipping empty or None values
118
175
  field_assignments = []
119
176
  for arg, value in fields.items():
@@ -152,6 +209,11 @@ def generate_imported_tool_instantiation_call_str(obj: Any) -> Optional[str]:
152
209
  print(
153
210
  f"[WARNING] Skipping parsing unknown class {obj.__class__.__name__} (does not inherit from the Pydantic BaseModel and is not a basic Python type)"
154
211
  )
212
+ if obj.__class__.__name__ == "function":
213
+ import inspect
214
+
215
+ print(inspect.getsource(obj))
216
+
155
217
  return None
156
218
 
157
219
 
@@ -419,6 +419,8 @@ def openai_chat_completions_request(
419
419
  try:
420
420
  response = requests.post(url, headers=headers, json=data)
421
421
  printd(f"response = {response}, response.text = {response.text}")
422
+ # print(json.dumps(data, indent=4))
423
+ # raise requests.exceptions.HTTPError
422
424
  response.raise_for_status() # Raises HTTPError for 4XX/5XX status
423
425
 
424
426
  response = response.json() # convert to dict from string
@@ -46,15 +46,7 @@ class BaseBlock(LettaBase, validate_assignment=True):
46
46
  return self
47
47
 
48
48
  def __len__(self):
49
- return len(str(self))
50
-
51
- def __str__(self) -> str:
52
- if isinstance(self.value, list):
53
- return ",".join(self.value)
54
- elif isinstance(self.value, str):
55
- return self.value
56
- else:
57
- return ""
49
+ return len(self.value)
58
50
 
59
51
  def __setattr__(self, name, value):
60
52
  """Run validation if self.value is updated"""
@@ -0,0 +1,10 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class Health(BaseModel):
5
+ """
6
+ Health check response body
7
+ """
8
+
9
+ version: str
10
+ status: str
@@ -3,6 +3,7 @@ from typing import Dict, List, Optional
3
3
  from pydantic import Field
4
4
 
5
5
  from letta.functions.helpers import (
6
+ generate_composio_tool_wrapper,
6
7
  generate_crewai_tool_wrapper,
7
8
  generate_langchain_tool_wrapper,
8
9
  )
@@ -57,6 +58,54 @@ class Tool(BaseTool):
57
58
  )
58
59
  )
59
60
 
61
+ @classmethod
62
+ def get_composio_tool(
63
+ cls,
64
+ action: "ActionType",
65
+ ) -> "Tool":
66
+ """
67
+ Class method to create an instance of Letta-compatible Composio Tool.
68
+ Check https://docs.composio.dev/introduction/intro/overview to look at options for get_composio_tool
69
+
70
+ This function will error if we find more than one tool, or 0 tools.
71
+
72
+ Args:
73
+ action ActionType: A action name to filter tools by.
74
+ Returns:
75
+ Tool: A Letta Tool initialized with attributes derived from the Composio tool.
76
+ """
77
+ from composio_langchain import ComposioToolSet
78
+
79
+ composio_toolset = ComposioToolSet()
80
+ composio_tools = composio_toolset.get_tools(actions=[action])
81
+
82
+ assert len(composio_tools) > 0, "User supplied parameters do not match any Composio tools"
83
+ assert len(composio_tools) == 1, f"User supplied parameters match too many Composio tools; {len(composio_tools)} > 1"
84
+
85
+ composio_tool = composio_tools[0]
86
+
87
+ description = composio_tool.description
88
+ source_type = "python"
89
+ tags = ["composio"]
90
+ wrapper_func_name, wrapper_function_str = generate_composio_tool_wrapper(action)
91
+ json_schema = generate_schema_from_args_schema(composio_tool.args_schema, name=wrapper_func_name, description=description)
92
+
93
+ # append heartbeat (necessary for triggering another reasoning step after this tool call)
94
+ json_schema["parameters"]["properties"]["request_heartbeat"] = {
95
+ "type": "boolean",
96
+ "description": "Request an immediate heartbeat after function execution. Set to 'true' if you want to send a follow-up message or run a follow-up function.",
97
+ }
98
+ json_schema["parameters"]["required"].append("request_heartbeat")
99
+
100
+ return cls(
101
+ name=wrapper_func_name,
102
+ description=description,
103
+ source_type=source_type,
104
+ tags=tags,
105
+ source_code=wrapper_function_str,
106
+ json_schema=json_schema,
107
+ )
108
+
60
109
  @classmethod
61
110
  def from_langchain(cls, langchain_tool: "LangChainBaseTool", additional_imports_module_attr_map: dict[str, str] = None) -> "Tool":
62
111
  """
@@ -93,7 +142,7 @@ class Tool(BaseTool):
93
142
  )
94
143
 
95
144
  @classmethod
96
- def from_crewai(cls, crewai_tool: "CrewAIBaseTool") -> "Tool":
145
+ def from_crewai(cls, crewai_tool: "CrewAIBaseTool", additional_imports_module_attr_map: dict[str, str] = None) -> "Tool":
97
146
  """
98
147
  Class method to create an instance of Tool from a crewAI BaseTool object.
99
148
 
@@ -106,7 +155,7 @@ class Tool(BaseTool):
106
155
  description = crewai_tool.description
107
156
  source_type = "python"
108
157
  tags = ["crew-ai"]
109
- wrapper_func_name, wrapper_function_str = generate_crewai_tool_wrapper(crewai_tool)
158
+ wrapper_func_name, wrapper_function_str = generate_crewai_tool_wrapper(crewai_tool, additional_imports_module_attr_map)
110
159
  json_schema = generate_schema_from_args_schema(crewai_tool.args_schema, name=wrapper_func_name, description=description)
111
160
 
112
161
  # append heartbeat (necessary for triggering another reasoning step after this tool call)
@@ -128,7 +177,7 @@ class Tool(BaseTool):
128
177
 
129
178
  class ToolCreate(BaseTool):
130
179
  name: Optional[str] = Field(None, description="The name of the function (auto-generated from source_code if not provided).")
131
- tags: List[str] = Field(..., description="Metadata tags.")
180
+ tags: List[str] = Field([], description="Metadata tags.")
132
181
  source_code: str = Field(..., description="The source code of the function.")
133
182
  json_schema: Optional[Dict] = Field(
134
183
  None, description="The JSON schema of the function (auto-generated from source_code if not provided)"
@@ -1,5 +1,6 @@
1
1
  from letta.server.rest_api.routers.v1.agents import router as agents_router
2
2
  from letta.server.rest_api.routers.v1.blocks import router as blocks_router
3
+ from letta.server.rest_api.routers.v1.health import router as health_router
3
4
  from letta.server.rest_api.routers.v1.jobs import router as jobs_router
4
5
  from letta.server.rest_api.routers.v1.llms import router as llm_router
5
6
  from letta.server.rest_api.routers.v1.sources import router as sources_router
@@ -12,4 +13,5 @@ ROUTERS = [
12
13
  llm_router,
13
14
  blocks_router,
14
15
  jobs_router,
16
+ health_router,
15
17
  ]
@@ -0,0 +1,20 @@
1
+ from typing import TYPE_CHECKING
2
+
3
+ from fastapi import APIRouter
4
+
5
+ from letta.cli.cli import version
6
+ from letta.schemas.health import Health
7
+
8
+ if TYPE_CHECKING:
9
+ pass
10
+
11
+ router = APIRouter(prefix="/health", tags=["health"])
12
+
13
+
14
+ # Health check
15
+ @router.get("/", response_model=Health, operation_id="health_check")
16
+ def health_check():
17
+ return Health(
18
+ version=version(),
19
+ status="ok",
20
+ )