letta-nightly 0.4.1.dev20241010104112__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.
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/PKG-INFO +2 -1
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/agent.py +1 -1
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/db.py +8 -2
- letta_nightly-0.4.1.dev20241012104008/letta/base.py +3 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/cli/cli.py +9 -2
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/constants.py +21 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/azure_openai.py +1 -1
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/helpers.py +1 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/llm_api_tools.py +17 -13
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/openai.py +26 -19
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/vllm/api.py +1 -1
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/metadata.py +3 -4
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/providers.py +94 -14
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/embedding_config.py +7 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/llm_config.py +7 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/server.py +27 -38
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/settings.py +12 -3
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/pyproject.toml +2 -1
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/LICENSE +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/README.md +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/__main__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/chroma.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/lancedb.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/milvus.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/qdrant.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/agent_store/storage.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/benchmark/benchmark.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/benchmark/constants.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/cli/cli_config.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/cli/cli_load.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/client/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/client/admin.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/client/client.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/client/streaming.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/client/utils.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/config.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/credentials.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/data_sources/connectors.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/embeddings.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/errors.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/function_sets/base.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/function_sets/extras.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/functions.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/helpers.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/functions/schema_generator.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/humans/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/humans/examples/basic.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/humans/examples/cs_phd.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/interface.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/anthropic.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/azure_openai_constants.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/cohere.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/llm_api/google_ai.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/README.md +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/chat_completion_proxy.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/constants.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/function_parser.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/grammars/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/grammars/gbnf_grammar_generator.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/grammars/json.gbnf +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/grammars/json_func_calls_with_inner_thoughts.gbnf +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/json_parser.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/koboldcpp/api.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/koboldcpp/settings.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llamacpp/api.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llamacpp/settings.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/airoboros.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/chatml.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/dolphin.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/llama3.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/simple_summary_wrapper.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/wrapper_base.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/llm_chat_completion_wrappers/zephyr.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/lmstudio/api.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/lmstudio/settings.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/ollama/api.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/ollama/settings.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/settings/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/settings/deterministic_mirostat.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/settings/settings.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/settings/simple.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/utils.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/webui/api.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/webui/legacy_api.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/webui/legacy_settings.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/local_llm/webui/settings.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/log.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/main.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/memory.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/openai_backcompat/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/openai_backcompat/openai_object.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/persistence_manager.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/anna_pa.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/google_search_persona.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/memgpt_doc.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/memgpt_starter.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/sam.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/sam_pov.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/sam_simple_pov_gpt35.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/personas/examples/sqldb/test.db +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/gpt_summarize.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/gpt_system.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_base.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_chat.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_chat_compressed.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_chat_fstring.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_doc.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_gpt35_extralong.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_intuitive_knowledge.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/prompts/system/memgpt_modified_chat.txt +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/pytest.ini +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/agent.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/api_key.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/block.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/document.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/enums.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/health.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/job.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/letta_base.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/letta_message.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/letta_request.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/letta_response.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/memory.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/message.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/chat_completion_request.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/chat_completion_response.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/chat_completions.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/embedding_response.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/openai/openai.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/organization.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/passage.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/source.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/tool.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/usage.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/schemas/user.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/constants.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/admin/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/admin/agents.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/admin/tools.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/admin/users.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/app.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/auth/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/auth/index.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/auth_token.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/interface.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/assistants/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/assistants/assistants.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/assistants/schemas.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/assistants/threads.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/chat_completions/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/agents.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/blocks.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/health.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/jobs.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/llms.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/organizations.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/sources.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/tools.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/routers/v1/users.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/static_files.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/rest_api/utils.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/startup.sh +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/assets/index-3ab03d5b.css +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/assets/index-9a9c449b.js +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/favicon.ico +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/index.html +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/static_files/memgpt_logo_transparent.png +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/utils.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/__init__.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/example_client.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/interface.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/protocol.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/server/ws_api/server.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/streaming_interface.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/system.py +0 -0
- {letta_nightly-0.4.1.dev20241010104112 → 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.
|
|
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)
|
{letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/agent.py
RENAMED
|
@@ -481,7 +481,7 @@ class Agent(BaseAgent):
|
|
|
481
481
|
first_message=first_message,
|
|
482
482
|
# streaming
|
|
483
483
|
stream=stream,
|
|
484
|
-
|
|
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
|
|
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...")
|
{letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/cli/cli.py
RENAMED
|
@@ -233,25 +233,32 @@ def run(
|
|
|
233
233
|
# choose from list of llm_configs
|
|
234
234
|
llm_configs = client.list_llm_configs()
|
|
235
235
|
llm_options = [llm_config.model 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]
|
|
237
|
+
|
|
236
238
|
# select model
|
|
237
239
|
if len(llm_options) == 0:
|
|
238
240
|
raise ValueError("No LLM models found. Please enable a provider.")
|
|
239
241
|
elif len(llm_options) == 1:
|
|
240
242
|
llm_model_name = llm_options[0]
|
|
241
243
|
else:
|
|
242
|
-
llm_model_name = questionary.select("Select LLM model:", choices=
|
|
244
|
+
llm_model_name = questionary.select("Select LLM model:", choices=llm_choices).ask().model
|
|
243
245
|
llm_config = [llm_config for llm_config in llm_configs if llm_config.model == llm_model_name][0]
|
|
244
246
|
|
|
245
247
|
# choose form list of embedding configs
|
|
246
248
|
embedding_configs = client.list_embedding_configs()
|
|
247
249
|
embedding_options = [embedding_config.embedding_model for embedding_config in embedding_configs]
|
|
250
|
+
|
|
251
|
+
embedding_choices = [
|
|
252
|
+
questionary.Choice(title=embedding_config.pretty_print(), value=embedding_config) for embedding_config in embedding_configs
|
|
253
|
+
]
|
|
254
|
+
|
|
248
255
|
# select model
|
|
249
256
|
if len(embedding_options) == 0:
|
|
250
257
|
raise ValueError("No embedding models found. Please enable a provider.")
|
|
251
258
|
elif len(embedding_options) == 1:
|
|
252
259
|
embedding_model_name = embedding_options[0]
|
|
253
260
|
else:
|
|
254
|
-
embedding_model_name = questionary.select("Select embedding model:", choices=
|
|
261
|
+
embedding_model_name = questionary.select("Select embedding model:", choices=embedding_choices).ask().embedding_model
|
|
255
262
|
embedding_config = [
|
|
256
263
|
embedding_config for embedding_config in embedding_configs if embedding_config.embedding_model == embedding_model_name
|
|
257
264
|
][0]
|
{letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/constants.py
RENAMED
|
@@ -75,6 +75,27 @@ NON_USER_MSG_PREFIX = "[This is an automated system message hidden from the user
|
|
|
75
75
|
LLM_MAX_TOKENS = {
|
|
76
76
|
"DEFAULT": 8192,
|
|
77
77
|
## OpenAI models: https://platform.openai.com/docs/models/overview
|
|
78
|
+
# "o1-preview
|
|
79
|
+
"chatgpt-4o-latest": 128000,
|
|
80
|
+
# "o1-preview-2024-09-12
|
|
81
|
+
"gpt-4o-2024-08-06": 128000,
|
|
82
|
+
"gpt-4-turbo-preview": 128000,
|
|
83
|
+
"gpt-4o": 128000,
|
|
84
|
+
"gpt-3.5-turbo-instruct": 16385,
|
|
85
|
+
"gpt-4-0125-preview": 128000,
|
|
86
|
+
"gpt-3.5-turbo-0125": 16385,
|
|
87
|
+
# "babbage-002": 128000,
|
|
88
|
+
# "davinci-002": 128000,
|
|
89
|
+
"gpt-4-turbo-2024-04-09": 128000,
|
|
90
|
+
# "gpt-4o-realtime-preview-2024-10-01
|
|
91
|
+
"gpt-4-turbo": 8192,
|
|
92
|
+
"gpt-4o-2024-05-13": 128000,
|
|
93
|
+
# "o1-mini
|
|
94
|
+
# "o1-mini-2024-09-12
|
|
95
|
+
# "gpt-3.5-turbo-instruct-0914
|
|
96
|
+
"gpt-4o-mini": 128000,
|
|
97
|
+
# "gpt-4o-realtime-preview
|
|
98
|
+
"gpt-4o-mini-2024-07-18": 128000,
|
|
78
99
|
# gpt-4
|
|
79
100
|
"gpt-4-1106-preview": 128000,
|
|
80
101
|
"gpt-4": 8192,
|
|
@@ -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.
|
|
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
|
-
|
|
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(
|
|
153
|
-
|
|
154
|
-
), type(
|
|
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
|
-
|
|
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(
|
|
164
|
-
|
|
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(
|
|
173
|
-
|
|
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(
|
|
321
|
-
|
|
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(
|
|
332
|
-
|
|
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)
|
|
@@ -41,7 +41,9 @@ from letta.utils import smart_urljoin
|
|
|
41
41
|
OPENAI_SSE_DONE = "[DONE]"
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def openai_get_model_list(
|
|
44
|
+
def openai_get_model_list(
|
|
45
|
+
url: str, api_key: Union[str, None], fix_url: Optional[bool] = False, extra_params: Optional[dict] = None
|
|
46
|
+
) -> dict:
|
|
45
47
|
"""https://platform.openai.com/docs/api-reference/models/list"""
|
|
46
48
|
from letta.utils import printd
|
|
47
49
|
|
|
@@ -59,8 +61,10 @@ def openai_get_model_list(url: str, api_key: Union[str, None], fix_url: Optional
|
|
|
59
61
|
headers["Authorization"] = f"Bearer {api_key}"
|
|
60
62
|
|
|
61
63
|
printd(f"Sending request to {url}")
|
|
64
|
+
response = None
|
|
62
65
|
try:
|
|
63
|
-
|
|
66
|
+
# TODO add query param "tool" to be true
|
|
67
|
+
response = requests.get(url, headers=headers, params=extra_params)
|
|
64
68
|
response.raise_for_status() # Raises HTTPError for 4XX/5XX status
|
|
65
69
|
response = response.json() # convert to dict from string
|
|
66
70
|
printd(f"response = {response}")
|
|
@@ -68,7 +72,8 @@ def openai_get_model_list(url: str, api_key: Union[str, None], fix_url: Optional
|
|
|
68
72
|
except requests.exceptions.HTTPError as http_err:
|
|
69
73
|
# Handle HTTP errors (e.g., response 4XX, 5XX)
|
|
70
74
|
try:
|
|
71
|
-
|
|
75
|
+
if response:
|
|
76
|
+
response = response.json()
|
|
72
77
|
except:
|
|
73
78
|
pass
|
|
74
79
|
printd(f"Got HTTPError, exception={http_err}, response={response}")
|
|
@@ -76,7 +81,8 @@ def openai_get_model_list(url: str, api_key: Union[str, None], fix_url: Optional
|
|
|
76
81
|
except requests.exceptions.RequestException as req_err:
|
|
77
82
|
# Handle other requests-related errors (e.g., connection error)
|
|
78
83
|
try:
|
|
79
|
-
|
|
84
|
+
if response:
|
|
85
|
+
response = response.json()
|
|
80
86
|
except:
|
|
81
87
|
pass
|
|
82
88
|
printd(f"Got RequestException, exception={req_err}, response={response}")
|
|
@@ -84,7 +90,8 @@ def openai_get_model_list(url: str, api_key: Union[str, None], fix_url: Optional
|
|
|
84
90
|
except Exception as e:
|
|
85
91
|
# Handle other potential errors
|
|
86
92
|
try:
|
|
87
|
-
|
|
93
|
+
if response:
|
|
94
|
+
response = response.json()
|
|
88
95
|
except:
|
|
89
96
|
pass
|
|
90
97
|
printd(f"Got unknown Exception, exception={e}, response={response}")
|
|
@@ -154,7 +161,7 @@ def openai_chat_completions_process_stream(
|
|
|
154
161
|
url: str,
|
|
155
162
|
api_key: str,
|
|
156
163
|
chat_completion_request: ChatCompletionRequest,
|
|
157
|
-
|
|
164
|
+
stream_interface: Optional[Union[AgentChunkStreamingInterface, AgentRefreshStreamingInterface]] = None,
|
|
158
165
|
create_message_id: bool = True,
|
|
159
166
|
create_message_datetime: bool = True,
|
|
160
167
|
) -> ChatCompletionResponse:
|
|
@@ -164,7 +171,7 @@ def openai_chat_completions_process_stream(
|
|
|
164
171
|
on the chunks received from the OpenAI-compatible server POST SSE response.
|
|
165
172
|
"""
|
|
166
173
|
assert chat_completion_request.stream == True
|
|
167
|
-
assert
|
|
174
|
+
assert stream_interface is not None, "Required"
|
|
168
175
|
|
|
169
176
|
# Count the prompt tokens
|
|
170
177
|
# TODO move to post-request?
|
|
@@ -217,8 +224,8 @@ def openai_chat_completions_process_stream(
|
|
|
217
224
|
),
|
|
218
225
|
)
|
|
219
226
|
|
|
220
|
-
if
|
|
221
|
-
|
|
227
|
+
if stream_interface:
|
|
228
|
+
stream_interface.stream_start()
|
|
222
229
|
|
|
223
230
|
n_chunks = 0 # approx == n_tokens
|
|
224
231
|
try:
|
|
@@ -227,17 +234,17 @@ def openai_chat_completions_process_stream(
|
|
|
227
234
|
):
|
|
228
235
|
assert isinstance(chat_completion_chunk, ChatCompletionChunkResponse), type(chat_completion_chunk)
|
|
229
236
|
|
|
230
|
-
if
|
|
231
|
-
if isinstance(
|
|
232
|
-
|
|
237
|
+
if stream_interface:
|
|
238
|
+
if isinstance(stream_interface, AgentChunkStreamingInterface):
|
|
239
|
+
stream_interface.process_chunk(
|
|
233
240
|
chat_completion_chunk,
|
|
234
241
|
message_id=chat_completion_response.id if create_message_id else chat_completion_chunk.id,
|
|
235
242
|
message_date=chat_completion_response.created if create_message_datetime else chat_completion_chunk.created,
|
|
236
243
|
)
|
|
237
|
-
elif isinstance(
|
|
238
|
-
|
|
244
|
+
elif isinstance(stream_interface, AgentRefreshStreamingInterface):
|
|
245
|
+
stream_interface.process_refresh(chat_completion_response)
|
|
239
246
|
else:
|
|
240
|
-
raise TypeError(
|
|
247
|
+
raise TypeError(stream_interface)
|
|
241
248
|
|
|
242
249
|
if chunk_idx == 0:
|
|
243
250
|
# initialize the choice objects which we will increment with the deltas
|
|
@@ -311,13 +318,13 @@ def openai_chat_completions_process_stream(
|
|
|
311
318
|
n_chunks += 1
|
|
312
319
|
|
|
313
320
|
except Exception as e:
|
|
314
|
-
if
|
|
315
|
-
|
|
321
|
+
if stream_interface:
|
|
322
|
+
stream_interface.stream_end()
|
|
316
323
|
print(f"Parsing ChatCompletion stream failed with error:\n{str(e)}")
|
|
317
324
|
raise e
|
|
318
325
|
finally:
|
|
319
|
-
if
|
|
320
|
-
|
|
326
|
+
if stream_interface:
|
|
327
|
+
stream_interface.stream_end()
|
|
321
328
|
|
|
322
329
|
# make sure we didn't leave temp stuff in
|
|
323
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 = "/
|
|
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):
|
{letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/metadata.py
RENAMED
|
@@ -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"""
|
{letta_nightly-0.4.1.dev20241010104112 → letta_nightly-0.4.1.dev20241012104008}/letta/providers.py
RENAMED
|
@@ -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
|
-
|
|
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):
|
|
@@ -53,23 +57,40 @@ class LettaProvider(Provider):
|
|
|
53
57
|
class OpenAIProvider(Provider):
|
|
54
58
|
name: str = "openai"
|
|
55
59
|
api_key: str = Field(..., description="API key for the OpenAI API.")
|
|
56
|
-
base_url: str = "
|
|
60
|
+
base_url: str = Field(..., description="Base URL for the OpenAI API.")
|
|
57
61
|
|
|
58
62
|
def list_llm_models(self) -> List[LLMConfig]:
|
|
59
63
|
from letta.llm_api.openai import openai_get_model_list
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
# Some hardcoded support for OpenRouter (so that we only get models with tool calling support)...
|
|
66
|
+
# See: https://openrouter.ai/docs/requests
|
|
67
|
+
extra_params = {"supported_parameters": "tools"} if "openrouter.ai" in self.base_url else None
|
|
68
|
+
response = openai_get_model_list(self.base_url, api_key=self.api_key, extra_params=extra_params)
|
|
69
|
+
|
|
70
|
+
assert "data" in response, f"OpenAI model query response missing 'data' field: {response}"
|
|
63
71
|
|
|
64
72
|
configs = []
|
|
65
|
-
for
|
|
66
|
-
|
|
73
|
+
for model in response["data"]:
|
|
74
|
+
assert "id" in model, f"OpenAI model missing 'id' field: {model}"
|
|
75
|
+
model_name = model["id"]
|
|
76
|
+
|
|
77
|
+
if "context_length" in model:
|
|
78
|
+
# Context length is returned in OpenRouter as "context_length"
|
|
79
|
+
context_window_size = model["context_length"]
|
|
80
|
+
else:
|
|
81
|
+
context_window_size = self.get_model_context_window_size(model_name)
|
|
67
82
|
|
|
68
83
|
if not context_window_size:
|
|
69
84
|
continue
|
|
70
85
|
configs.append(
|
|
71
86
|
LLMConfig(model=model_name, model_endpoint_type="openai", model_endpoint=self.base_url, context_window=context_window_size)
|
|
72
87
|
)
|
|
88
|
+
|
|
89
|
+
# for OpenAI, sort in reverse order
|
|
90
|
+
if self.base_url == "https://api.openai.com/v1":
|
|
91
|
+
# alphnumeric sort
|
|
92
|
+
configs.sort(key=lambda x: x.model, reverse=True)
|
|
93
|
+
|
|
73
94
|
return configs
|
|
74
95
|
|
|
75
96
|
def list_embedding_models(self) -> List[EmbeddingConfig]:
|
|
@@ -145,7 +166,7 @@ class OllamaProvider(OpenAIProvider):
|
|
|
145
166
|
)
|
|
146
167
|
return configs
|
|
147
168
|
|
|
148
|
-
def get_model_context_window(self, model_name: str):
|
|
169
|
+
def get_model_context_window(self, model_name: str) -> Optional[int]:
|
|
149
170
|
|
|
150
171
|
import requests
|
|
151
172
|
|
|
@@ -293,7 +314,7 @@ class GoogleAIProvider(Provider):
|
|
|
293
314
|
)
|
|
294
315
|
return configs
|
|
295
316
|
|
|
296
|
-
def get_model_context_window(self, model_name: str):
|
|
317
|
+
def get_model_context_window(self, model_name: str) -> Optional[int]:
|
|
297
318
|
from letta.llm_api.google_ai import google_ai_get_model_context_window
|
|
298
319
|
|
|
299
320
|
return google_ai_get_model_context_window(self.base_url, self.api_key, model_name)
|
|
@@ -354,16 +375,75 @@ class AzureProvider(Provider):
|
|
|
354
375
|
)
|
|
355
376
|
return configs
|
|
356
377
|
|
|
357
|
-
def get_model_context_window(self, model_name: str):
|
|
378
|
+
def get_model_context_window(self, model_name: str) -> Optional[int]:
|
|
358
379
|
"""
|
|
359
380
|
This is hardcoded for now, since there is no API endpoints to retrieve metadata for a model.
|
|
360
381
|
"""
|
|
361
382
|
return AZURE_MODEL_TO_CONTEXT_LENGTH.get(model_name, 4096)
|
|
362
383
|
|
|
363
384
|
|
|
364
|
-
class
|
|
385
|
+
class VLLMChatCompletionsProvider(Provider):
|
|
386
|
+
"""vLLM provider that treats vLLM as an OpenAI /chat/completions proxy"""
|
|
387
|
+
|
|
365
388
|
# NOTE: vLLM only serves one model at a time (so could configure that through env variables)
|
|
366
|
-
|
|
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 []
|
|
367
447
|
|
|
368
448
|
|
|
369
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
|
+
)
|