letta-nightly 0.4.1.dev20241011104054__tar.gz → 0.4.1.dev20241012104008__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 (190) hide show
  1. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/PKG-INFO +2 -1
  2. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/agent.py +1 -1
  3. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/db.py +8 -2
  4. letta_nightly-0.4.1.dev20241012104008/letta/base.py +3 -0
  5. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/cli/cli.py +2 -18
  6. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/azure_openai.py +1 -1
  7. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/helpers.py +1 -0
  8. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/llm_api_tools.py +17 -13
  9. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/openai.py +21 -17
  10. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/vllm/api.py +1 -1
  11. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/metadata.py +3 -4
  12. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/providers.py +72 -9
  13. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/embedding_config.py +7 -0
  14. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/llm_config.py +7 -0
  15. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/server.py +24 -36
  16. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/settings.py +12 -3
  17. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/pyproject.toml +2 -1
  18. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/LICENSE +0 -0
  19. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/README.md +0 -0
  20. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/__init__.py +0 -0
  21. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/__main__.py +0 -0
  22. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/chroma.py +0 -0
  23. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/lancedb.py +0 -0
  24. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/milvus.py +0 -0
  25. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/qdrant.py +0 -0
  26. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/storage.py +0 -0
  27. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/benchmark/benchmark.py +0 -0
  28. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/benchmark/constants.py +0 -0
  29. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/cli/cli_config.py +0 -0
  30. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/cli/cli_load.py +0 -0
  31. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/client/__init__.py +0 -0
  32. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/client/admin.py +0 -0
  33. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/client/client.py +0 -0
  34. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/client/streaming.py +0 -0
  35. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/client/utils.py +0 -0
  36. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/config.py +0 -0
  37. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/constants.py +0 -0
  38. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/credentials.py +0 -0
  39. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/data_sources/connectors.py +0 -0
  40. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/embeddings.py +0 -0
  41. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/errors.py +0 -0
  42. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/__init__.py +0 -0
  43. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/function_sets/base.py +0 -0
  44. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/function_sets/extras.py +0 -0
  45. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/functions.py +0 -0
  46. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/helpers.py +0 -0
  47. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/schema_generator.py +0 -0
  48. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/humans/__init__.py +0 -0
  49. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/humans/examples/basic.txt +0 -0
  50. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/humans/examples/cs_phd.txt +0 -0
  51. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/interface.py +0 -0
  52. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/__init__.py +0 -0
  53. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/anthropic.py +0 -0
  54. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/azure_openai_constants.py +0 -0
  55. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/cohere.py +0 -0
  56. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/google_ai.py +0 -0
  57. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/README.md +0 -0
  58. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/__init__.py +0 -0
  59. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/chat_completion_proxy.py +0 -0
  60. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/constants.py +0 -0
  61. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/function_parser.py +0 -0
  62. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/grammars/__init__.py +0 -0
  63. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
  64. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/grammars/json.gbnf +0 -0
  65. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
  66. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/json_parser.py +0 -0
  67. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/koboldcpp/api.py +0 -0
  68. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/koboldcpp/settings.py +0 -0
  69. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llamacpp/api.py +0 -0
  70. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llamacpp/settings.py +0 -0
  71. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
  72. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
  73. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
  74. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
  75. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
  76. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
  77. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
  78. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
  79. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
  80. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/lmstudio/api.py +0 -0
  81. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/lmstudio/settings.py +0 -0
  82. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/ollama/api.py +0 -0
  83. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/ollama/settings.py +0 -0
  84. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/settings/__init__.py +0 -0
  85. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
  86. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/settings/settings.py +0 -0
  87. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/settings/simple.py +0 -0
  88. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/utils.py +0 -0
  89. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/webui/api.py +0 -0
  90. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/webui/legacy_api.py +0 -0
  91. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/webui/legacy_settings.py +0 -0
  92. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/webui/settings.py +0 -0
  93. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/log.py +0 -0
  94. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/main.py +0 -0
  95. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/memory.py +0 -0
  96. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/openai_backcompat/__init__.py +0 -0
  97. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/openai_backcompat/openai_object.py +0 -0
  98. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/persistence_manager.py +0 -0
  99. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/__init__.py +0 -0
  100. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/anna_pa.txt +0 -0
  101. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/google_search_persona.txt +0 -0
  102. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/memgpt_doc.txt +0 -0
  103. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/memgpt_starter.txt +0 -0
  104. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/sam.txt +0 -0
  105. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/sam_pov.txt +0 -0
  106. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
  107. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/sqldb/test.db +0 -0
  108. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/__init__.py +0 -0
  109. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/gpt_summarize.py +0 -0
  110. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/gpt_system.py +0 -0
  111. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_base.txt +0 -0
  112. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_chat.txt +0 -0
  113. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
  114. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
  115. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_doc.txt +0 -0
  116. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
  117. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
  118. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
  119. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/pytest.ini +0 -0
  120. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/agent.py +0 -0
  121. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/api_key.py +0 -0
  122. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/block.py +0 -0
  123. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/document.py +0 -0
  124. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/enums.py +0 -0
  125. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/health.py +0 -0
  126. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/job.py +0 -0
  127. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/letta_base.py +0 -0
  128. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/letta_message.py +0 -0
  129. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/letta_request.py +0 -0
  130. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/letta_response.py +0 -0
  131. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/memory.py +0 -0
  132. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/message.py +0 -0
  133. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/chat_completion_request.py +0 -0
  134. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/chat_completion_response.py +0 -0
  135. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/chat_completions.py +0 -0
  136. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/embedding_response.py +0 -0
  137. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/openai.py +0 -0
  138. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/organization.py +0 -0
  139. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/passage.py +0 -0
  140. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/source.py +0 -0
  141. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/tool.py +0 -0
  142. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/usage.py +0 -0
  143. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/user.py +0 -0
  144. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/__init__.py +0 -0
  145. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/constants.py +0 -0
  146. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/__init__.py +0 -0
  147. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/admin/__init__.py +0 -0
  148. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/admin/agents.py +0 -0
  149. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/admin/tools.py +0 -0
  150. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/admin/users.py +0 -0
  151. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/app.py +0 -0
  152. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/auth/__init__.py +0 -0
  153. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/auth/index.py +0 -0
  154. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/auth_token.py +0 -0
  155. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/interface.py +0 -0
  156. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/__init__.py +0 -0
  157. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/__init__.py +0 -0
  158. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
  159. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
  160. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
  161. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
  162. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
  163. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
  164. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/__init__.py +0 -0
  165. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/agents.py +0 -0
  166. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/blocks.py +0 -0
  167. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/health.py +0 -0
  168. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/jobs.py +0 -0
  169. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/llms.py +0 -0
  170. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/organizations.py +0 -0
  171. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/sources.py +0 -0
  172. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/tools.py +0 -0
  173. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/users.py +0 -0
  174. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/static_files.py +0 -0
  175. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/utils.py +0 -0
  176. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/startup.sh +0 -0
  177. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
  178. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/assets/index-9a9c449b.js +0 -0
  179. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/favicon.ico +0 -0
  180. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/index.html +0 -0
  181. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
  182. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/utils.py +0 -0
  183. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/__init__.py +0 -0
  184. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/example_client.py +0 -0
  185. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/interface.py +0 -0
  186. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/protocol.py +0 -0
  187. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/server.py +0 -0
  188. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/streaming_interface.py +0 -0
  189. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/system.py +0 -0
  190. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241012104008}/letta/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: letta-nightly
3
- Version: 0.4.1.dev20241011104054
3
+ Version: 0.4.1.dev20241012104008
4
4
  Summary: Create LLM agents with long-term memory and custom tools
5
5
  License: Apache License
6
6
  Author: Letta Team
@@ -20,6 +20,7 @@ Provides-Extra: postgres
20
20
  Provides-Extra: qdrant
21
21
  Provides-Extra: server
22
22
  Provides-Extra: tests
23
+ Requires-Dist: alembic (>=1.13.3,<2.0.0)
23
24
  Requires-Dist: autoflake (>=2.3.0,<3.0.0) ; extra == "dev"
24
25
  Requires-Dist: black[jupyter] (>=24.2.0,<25.0.0) ; extra == "dev"
25
26
  Requires-Dist: chromadb (>=0.4.24,<0.5.0)
@@ -481,7 +481,7 @@ class Agent(BaseAgent):
481
481
  first_message=first_message,
482
482
  # streaming
483
483
  stream=stream,
484
- stream_inferface=self.interface,
484
+ stream_interface=self.interface,
485
485
  # putting inner thoughts in func args or not
486
486
  inner_thoughts_in_kwargs_option=inner_thoughts_in_kwargs_option,
487
487
  )
@@ -18,13 +18,14 @@ from sqlalchemy import (
18
18
  select,
19
19
  text,
20
20
  )
21
- from sqlalchemy.orm import declarative_base, mapped_column
21
+ from sqlalchemy.orm import mapped_column
22
22
  from sqlalchemy.orm.session import close_all_sessions
23
23
  from sqlalchemy.sql import func
24
24
  from sqlalchemy_json import MutableJson
25
25
  from tqdm import tqdm
26
26
 
27
27
  from letta.agent_store.storage import StorageConnector, TableType
28
+ from letta.base import Base
28
29
  from letta.config import LettaConfig
29
30
  from letta.constants import MAX_EMBEDDING_DIM
30
31
  from letta.metadata import EmbeddingConfigColumn, ToolCallColumn
@@ -35,7 +36,6 @@ from letta.schemas.openai.chat_completions import ToolCall
35
36
  from letta.schemas.passage import Passage
36
37
  from letta.settings import settings
37
38
 
38
- Base = declarative_base()
39
39
  config = LettaConfig()
40
40
 
41
41
 
@@ -560,3 +560,9 @@ class SQLLiteStorageConnector(SQLStorageConnector):
560
560
 
561
561
  # Commit the changes to the database
562
562
  session.commit()
563
+
564
+
565
+ def attach_base():
566
+ # This should be invoked in server.py to make sure Base gets initialized properly
567
+ # DO NOT REMOVE
568
+ print("Initializing database...")
@@ -0,0 +1,3 @@
1
+ from sqlalchemy.ext.declarative import declarative_base
2
+
3
+ Base = declarative_base()
@@ -14,9 +14,7 @@ from letta.constants import CLI_WARNING_PREFIX, LETTA_DIR
14
14
  from letta.local_llm.constants import ASSISTANT_MESSAGE_CLI_SYMBOL
15
15
  from letta.log import get_logger
16
16
  from letta.metadata import MetadataStore
17
- from letta.schemas.embedding_config import EmbeddingConfig
18
17
  from letta.schemas.enums import OptionState
19
- from letta.schemas.llm_config import LLMConfig
20
18
  from letta.schemas.memory import ChatMemory, Memory
21
19
  from letta.server.server import logger as server_logger
22
20
 
@@ -235,12 +233,7 @@ def run(
235
233
  # choose from list of llm_configs
236
234
  llm_configs = client.list_llm_configs()
237
235
  llm_options = [llm_config.model for llm_config in llm_configs]
238
-
239
- # TODO move into LLMConfig as a class method?
240
- def prettify_llm_config(llm_config: LLMConfig) -> str:
241
- return f"{llm_config.model}" + f" ({llm_config.model_endpoint})" if llm_config.model_endpoint else ""
242
-
243
- llm_choices = [questionary.Choice(title=prettify_llm_config(llm_config), value=llm_config) for llm_config in llm_configs]
236
+ llm_choices = [questionary.Choice(title=llm_config.pretty_print(), value=llm_config) for llm_config in llm_configs]
244
237
 
245
238
  # select model
246
239
  if len(llm_options) == 0:
@@ -255,17 +248,8 @@ def run(
255
248
  embedding_configs = client.list_embedding_configs()
256
249
  embedding_options = [embedding_config.embedding_model for embedding_config in embedding_configs]
257
250
 
258
- # TODO move into EmbeddingConfig as a class method?
259
- def prettify_embed_config(embedding_config: EmbeddingConfig) -> str:
260
- return (
261
- f"{embedding_config.embedding_model}" + f" ({embedding_config.embedding_endpoint})"
262
- if embedding_config.embedding_endpoint
263
- else ""
264
- )
265
-
266
251
  embedding_choices = [
267
- questionary.Choice(title=prettify_embed_config(embedding_config), value=embedding_config)
268
- for embedding_config in embedding_configs
252
+ questionary.Choice(title=embedding_config.pretty_print(), value=embedding_config) for embedding_config in embedding_configs
269
253
  ]
270
254
 
271
255
  # select model
@@ -79,7 +79,7 @@ def azure_openai_chat_completions_request(
79
79
  data.pop("tools")
80
80
  data.pop("tool_choice", None) # extra safe, should exist always (default="auto")
81
81
 
82
- url = get_azure_chat_completions_endpoint(model_settings.azure_base_url, llm_config.model, model_settings.api_version)
82
+ url = get_azure_chat_completions_endpoint(model_settings.azure_base_url, llm_config.model, model_settings.azure_api_version)
83
83
  response_json = make_post_request(url, headers, data)
84
84
  # NOTE: azure openai does not include "content" in the response when it is None, so we need to add it
85
85
  if "content" not in response_json["choices"][0].get("message"):
@@ -153,6 +153,7 @@ def unpack_inner_thoughts_from_kwargs(choice: Choice, inner_thoughts_key: str) -
153
153
  return new_choice
154
154
  else:
155
155
  warnings.warn(f"Did not find inner thoughts in tool call: {str(tool_call)}")
156
+ return choice
156
157
 
157
158
  except json.JSONDecodeError as e:
158
159
  warnings.warn(f"Failed to strip inner thoughts from kwargs: {e}")
@@ -70,6 +70,10 @@ def retry_with_exponential_backoff(
70
70
  return func(*args, **kwargs)
71
71
 
72
72
  except requests.exceptions.HTTPError as http_err:
73
+
74
+ if not hasattr(http_err, "response") or not http_err.response:
75
+ raise
76
+
73
77
  # Retry on specified errors
74
78
  if http_err.response.status_code in error_codes:
75
79
  # Increment retries
@@ -115,7 +119,7 @@ def create(
115
119
  use_tool_naming: bool = True,
116
120
  # streaming?
117
121
  stream: bool = False,
118
- stream_inferface: Optional[Union[AgentRefreshStreamingInterface, AgentChunkStreamingInterface]] = None,
122
+ stream_interface: Optional[Union[AgentRefreshStreamingInterface, AgentChunkStreamingInterface]] = None,
119
123
  # TODO move to llm_config?
120
124
  # if unspecified (None), default to something we've tested
121
125
  inner_thoughts_in_kwargs_option: OptionState = OptionState.DEFAULT,
@@ -149,19 +153,19 @@ def create(
149
153
 
150
154
  if stream: # Client requested token streaming
151
155
  data.stream = True
152
- assert isinstance(stream_inferface, AgentChunkStreamingInterface) or isinstance(
153
- stream_inferface, AgentRefreshStreamingInterface
154
- ), type(stream_inferface)
156
+ assert isinstance(stream_interface, AgentChunkStreamingInterface) or isinstance(
157
+ stream_interface, AgentRefreshStreamingInterface
158
+ ), type(stream_interface)
155
159
  response = openai_chat_completions_process_stream(
156
160
  url=llm_config.model_endpoint, # https://api.openai.com/v1 -> https://api.openai.com/v1/chat/completions
157
161
  api_key=model_settings.openai_api_key,
158
162
  chat_completion_request=data,
159
- stream_inferface=stream_inferface,
163
+ stream_interface=stream_interface,
160
164
  )
161
165
  else: # Client did not request token streaming (expect a blocking backend response)
162
166
  data.stream = False
163
- if isinstance(stream_inferface, AgentChunkStreamingInterface):
164
- stream_inferface.stream_start()
167
+ if isinstance(stream_interface, AgentChunkStreamingInterface):
168
+ stream_interface.stream_start()
165
169
  try:
166
170
  response = openai_chat_completions_request(
167
171
  url=llm_config.model_endpoint, # https://api.openai.com/v1 -> https://api.openai.com/v1/chat/completions
@@ -169,8 +173,8 @@ def create(
169
173
  chat_completion_request=data,
170
174
  )
171
175
  finally:
172
- if isinstance(stream_inferface, AgentChunkStreamingInterface):
173
- stream_inferface.stream_end()
176
+ if isinstance(stream_interface, AgentChunkStreamingInterface):
177
+ stream_interface.stream_end()
174
178
 
175
179
  if inner_thoughts_in_kwargs:
176
180
  response = unpack_all_inner_thoughts_from_kwargs(response=response, inner_thoughts_key=INNER_THOUGHTS_KWARG)
@@ -317,8 +321,8 @@ def create(
317
321
  # They mention that none of the messages can have names, but it seems to not error out (for now)
318
322
 
319
323
  data.stream = False
320
- if isinstance(stream_inferface, AgentChunkStreamingInterface):
321
- stream_inferface.stream_start()
324
+ if isinstance(stream_interface, AgentChunkStreamingInterface):
325
+ stream_interface.stream_start()
322
326
  try:
323
327
  # groq uses the openai chat completions API, so this component should be reusable
324
328
  assert model_settings.groq_api_key is not None, "Groq key is missing"
@@ -328,8 +332,8 @@ def create(
328
332
  chat_completion_request=data,
329
333
  )
330
334
  finally:
331
- if isinstance(stream_inferface, AgentChunkStreamingInterface):
332
- stream_inferface.stream_end()
335
+ if isinstance(stream_interface, AgentChunkStreamingInterface):
336
+ stream_interface.stream_end()
333
337
 
334
338
  if inner_thoughts_in_kwargs:
335
339
  response = unpack_all_inner_thoughts_from_kwargs(response=response, inner_thoughts_key=INNER_THOUGHTS_KWARG)
@@ -61,6 +61,7 @@ def openai_get_model_list(
61
61
  headers["Authorization"] = f"Bearer {api_key}"
62
62
 
63
63
  printd(f"Sending request to {url}")
64
+ response = None
64
65
  try:
65
66
  # TODO add query param "tool" to be true
66
67
  response = requests.get(url, headers=headers, params=extra_params)
@@ -71,7 +72,8 @@ def openai_get_model_list(
71
72
  except requests.exceptions.HTTPError as http_err:
72
73
  # Handle HTTP errors (e.g., response 4XX, 5XX)
73
74
  try:
74
- response = response.json()
75
+ if response:
76
+ response = response.json()
75
77
  except:
76
78
  pass
77
79
  printd(f"Got HTTPError, exception={http_err}, response={response}")
@@ -79,7 +81,8 @@ def openai_get_model_list(
79
81
  except requests.exceptions.RequestException as req_err:
80
82
  # Handle other requests-related errors (e.g., connection error)
81
83
  try:
82
- response = response.json()
84
+ if response:
85
+ response = response.json()
83
86
  except:
84
87
  pass
85
88
  printd(f"Got RequestException, exception={req_err}, response={response}")
@@ -87,7 +90,8 @@ def openai_get_model_list(
87
90
  except Exception as e:
88
91
  # Handle other potential errors
89
92
  try:
90
- response = response.json()
93
+ if response:
94
+ response = response.json()
91
95
  except:
92
96
  pass
93
97
  printd(f"Got unknown Exception, exception={e}, response={response}")
@@ -157,7 +161,7 @@ def openai_chat_completions_process_stream(
157
161
  url: str,
158
162
  api_key: str,
159
163
  chat_completion_request: ChatCompletionRequest,
160
- stream_inferface: Optional[Union[AgentChunkStreamingInterface, AgentRefreshStreamingInterface]] = None,
164
+ stream_interface: Optional[Union[AgentChunkStreamingInterface, AgentRefreshStreamingInterface]] = None,
161
165
  create_message_id: bool = True,
162
166
  create_message_datetime: bool = True,
163
167
  ) -> ChatCompletionResponse:
@@ -167,7 +171,7 @@ def openai_chat_completions_process_stream(
167
171
  on the chunks received from the OpenAI-compatible server POST SSE response.
168
172
  """
169
173
  assert chat_completion_request.stream == True
170
- assert stream_inferface is not None, "Required"
174
+ assert stream_interface is not None, "Required"
171
175
 
172
176
  # Count the prompt tokens
173
177
  # TODO move to post-request?
@@ -220,8 +224,8 @@ def openai_chat_completions_process_stream(
220
224
  ),
221
225
  )
222
226
 
223
- if stream_inferface:
224
- stream_inferface.stream_start()
227
+ if stream_interface:
228
+ stream_interface.stream_start()
225
229
 
226
230
  n_chunks = 0 # approx == n_tokens
227
231
  try:
@@ -230,17 +234,17 @@ def openai_chat_completions_process_stream(
230
234
  ):
231
235
  assert isinstance(chat_completion_chunk, ChatCompletionChunkResponse), type(chat_completion_chunk)
232
236
 
233
- if stream_inferface:
234
- if isinstance(stream_inferface, AgentChunkStreamingInterface):
235
- stream_inferface.process_chunk(
237
+ if stream_interface:
238
+ if isinstance(stream_interface, AgentChunkStreamingInterface):
239
+ stream_interface.process_chunk(
236
240
  chat_completion_chunk,
237
241
  message_id=chat_completion_response.id if create_message_id else chat_completion_chunk.id,
238
242
  message_date=chat_completion_response.created if create_message_datetime else chat_completion_chunk.created,
239
243
  )
240
- elif isinstance(stream_inferface, AgentRefreshStreamingInterface):
241
- stream_inferface.process_refresh(chat_completion_response)
244
+ elif isinstance(stream_interface, AgentRefreshStreamingInterface):
245
+ stream_interface.process_refresh(chat_completion_response)
242
246
  else:
243
- raise TypeError(stream_inferface)
247
+ raise TypeError(stream_interface)
244
248
 
245
249
  if chunk_idx == 0:
246
250
  # initialize the choice objects which we will increment with the deltas
@@ -314,13 +318,13 @@ def openai_chat_completions_process_stream(
314
318
  n_chunks += 1
315
319
 
316
320
  except Exception as e:
317
- if stream_inferface:
318
- stream_inferface.stream_end()
321
+ if stream_interface:
322
+ stream_interface.stream_end()
319
323
  print(f"Parsing ChatCompletion stream failed with error:\n{str(e)}")
320
324
  raise e
321
325
  finally:
322
- if stream_inferface:
323
- stream_inferface.stream_end()
326
+ if stream_interface:
327
+ stream_interface.stream_end()
324
328
 
325
329
  # make sure we didn't leave temp stuff in
326
330
  assert all([c.finish_reason != TEMP_STREAM_FINISH_REASON for c in chat_completion_response.choices])
@@ -3,7 +3,7 @@ from urllib.parse import urljoin
3
3
  from letta.local_llm.settings.settings import get_completions_settings
4
4
  from letta.local_llm.utils import count_tokens, post_json_auth_request
5
5
 
6
- WEBUI_API_SUFFIX = "/v1/completions"
6
+ WEBUI_API_SUFFIX = "/completions"
7
7
 
8
8
 
9
9
  def get_vllm_completion(endpoint, auth_type, auth_key, model, prompt, context_window, user, grammar=None):
@@ -14,11 +14,10 @@ from sqlalchemy import (
14
14
  String,
15
15
  TypeDecorator,
16
16
  desc,
17
- func,
18
17
  )
19
- from sqlalchemy.orm import declarative_base
20
18
  from sqlalchemy.sql import func
21
19
 
20
+ from letta.base import Base
22
21
  from letta.config import LettaConfig
23
22
  from letta.schemas.agent import AgentState
24
23
  from letta.schemas.api_key import APIKey
@@ -28,6 +27,8 @@ from letta.schemas.enums import JobStatus
28
27
  from letta.schemas.job import Job
29
28
  from letta.schemas.llm_config import LLMConfig
30
29
  from letta.schemas.memory import Memory
30
+
31
+ # from letta.schemas.message import Message, Passage, Record, RecordType, ToolCall
31
32
  from letta.schemas.openai.chat_completions import ToolCall, ToolCallFunction
32
33
  from letta.schemas.organization import Organization
33
34
  from letta.schemas.source import Source
@@ -36,8 +37,6 @@ from letta.schemas.user import User
36
37
  from letta.settings import settings
37
38
  from letta.utils import enforce_types, get_utc_time, printd
38
39
 
39
- Base = declarative_base()
40
-
41
40
 
42
41
  class LLMConfigColumn(TypeDecorator):
43
42
  """Custom type for storing LLMConfig as JSON"""
@@ -14,14 +14,18 @@ from letta.schemas.llm_config import LLMConfig
14
14
 
15
15
  class Provider(BaseModel):
16
16
 
17
- def list_llm_models(self):
17
+ def list_llm_models(self) -> List[LLMConfig]:
18
18
  return []
19
19
 
20
- def list_embedding_models(self):
20
+ def list_embedding_models(self) -> List[EmbeddingConfig]:
21
21
  return []
22
22
 
23
- def get_model_context_window(self, model_name: str):
24
- pass
23
+ def get_model_context_window(self, model_name: str) -> Optional[int]:
24
+ raise NotImplementedError
25
+
26
+ def provider_tag(self) -> str:
27
+ """String representation of the provider for display purposes"""
28
+ raise NotImplementedError
25
29
 
26
30
 
27
31
  class LettaProvider(Provider):
@@ -162,7 +166,7 @@ class OllamaProvider(OpenAIProvider):
162
166
  )
163
167
  return configs
164
168
 
165
- def get_model_context_window(self, model_name: str):
169
+ def get_model_context_window(self, model_name: str) -> Optional[int]:
166
170
 
167
171
  import requests
168
172
 
@@ -310,7 +314,7 @@ class GoogleAIProvider(Provider):
310
314
  )
311
315
  return configs
312
316
 
313
- def get_model_context_window(self, model_name: str):
317
+ def get_model_context_window(self, model_name: str) -> Optional[int]:
314
318
  from letta.llm_api.google_ai import google_ai_get_model_context_window
315
319
 
316
320
  return google_ai_get_model_context_window(self.base_url, self.api_key, model_name)
@@ -371,16 +375,75 @@ class AzureProvider(Provider):
371
375
  )
372
376
  return configs
373
377
 
374
- def get_model_context_window(self, model_name: str):
378
+ def get_model_context_window(self, model_name: str) -> Optional[int]:
375
379
  """
376
380
  This is hardcoded for now, since there is no API endpoints to retrieve metadata for a model.
377
381
  """
378
382
  return AZURE_MODEL_TO_CONTEXT_LENGTH.get(model_name, 4096)
379
383
 
380
384
 
381
- class VLLMProvider(OpenAIProvider):
385
+ class VLLMChatCompletionsProvider(Provider):
386
+ """vLLM provider that treats vLLM as an OpenAI /chat/completions proxy"""
387
+
382
388
  # NOTE: vLLM only serves one model at a time (so could configure that through env variables)
383
- pass
389
+ name: str = "vllm"
390
+ base_url: str = Field(..., description="Base URL for the vLLM API.")
391
+
392
+ def list_llm_models(self) -> List[LLMConfig]:
393
+ # not supported with vLLM
394
+ from letta.llm_api.openai import openai_get_model_list
395
+
396
+ assert self.base_url, "base_url is required for vLLM provider"
397
+ response = openai_get_model_list(self.base_url, api_key=None)
398
+
399
+ configs = []
400
+ print(response)
401
+ for model in response["data"]:
402
+ configs.append(
403
+ LLMConfig(
404
+ model=model["id"],
405
+ model_endpoint_type="openai",
406
+ model_endpoint=self.base_url,
407
+ context_window=model["max_model_len"],
408
+ )
409
+ )
410
+ return configs
411
+
412
+ def list_embedding_models(self) -> List[EmbeddingConfig]:
413
+ # not supported with vLLM
414
+ return []
415
+
416
+
417
+ class VLLMCompletionsProvider(Provider):
418
+ """This uses /completions API as the backend, not /chat/completions, so we need to specify a model wrapper"""
419
+
420
+ # NOTE: vLLM only serves one model at a time (so could configure that through env variables)
421
+ name: str = "vllm"
422
+ base_url: str = Field(..., description="Base URL for the vLLM API.")
423
+ default_prompt_formatter: str = Field(..., description="Default prompt formatter (aka model wrapper)to use on vLLM /completions API.")
424
+
425
+ def list_llm_models(self) -> List[LLMConfig]:
426
+ # not supported with vLLM
427
+ from letta.llm_api.openai import openai_get_model_list
428
+
429
+ response = openai_get_model_list(self.base_url, api_key=None)
430
+
431
+ configs = []
432
+ for model in response["data"]:
433
+ configs.append(
434
+ LLMConfig(
435
+ model=model["id"],
436
+ model_endpoint_type="vllm",
437
+ model_endpoint=self.base_url,
438
+ model_wrapper=self.default_prompt_formatter,
439
+ context_window=model["max_model_len"],
440
+ )
441
+ )
442
+ return configs
443
+
444
+ def list_embedding_models(self) -> List[EmbeddingConfig]:
445
+ # not supported with vLLM
446
+ return []
384
447
 
385
448
 
386
449
  class CohereProvider(OpenAIProvider):
@@ -52,3 +52,10 @@ class EmbeddingConfig(BaseModel):
52
52
  )
53
53
  else:
54
54
  raise ValueError(f"Model {model_name} not supported.")
55
+
56
+ def pretty_print(self) -> str:
57
+ return (
58
+ f"{self.embedding_model}"
59
+ + (f" [type={self.embedding_endpoint_type}]" if self.embedding_endpoint_type else "")
60
+ + (f" [ip={self.embedding_endpoint}]" if self.embedding_endpoint else "")
61
+ )
@@ -68,3 +68,10 @@ class LLMConfig(BaseModel):
68
68
  )
69
69
  else:
70
70
  raise ValueError(f"Model {model_name} not supported.")
71
+
72
+ def pretty_print(self) -> str:
73
+ return (
74
+ f"{self.model}"
75
+ + (f" [type={self.model_endpoint_type}]" if self.model_endpoint_type else "")
76
+ + (f" [ip={self.model_endpoint}]" if self.model_endpoint else "")
77
+ )
@@ -14,8 +14,8 @@ import letta.constants as constants
14
14
  import letta.server.utils as server_utils
15
15
  import letta.system as system
16
16
  from letta.agent import Agent, save_agent
17
+ from letta.agent_store.db import attach_base
17
18
  from letta.agent_store.storage import StorageConnector, TableType
18
- from letta.config import LettaConfig
19
19
  from letta.credentials import LettaCredentials
20
20
  from letta.data_sources.connectors import DataConnector, load_data
21
21
 
@@ -41,7 +41,7 @@ from letta.interface import AgentInterface # abstract
41
41
  from letta.interface import CLIInterface # for printing to terminal
42
42
  from letta.log import get_logger
43
43
  from letta.memory import get_memory_functions
44
- from letta.metadata import MetadataStore
44
+ from letta.metadata import Base, MetadataStore
45
45
  from letta.prompts import gpt_system
46
46
  from letta.providers import (
47
47
  AnthropicProvider,
@@ -51,7 +51,8 @@ from letta.providers import (
51
51
  OllamaProvider,
52
52
  OpenAIProvider,
53
53
  Provider,
54
- VLLMProvider,
54
+ VLLMChatCompletionsProvider,
55
+ VLLMCompletionsProvider,
55
56
  )
56
57
  from letta.schemas.agent import AgentState, AgentType, CreateAgent, UpdateAgentState
57
58
  from letta.schemas.api_key import APIKey, APIKeyCreate
@@ -150,23 +151,11 @@ class Server(object):
150
151
 
151
152
 
152
153
  from sqlalchemy import create_engine
153
- from sqlalchemy.orm import declarative_base, sessionmaker
154
+ from sqlalchemy.orm import sessionmaker
154
155
 
155
- from letta.agent_store.db import MessageModel, PassageModel
156
156
  from letta.config import LettaConfig
157
157
 
158
158
  # NOTE: hack to see if single session management works
159
- from letta.metadata import (
160
- AgentModel,
161
- AgentSourceMappingModel,
162
- APIKeyModel,
163
- BlockModel,
164
- JobModel,
165
- OrganizationModel,
166
- SourceModel,
167
- ToolModel,
168
- UserModel,
169
- )
170
159
  from letta.settings import model_settings, settings
171
160
 
172
161
  config = LettaConfig.load()
@@ -183,24 +172,12 @@ else:
183
172
  # TODO: don't rely on config storage
184
173
  engine = create_engine("sqlite:///" + os.path.join(config.recall_storage_path, "sqlite.db"))
185
174
 
186
- Base = declarative_base()
175
+
187
176
  SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
188
- Base.metadata.create_all(
189
- engine,
190
- tables=[
191
- UserModel.__table__,
192
- AgentModel.__table__,
193
- SourceModel.__table__,
194
- AgentSourceMappingModel.__table__,
195
- APIKeyModel.__table__,
196
- BlockModel.__table__,
197
- ToolModel.__table__,
198
- JobModel.__table__,
199
- PassageModel.__table__,
200
- MessageModel.__table__,
201
- OrganizationModel.__table__,
202
- ],
203
- )
177
+
178
+ attach_base()
179
+
180
+ Base.metadata.create_all(bind=engine)
204
181
 
205
182
 
206
183
  # Dependency
@@ -268,12 +245,11 @@ class SyncServer(Server):
268
245
  if model_settings.anthropic_api_key:
269
246
  self._enabled_providers.append(AnthropicProvider(api_key=model_settings.anthropic_api_key))
270
247
  if model_settings.ollama_base_url:
271
- self._enabled_providers.append(OllamaProvider(base_url=model_settings.ollama_base_url))
272
- if model_settings.vllm_base_url:
273
- self._enabled_providers.append(VLLMProvider(base_url=model_settings.vllm_base_url))
248
+ self._enabled_providers.append(OllamaProvider(base_url=model_settings.ollama_base_url, api_key=None))
274
249
  if model_settings.gemini_api_key:
275
250
  self._enabled_providers.append(GoogleAIProvider(api_key=model_settings.gemini_api_key))
276
251
  if model_settings.azure_api_key and model_settings.azure_base_url:
252
+ assert model_settings.azure_api_version, "AZURE_API_VERSION is required"
277
253
  self._enabled_providers.append(
278
254
  AzureProvider(
279
255
  api_key=model_settings.azure_api_key,
@@ -281,6 +257,18 @@ class SyncServer(Server):
281
257
  api_version=model_settings.azure_api_version,
282
258
  )
283
259
  )
260
+ if model_settings.vllm_api_base:
261
+ # vLLM exposes both a /chat/completions and a /completions endpoint
262
+ self._enabled_providers.append(
263
+ VLLMCompletionsProvider(
264
+ base_url=model_settings.vllm_api_base,
265
+ default_prompt_formatter=model_settings.default_prompt_formatter,
266
+ )
267
+ )
268
+ # NOTE: to use the /chat/completions endpoint, you need to specify extra flags on vLLM startup
269
+ # see: https://docs.vllm.ai/en/latest/getting_started/examples/openai_chat_completion_client_with_tools.html
270
+ # e.g. "... --enable-auto-tool-choice --tool-call-parser hermes"
271
+ self._enabled_providers.append(VLLMChatCompletionsProvider(base_url=model_settings.vllm_api_base))
284
272
 
285
273
  def save_agents(self):
286
274
  """Saves all the agents that are in the in-memory object store"""
@@ -4,14 +4,20 @@ from typing import Optional
4
4
  from pydantic import Field
5
5
  from pydantic_settings import BaseSettings, SettingsConfigDict
6
6
 
7
+ from letta.local_llm.constants import DEFAULT_WRAPPER_NAME
8
+
7
9
 
8
10
  class ModelSettings(BaseSettings):
9
11
 
10
12
  # env_prefix='my_prefix_'
11
13
 
14
+ # when we use /completions APIs (instead of /chat/completions), we need to specify a model wrapper
15
+ # the "model wrapper" is responsible for prompt formatting and function calling parsing
16
+ default_prompt_formatter: str = DEFAULT_WRAPPER_NAME
17
+
12
18
  # openai
13
19
  openai_api_key: Optional[str] = None
14
- openai_api_base: Optional[str] = "https://api.openai.com/v1"
20
+ openai_api_base: str = "https://api.openai.com/v1"
15
21
 
16
22
  # groq
17
23
  groq_api_key: Optional[str] = None
@@ -25,13 +31,16 @@ class ModelSettings(BaseSettings):
25
31
  # azure
26
32
  azure_api_key: Optional[str] = None
27
33
  azure_base_url: Optional[str] = None
28
- azure_api_version: Optional[str] = None
34
+ # We provide a default here, since usually people will want to be on the latest API version.
35
+ azure_api_version: Optional[str] = (
36
+ "2024-09-01-preview" # https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation
37
+ )
29
38
 
30
39
  # google ai
31
40
  gemini_api_key: Optional[str] = None
32
41
 
33
42
  # vLLM
34
- vllm_base_url: Optional[str] = None
43
+ vllm_api_base: Optional[str] = None
35
44
 
36
45
  # openllm
37
46
  openllm_auth_type: Optional[str] = None