letta-nightly 0.4.1.dev20241011104054__tar.gz → 0.4.1.dev20241013104006__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.dev20241013104006}/PKG-INFO +2 -1
  2. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/agent.py +1 -1
  3. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/agent_store/db.py +8 -2
  4. letta_nightly-0.4.1.dev20241013104006/letta/base.py +3 -0
  5. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/cli/cli.py +2 -18
  6. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/azure_openai.py +1 -1
  7. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/helpers.py +1 -0
  8. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/llm_api_tools.py +17 -13
  9. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/openai.py +21 -17
  10. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/chat_completion_proxy.py +1 -3
  11. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/vllm/api.py +1 -1
  12. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/metadata.py +3 -4
  13. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/providers.py +93 -9
  14. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/embedding_config.py +7 -0
  15. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/llm_config.py +7 -0
  16. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/server.py +51 -40
  17. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/settings.py +12 -3
  18. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/pyproject.toml +2 -1
  19. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/LICENSE +0 -0
  20. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/README.md +0 -0
  21. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/__init__.py +0 -0
  22. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/__main__.py +0 -0
  23. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/agent_store/chroma.py +0 -0
  24. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/agent_store/lancedb.py +0 -0
  25. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/agent_store/milvus.py +0 -0
  26. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/agent_store/qdrant.py +0 -0
  27. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/agent_store/storage.py +0 -0
  28. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/benchmark/benchmark.py +0 -0
  29. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/benchmark/constants.py +0 -0
  30. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/cli/cli_config.py +0 -0
  31. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/cli/cli_load.py +0 -0
  32. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/client/__init__.py +0 -0
  33. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/client/admin.py +0 -0
  34. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/client/client.py +0 -0
  35. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/client/streaming.py +0 -0
  36. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/client/utils.py +0 -0
  37. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/config.py +0 -0
  38. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/constants.py +0 -0
  39. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/credentials.py +0 -0
  40. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/data_sources/connectors.py +0 -0
  41. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/embeddings.py +0 -0
  42. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/errors.py +0 -0
  43. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/functions/__init__.py +0 -0
  44. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/functions/function_sets/base.py +0 -0
  45. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/functions/function_sets/extras.py +0 -0
  46. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/functions/functions.py +0 -0
  47. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/functions/helpers.py +0 -0
  48. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/functions/schema_generator.py +0 -0
  49. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/humans/__init__.py +0 -0
  50. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/humans/examples/basic.txt +0 -0
  51. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/humans/examples/cs_phd.txt +0 -0
  52. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/interface.py +0 -0
  53. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/__init__.py +0 -0
  54. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/anthropic.py +0 -0
  55. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/azure_openai_constants.py +0 -0
  56. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/cohere.py +0 -0
  57. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/llm_api/google_ai.py +0 -0
  58. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/README.md +0 -0
  59. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/__init__.py +0 -0
  60. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/constants.py +0 -0
  61. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/function_parser.py +0 -0
  62. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/grammars/__init__.py +0 -0
  63. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
  64. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/grammars/json.gbnf +0 -0
  65. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/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.dev20241013104006}/letta/local_llm/json_parser.py +0 -0
  67. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/koboldcpp/api.py +0 -0
  68. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/koboldcpp/settings.py +0 -0
  69. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llamacpp/api.py +0 -0
  70. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llamacpp/settings.py +0 -0
  71. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
  72. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
  73. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
  74. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
  75. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
  76. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
  77. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/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.dev20241013104006}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
  79. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
  80. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/lmstudio/api.py +0 -0
  81. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/lmstudio/settings.py +0 -0
  82. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/ollama/api.py +0 -0
  83. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/ollama/settings.py +0 -0
  84. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/settings/__init__.py +0 -0
  85. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
  86. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/settings/settings.py +0 -0
  87. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/settings/simple.py +0 -0
  88. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/utils.py +0 -0
  89. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/webui/api.py +0 -0
  90. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/webui/legacy_api.py +0 -0
  91. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/webui/legacy_settings.py +0 -0
  92. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/local_llm/webui/settings.py +0 -0
  93. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/log.py +0 -0
  94. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/main.py +0 -0
  95. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/memory.py +0 -0
  96. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/openai_backcompat/__init__.py +0 -0
  97. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/openai_backcompat/openai_object.py +0 -0
  98. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/persistence_manager.py +0 -0
  99. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/__init__.py +0 -0
  100. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/examples/anna_pa.txt +0 -0
  101. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/examples/google_search_persona.txt +0 -0
  102. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/examples/memgpt_doc.txt +0 -0
  103. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/examples/memgpt_starter.txt +0 -0
  104. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/examples/sam.txt +0 -0
  105. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/examples/sam_pov.txt +0 -0
  106. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
  107. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/personas/examples/sqldb/test.db +0 -0
  108. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/__init__.py +0 -0
  109. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/gpt_summarize.py +0 -0
  110. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/gpt_system.py +0 -0
  111. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/system/memgpt_base.txt +0 -0
  112. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/system/memgpt_chat.txt +0 -0
  113. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
  114. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
  115. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/system/memgpt_doc.txt +0 -0
  116. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
  117. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
  118. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
  119. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/pytest.ini +0 -0
  120. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/agent.py +0 -0
  121. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/api_key.py +0 -0
  122. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/block.py +0 -0
  123. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/document.py +0 -0
  124. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/enums.py +0 -0
  125. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/health.py +0 -0
  126. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/job.py +0 -0
  127. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/letta_base.py +0 -0
  128. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/letta_message.py +0 -0
  129. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/letta_request.py +0 -0
  130. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/letta_response.py +0 -0
  131. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/memory.py +0 -0
  132. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/message.py +0 -0
  133. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/openai/chat_completion_request.py +0 -0
  134. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/openai/chat_completion_response.py +0 -0
  135. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/openai/chat_completions.py +0 -0
  136. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/openai/embedding_response.py +0 -0
  137. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/openai/openai.py +0 -0
  138. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/organization.py +0 -0
  139. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/passage.py +0 -0
  140. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/source.py +0 -0
  141. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/tool.py +0 -0
  142. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/usage.py +0 -0
  143. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/schemas/user.py +0 -0
  144. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/__init__.py +0 -0
  145. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/constants.py +0 -0
  146. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/__init__.py +0 -0
  147. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/admin/__init__.py +0 -0
  148. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/admin/agents.py +0 -0
  149. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/admin/tools.py +0 -0
  150. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/admin/users.py +0 -0
  151. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/app.py +0 -0
  152. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/auth/__init__.py +0 -0
  153. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/auth/index.py +0 -0
  154. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/auth_token.py +0 -0
  155. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/interface.py +0 -0
  156. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/__init__.py +0 -0
  157. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/openai/__init__.py +0 -0
  158. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
  159. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
  160. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
  161. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
  162. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
  163. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/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.dev20241013104006}/letta/server/rest_api/routers/v1/__init__.py +0 -0
  165. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/agents.py +0 -0
  166. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/blocks.py +0 -0
  167. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/health.py +0 -0
  168. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/jobs.py +0 -0
  169. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/llms.py +0 -0
  170. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/organizations.py +0 -0
  171. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/sources.py +0 -0
  172. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/tools.py +0 -0
  173. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/routers/v1/users.py +0 -0
  174. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/static_files.py +0 -0
  175. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/rest_api/utils.py +0 -0
  176. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/startup.sh +0 -0
  177. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
  178. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/static_files/assets/index-9a9c449b.js +0 -0
  179. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/static_files/favicon.ico +0 -0
  180. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/static_files/index.html +0 -0
  181. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
  182. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/utils.py +0 -0
  183. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/ws_api/__init__.py +0 -0
  184. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/ws_api/example_client.py +0 -0
  185. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/ws_api/interface.py +0 -0
  186. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/ws_api/protocol.py +0 -0
  187. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/server/ws_api/server.py +0 -0
  188. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/streaming_interface.py +0 -0
  189. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/letta/system.py +0 -0
  190. {letta_nightly-0.4.1.dev20241011104054 → letta_nightly-0.4.1.dev20241013104006}/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.dev20241013104006
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])
@@ -85,9 +85,7 @@ def get_chat_completion(
85
85
  elif wrapper is None:
86
86
  # Warn the user that we're using the fallback
87
87
  if not has_shown_warning:
88
- print(
89
- f"{CLI_WARNING_PREFIX}no wrapper specified for local LLM, using the default wrapper (you can remove this warning by specifying the wrapper with --model-wrapper)"
90
- )
88
+ print(f"{CLI_WARNING_PREFIX}no prompt formatter specified for local LLM, using the default formatter")
91
89
  has_shown_warning = True
92
90
 
93
91
  llm_wrapper = DEFAULT_WRAPPER()
@@ -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):
@@ -136,9 +140,17 @@ class AnthropicProvider(Provider):
136
140
 
137
141
 
138
142
  class OllamaProvider(OpenAIProvider):
143
+ """Ollama provider that uses the native /api/generate endpoint
144
+
145
+ See: https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-completion
146
+ """
147
+
139
148
  name: str = "ollama"
140
149
  base_url: str = Field(..., description="Base URL for the Ollama API.")
141
150
  api_key: Optional[str] = Field(None, description="API key for the Ollama API (default: `None`).")
151
+ default_prompt_formatter: str = Field(
152
+ ..., description="Default prompt formatter (aka model wrapper) to use on a /completions style API."
153
+ )
142
154
 
143
155
  def list_llm_models(self) -> List[LLMConfig]:
144
156
  # https://github.com/ollama/ollama/blob/main/docs/api.md#list-local-models
@@ -152,17 +164,21 @@ class OllamaProvider(OpenAIProvider):
152
164
  configs = []
153
165
  for model in response_json["models"]:
154
166
  context_window = self.get_model_context_window(model["name"])
167
+ if context_window is None:
168
+ print(f"Ollama model {model['name']} has no context window")
169
+ continue
155
170
  configs.append(
156
171
  LLMConfig(
157
172
  model=model["name"],
158
173
  model_endpoint_type="ollama",
159
174
  model_endpoint=self.base_url,
175
+ model_wrapper=self.default_prompt_formatter,
160
176
  context_window=context_window,
161
177
  )
162
178
  )
163
179
  return configs
164
180
 
165
- def get_model_context_window(self, model_name: str):
181
+ def get_model_context_window(self, model_name: str) -> Optional[int]:
166
182
 
167
183
  import requests
168
184
 
@@ -188,6 +204,10 @@ class OllamaProvider(OpenAIProvider):
188
204
  # ]
189
205
  # max_position_embeddings
190
206
  # parse model cards: nous, dolphon, llama
207
+ if "model_info" not in response_json:
208
+ if "error" in response_json:
209
+ print(f"Ollama fetch model info error for {model_name}: {response_json['error']}")
210
+ return None
191
211
  for key, value in response_json["model_info"].items():
192
212
  if "context_length" in key:
193
213
  return value
@@ -198,6 +218,10 @@ class OllamaProvider(OpenAIProvider):
198
218
 
199
219
  response = requests.post(f"{self.base_url}/api/show", json={"name": model_name, "verbose": True})
200
220
  response_json = response.json()
221
+ if "model_info" not in response_json:
222
+ if "error" in response_json:
223
+ print(f"Ollama fetch model info error for {model_name}: {response_json['error']}")
224
+ return None
201
225
  for key, value in response_json["model_info"].items():
202
226
  if "embedding_length" in key:
203
227
  return value
@@ -216,6 +240,7 @@ class OllamaProvider(OpenAIProvider):
216
240
  for model in response_json["models"]:
217
241
  embedding_dim = self.get_model_embedding_dim(model["name"])
218
242
  if not embedding_dim:
243
+ print(f"Ollama model {model['name']} has no embedding dimension")
219
244
  continue
220
245
  configs.append(
221
246
  EmbeddingConfig(
@@ -310,7 +335,7 @@ class GoogleAIProvider(Provider):
310
335
  )
311
336
  return configs
312
337
 
313
- def get_model_context_window(self, model_name: str):
338
+ def get_model_context_window(self, model_name: str) -> Optional[int]:
314
339
  from letta.llm_api.google_ai import google_ai_get_model_context_window
315
340
 
316
341
  return google_ai_get_model_context_window(self.base_url, self.api_key, model_name)
@@ -371,16 +396,75 @@ class AzureProvider(Provider):
371
396
  )
372
397
  return configs
373
398
 
374
- def get_model_context_window(self, model_name: str):
399
+ def get_model_context_window(self, model_name: str) -> Optional[int]:
375
400
  """
376
401
  This is hardcoded for now, since there is no API endpoints to retrieve metadata for a model.
377
402
  """
378
403
  return AZURE_MODEL_TO_CONTEXT_LENGTH.get(model_name, 4096)
379
404
 
380
405
 
381
- class VLLMProvider(OpenAIProvider):
406
+ class VLLMChatCompletionsProvider(Provider):
407
+ """vLLM provider that treats vLLM as an OpenAI /chat/completions proxy"""
408
+
382
409
  # NOTE: vLLM only serves one model at a time (so could configure that through env variables)
383
- pass
410
+ name: str = "vllm"
411
+ base_url: str = Field(..., description="Base URL for the vLLM API.")
412
+
413
+ def list_llm_models(self) -> List[LLMConfig]:
414
+ # not supported with vLLM
415
+ from letta.llm_api.openai import openai_get_model_list
416
+
417
+ assert self.base_url, "base_url is required for vLLM provider"
418
+ response = openai_get_model_list(self.base_url, api_key=None)
419
+
420
+ configs = []
421
+ print(response)
422
+ for model in response["data"]:
423
+ configs.append(
424
+ LLMConfig(
425
+ model=model["id"],
426
+ model_endpoint_type="openai",
427
+ model_endpoint=self.base_url,
428
+ context_window=model["max_model_len"],
429
+ )
430
+ )
431
+ return configs
432
+
433
+ def list_embedding_models(self) -> List[EmbeddingConfig]:
434
+ # not supported with vLLM
435
+ return []
436
+
437
+
438
+ class VLLMCompletionsProvider(Provider):
439
+ """This uses /completions API as the backend, not /chat/completions, so we need to specify a model wrapper"""
440
+
441
+ # NOTE: vLLM only serves one model at a time (so could configure that through env variables)
442
+ name: str = "vllm"
443
+ base_url: str = Field(..., description="Base URL for the vLLM API.")
444
+ default_prompt_formatter: str = Field(..., description="Default prompt formatter (aka model wrapper) to use on vLLM /completions API.")
445
+
446
+ def list_llm_models(self) -> List[LLMConfig]:
447
+ # not supported with vLLM
448
+ from letta.llm_api.openai import openai_get_model_list
449
+
450
+ response = openai_get_model_list(self.base_url, api_key=None)
451
+
452
+ configs = []
453
+ for model in response["data"]:
454
+ configs.append(
455
+ LLMConfig(
456
+ model=model["id"],
457
+ model_endpoint_type="vllm",
458
+ model_endpoint=self.base_url,
459
+ model_wrapper=self.default_prompt_formatter,
460
+ context_window=model["max_model_len"],
461
+ )
462
+ )
463
+ return configs
464
+
465
+ def list_embedding_models(self) -> List[EmbeddingConfig]:
466
+ # not supported with vLLM
467
+ return []
384
468
 
385
469
 
386
470
  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
+ )