Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
run isort on apps/core
Caren Thomas905906d41648
diff --git a/letta/__init__.py b/letta/__init__.pyindex 826b03f99..d7911ff5e 100644--- a/letta/__init__.py+++ b/letta/__init__.py@@ -13,11 +13,11 @@ from letta.schemas.job import Jobfrom letta.schemas.letta_message import LettaMessagefrom letta.schemas.llm_config import LLMConfigfrom letta.schemas.memory import (- ArchivalMemorySummary,- BasicBlockMemory,- ChatMemory,- Memory,- RecallMemorySummary,+ ArchivalMemorySummary,+ BasicBlockMemory,+ ChatMemory,+ Memory,+ RecallMemorySummary,)from letta.schemas.message import Messagefrom letta.schemas.openai.chat_completion_response import UsageStatisticsdiff --git a/letta/agent.py b/letta/agent.pyindex 0cbaff688..12515ebac 100644--- a/letta/agent.py+++ b/letta/agent.py@@ -7,17 +7,17 @@ from abc import ABC, abstractmethodfrom typing import List, Optional, Tuple, Unionfrom letta.constants import (- BASE_TOOLS,- CLI_WARNING_PREFIX,- ERROR_MESSAGE_PREFIX,- FIRST_MESSAGE_ATTEMPTS,- FUNC_FAILED_HEARTBEAT_MESSAGE,- LLM_MAX_TOKENS,- MESSAGE_SUMMARY_TRUNC_KEEP_N_LAST,- MESSAGE_SUMMARY_TRUNC_TOKEN_FRAC,- MESSAGE_SUMMARY_WARNING_FRAC,- O1_BASE_TOOLS,- REQ_HEARTBEAT_MESSAGE,+ BASE_TOOLS,+ CLI_WARNING_PREFIX,+ ERROR_MESSAGE_PREFIX,+ FIRST_MESSAGE_ATTEMPTS,+ FUNC_FAILED_HEARTBEAT_MESSAGE,+ LLM_MAX_TOKENS,+ MESSAGE_SUMMARY_TRUNC_KEEP_N_LAST,+ MESSAGE_SUMMARY_TRUNC_TOKEN_FRAC,+ MESSAGE_SUMMARY_WARNING_FRAC,+ O1_BASE_TOOLS,+ REQ_HEARTBEAT_MESSAGE,)from letta.errors import ContextWindowExceededErrorfrom letta.helpers import ToolRulesSolver@@ -34,11 +34,11 @@ from letta.schemas.enums import MessageRolefrom letta.schemas.memory import ContextWindowOverview, Memoryfrom letta.schemas.message import Messagefrom letta.schemas.openai.chat_completion_request import (- Tool as ChatCompletionRequestTool,+ Tool as ChatCompletionRequestTool,)from letta.schemas.openai.chat_completion_response import ChatCompletionResponsefrom letta.schemas.openai.chat_completion_response import (- Message as ChatCompletionMessage,+ Message as ChatCompletionMessage,)from letta.schemas.openai.chat_completion_response import UsageStatisticsfrom letta.schemas.tool import Tool@@ -47,30 +47,30 @@ from letta.schemas.usage import LettaUsageStatisticsfrom letta.services.agent_manager import AgentManagerfrom letta.services.block_manager import BlockManagerfrom letta.services.helpers.agent_manager_helper import (- check_supports_structured_output,- compile_memory_metadata_block,+ check_supports_structured_output,+ compile_memory_metadata_block,)from letta.services.message_manager import MessageManagerfrom letta.services.passage_manager import PassageManagerfrom letta.services.tool_execution_sandbox import ToolExecutionSandboxfrom letta.streaming_interface import StreamingRefreshCLIInterfacefrom letta.system import (- get_heartbeat,- get_token_limit_warning,- package_function_response,- package_summarize_message,- package_user_message,+ get_heartbeat,+ get_token_limit_warning,+ package_function_response,+ package_summarize_message,+ package_user_message,)from letta.utils import (- count_tokens,- get_friendly_error_msg,- get_tool_call_id,- get_utc_time,- json_dumps,- json_loads,- parse_json,- printd,- validate_function_response,+ count_tokens,+ get_friendly_error_msg,+ get_tool_call_id,+ get_utc_time,+ json_dumps,+ json_loads,+ parse_json,+ printd,+ validate_function_response,)diff --git a/letta/cli/cli.py b/letta/cli/cli.pyindex efd58df75..b385a01ca 100644--- a/letta/cli/cli.py+++ b/letta/cli/cli.py@@ -10,10 +10,10 @@ from letta import create_clientfrom letta.agent import Agent, save_agentfrom letta.config import LettaConfigfrom letta.constants import (- CLI_WARNING_PREFIX,- CORE_MEMORY_BLOCK_CHAR_LIMIT,- LETTA_DIR,- MIN_CONTEXT_WINDOW,+ CLI_WARNING_PREFIX,+ CORE_MEMORY_BLOCK_CHAR_LIMIT,+ LETTA_DIR,+ MIN_CONTEXT_WINDOW,)from letta.local_llm.constants import ASSISTANT_MESSAGE_CLI_SYMBOLfrom letta.log import get_logger@@ -23,7 +23,7 @@ from letta.server.server import logger as server_logger# from letta.interface import CLIInterface as interface # for printing to terminalfrom letta.streaming_interface import (- StreamingRefreshCLIInterface as interface, # for printing to terminal+ StreamingRefreshCLIInterface as interface, # for printing to terminal)from letta.utils import open_folder_in_explorer, printddiff --git a/letta/client/client.py b/letta/client/client.pyindex af81a5626..eb1b906f7 100644--- a/letta/client/client.py+++ b/letta/client/client.py@@ -5,12 +5,12 @@ from typing import Callable, Dict, Generator, List, Optional, Unionimport letta.utilsimport requestsfrom letta.constants import (- ADMIN_PREFIX,- BASE_MEMORY_TOOLS,- BASE_TOOLS,- DEFAULT_HUMAN,- DEFAULT_PERSONA,- FUNCTION_RETURN_CHAR_LIMIT,+ ADMIN_PREFIX,+ BASE_MEMORY_TOOLS,+ BASE_TOOLS,+ DEFAULT_HUMAN,+ DEFAULT_PERSONA,+ FUNCTION_RETURN_CHAR_LIMIT,)from letta.data_sources.connectors import DataConnectorfrom letta.functions.functions import parse_source_code@@ -27,25 +27,25 @@ from letta.schemas.letta_request import LettaRequest, LettaStreamingRequestfrom letta.schemas.letta_response import LettaResponse, LettaStreamingResponsefrom letta.schemas.llm_config import LLMConfigfrom letta.schemas.memory import (- ArchivalMemorySummary,- ChatMemory,- CreateArchivalMemory,- Memory,- RecallMemorySummary,+ ArchivalMemorySummary,+ ChatMemory,+ CreateArchivalMemory,+ Memory,+ RecallMemorySummary,)from letta.schemas.message import Message, MessageCreate, MessageUpdatefrom letta.schemas.openai.chat_completions import ToolCallfrom letta.schemas.organization import Organizationfrom letta.schemas.passage import Passagefrom letta.schemas.sandbox_config import (- E2BSandboxConfig,- LocalSandboxConfig,- SandboxConfig,- SandboxConfigCreate,- SandboxConfigUpdate,- SandboxEnvironmentVariable,- SandboxEnvironmentVariableCreate,- SandboxEnvironmentVariableUpdate,+ E2BSandboxConfig,+ LocalSandboxConfig,+ SandboxConfig,+ SandboxConfigCreate,+ SandboxConfigUpdate,+ SandboxEnvironmentVariable,+ SandboxEnvironmentVariableCreate,+ SandboxEnvironmentVariableUpdate,)from letta.schemas.source import Source, SourceCreate, SourceUpdatefrom letta.schemas.tool import Tool, ToolCreate, ToolUpdatediff --git a/letta/client/streaming.py b/letta/client/streaming.pyindex 7d7e11292..130e8ef2c 100644--- a/letta/client/streaming.py+++ b/letta/client/streaming.py@@ -7,9 +7,9 @@ from letta.constants import OPENAI_CONTEXT_WINDOW_ERROR_SUBSTRINGfrom letta.errors import LLMErrorfrom letta.schemas.enums import MessageStreamStatusfrom letta.schemas.letta_message import (- ReasoningMessage,- ToolCallMessage,- ToolReturnMessage,+ ReasoningMessage,+ ToolCallMessage,+ ToolReturnMessage,)from letta.schemas.letta_response import LettaStreamingResponsefrom letta.schemas.usage import LettaUsageStatisticsdiff --git a/letta/client/utils.py b/letta/client/utils.pyindex 871269c7c..1588f7d13 100644--- a/letta/client/utils.py+++ b/letta/client/utils.py@@ -4,8 +4,8 @@ from typing import Optionalfrom IPython.display import HTML, displayfrom letta.local_llm.constants import (- ASSISTANT_MESSAGE_CLI_SYMBOL,- INNER_THOUGHTS_CLI_SYMBOL,+ ASSISTANT_MESSAGE_CLI_SYMBOL,+ INNER_THOUGHTS_CLI_SYMBOL,)from sqlalchemy.testing.plugin.plugin_base import warningsdiff --git a/letta/config.py b/letta/config.pyindex ed9e8668e..a50154a60 100644--- a/letta/config.py+++ b/letta/config.py@@ -5,12 +5,12 @@ from typing import Optionalimport lettafrom letta.constants import (- CORE_MEMORY_HUMAN_CHAR_LIMIT,- CORE_MEMORY_PERSONA_CHAR_LIMIT,- DEFAULT_HUMAN,- DEFAULT_PERSONA,- DEFAULT_PRESET,- LETTA_DIR,+ CORE_MEMORY_HUMAN_CHAR_LIMIT,+ CORE_MEMORY_PERSONA_CHAR_LIMIT,+ DEFAULT_HUMAN,+ DEFAULT_PERSONA,+ DEFAULT_PRESET,+ LETTA_DIR,)from letta.log import get_loggerfrom letta.schemas.embedding_config import EmbeddingConfigdiff --git a/letta/data_sources/connectors.py b/letta/data_sources/connectors.pyindex 3d5778104..274e25242 100644--- a/letta/data_sources/connectors.py+++ b/letta/data_sources/connectors.py@@ -2,9 +2,9 @@ from typing import Dict, Iterator, List, Tupleimport typerfrom letta.data_sources.connectors_helper import (- assert_all_files_exist_locally,- extract_metadata_from_files,- get_filenames_in_dir,+ assert_all_files_exist_locally,+ extract_metadata_from_files,+ get_filenames_in_dir,)from letta.embeddings import embedding_modelfrom letta.schemas.file import FileMetadatadiff --git a/letta/embeddings.py b/letta/embeddings.pyindex e27ee1add..56f016314 100644--- a/letta/embeddings.py+++ b/letta/embeddings.py@@ -4,9 +4,9 @@ from typing import Any, List, Optionalimport numpy as npimport tiktokenfrom letta.constants import (- EMBEDDING_TO_TOKENIZER_DEFAULT,- EMBEDDING_TO_TOKENIZER_MAP,- MAX_EMBEDDING_DIM,+ EMBEDDING_TO_TOKENIZER_DEFAULT,+ EMBEDDING_TO_TOKENIZER_MAP,+ MAX_EMBEDDING_DIM,)from letta.schemas.embedding_config import EmbeddingConfigfrom letta.utils import is_valid_url, printddiff --git a/letta/functions/function_sets/extras.py b/letta/functions/function_sets/extras.pyindex c911ffca1..c8edc93cb 100644--- a/letta/functions/function_sets/extras.py+++ b/letta/functions/function_sets/extras.py@@ -4,8 +4,8 @@ from typing import Optionalimport requestsfrom letta.constants import (- MESSAGE_CHATGPT_FUNCTION_MODEL,- MESSAGE_CHATGPT_FUNCTION_SYSTEM_MESSAGE,+ MESSAGE_CHATGPT_FUNCTION_MODEL,+ MESSAGE_CHATGPT_FUNCTION_SYSTEM_MESSAGE,)from letta.llm_api.llm_api_tools import createfrom letta.schemas.message import Messagediff --git a/letta/helpers/tool_rule_solver.py b/letta/helpers/tool_rule_solver.pyindex 24eff3075..b9370bf7f 100644--- a/letta/helpers/tool_rule_solver.py+++ b/letta/helpers/tool_rule_solver.py@@ -3,11 +3,11 @@ from typing import List, Optional, Unionfrom letta.schemas.enums import ToolRuleTypefrom letta.schemas.tool_rule import (- BaseToolRule,- ChildToolRule,- ConditionalToolRule,- InitToolRule,- TerminalToolRule,+ BaseToolRule,+ ChildToolRule,+ ConditionalToolRule,+ InitToolRule,+ TerminalToolRule,)from pydantic import BaseModel, Fielddiff --git a/letta/interface.py b/letta/interface.pyindex 41276b17a..22e9678c5 100644--- a/letta/interface.py+++ b/letta/interface.py@@ -5,8 +5,8 @@ from typing import List, Optionalfrom colorama import Fore, Style, initfrom letta.constants import CLI_WARNING_PREFIXfrom letta.local_llm.constants import (- ASSISTANT_MESSAGE_CLI_SYMBOL,- INNER_THOUGHTS_CLI_SYMBOL,+ ASSISTANT_MESSAGE_CLI_SYMBOL,+ INNER_THOUGHTS_CLI_SYMBOL,)from letta.schemas.message import Messagefrom letta.utils import json_loads, printddiff --git a/letta/llm_api/anthropic.py b/letta/llm_api/anthropic.pyindex 78980d520..059c08815 100644--- a/letta/llm_api/anthropic.py+++ b/letta/llm_api/anthropic.py@@ -6,12 +6,12 @@ from letta.llm_api.helpers import make_post_requestfrom letta.schemas.message import Messagefrom letta.schemas.openai.chat_completion_request import ChatCompletionRequest, Toolfrom letta.schemas.openai.chat_completion_response import (- ChatCompletionResponse,- Choice,- FunctionCall,+ ChatCompletionResponse,+ Choice,+ FunctionCall,)from letta.schemas.openai.chat_completion_response import (- Message as ChoiceMessage, # NOTE: avoid conflict with our own Letta Message datatype+ Message as ChoiceMessage, # NOTE: avoid conflict with our own Letta Message datatype)from letta.schemas.openai.chat_completion_response import ToolCall, UsageStatisticsfrom letta.utils import get_utc_time, smart_urljoindiff --git a/letta/llm_api/cohere.py b/letta/llm_api/cohere.pyindex 844e618f4..7ea633e08 100644--- a/letta/llm_api/cohere.py+++ b/letta/llm_api/cohere.py@@ -7,12 +7,12 @@ from letta.local_llm.utils import count_tokensfrom letta.schemas.message import Messagefrom letta.schemas.openai.chat_completion_request import ChatCompletionRequest, Toolfrom letta.schemas.openai.chat_completion_response import (- ChatCompletionResponse,- Choice,- FunctionCall,+ ChatCompletionResponse,+ Choice,+ FunctionCall,)from letta.schemas.openai.chat_completion_response import (- Message as ChoiceMessage, # NOTE: avoid conflict with our own Letta Message datatype+ Message as ChoiceMessage, # NOTE: avoid conflict with our own Letta Message datatype)from letta.schemas.openai.chat_completion_response import ToolCall, UsageStatisticsfrom letta.utils import get_tool_call_id, get_utc_time, json_dumps, smart_urljoin@@ -276,8 +276,8 @@ def convert_tools_to_cohere_format(tools: List[Tool], inner_thoughts_in_kwargs:# NOTE: since Cohere doesn't allow "text" in the response when a tool call happens, if we want# a simultaneous CoT + tool call we need to put it inside a kwargfrom letta.local_llm.constants import (- INNER_THOUGHTS_KWARG,- INNER_THOUGHTS_KWARG_DESCRIPTION,+ INNER_THOUGHTS_KWARG,+ INNER_THOUGHTS_KWARG_DESCRIPTION,)for cohere_tool in tools_dict_list:diff --git a/letta/llm_api/google_ai.py b/letta/llm_api/google_ai.pyindex f16fc447c..483a319f1 100644--- a/letta/llm_api/google_ai.py+++ b/letta/llm_api/google_ai.py@@ -8,12 +8,12 @@ from letta.local_llm.json_parser import clean_json_string_extra_backslashfrom letta.local_llm.utils import count_tokensfrom letta.schemas.openai.chat_completion_request import Toolfrom letta.schemas.openai.chat_completion_response import (- ChatCompletionResponse,- Choice,- FunctionCall,- Message,- ToolCall,- UsageStatistics,+ ChatCompletionResponse,+ Choice,+ FunctionCall,+ Message,+ ToolCall,+ UsageStatistics,)from letta.utils import get_tool_call_id, get_utc_time, json_dumps@@ -230,8 +230,8 @@ def convert_tools_to_google_ai_format(tools: List[Tool], inner_thoughts_in_kwarg# Add inner thoughtsif inner_thoughts_in_kwargs:from letta.local_llm.constants import (- INNER_THOUGHTS_KWARG,- INNER_THOUGHTS_KWARG_DESCRIPTION,+ INNER_THOUGHTS_KWARG,+ INNER_THOUGHTS_KWARG_DESCRIPTION,)func["parameters"]["properties"][INNER_THOUGHTS_KWARG] = {diff --git a/letta/llm_api/llm_api_tools.py b/letta/llm_api/llm_api_tools.pyindex 7b39b31ae..9acb1f017 100644--- a/letta/llm_api/llm_api_tools.py+++ b/letta/llm_api/llm_api_tools.py@@ -8,36 +8,36 @@ from letta.errors import LettaConfigurationError, RateLimitExceededErrorfrom letta.llm_api.anthropic import anthropic_chat_completions_requestfrom letta.llm_api.azure_openai import azure_openai_chat_completions_requestfrom letta.llm_api.google_ai import (- convert_tools_to_google_ai_format,- google_ai_chat_completions_request,+ convert_tools_to_google_ai_format,+ google_ai_chat_completions_request,)from letta.llm_api.helpers import (- add_inner_thoughts_to_functions,- unpack_all_inner_thoughts_from_kwargs,+ add_inner_thoughts_to_functions,+ unpack_all_inner_thoughts_from_kwargs,)from letta.llm_api.openai import (- build_openai_chat_completions_request,- openai_chat_completions_process_stream,- openai_chat_completions_request,+ build_openai_chat_completions_request,+ openai_chat_completions_process_stream,+ openai_chat_completions_request,)from letta.local_llm.chat_completion_proxy import get_chat_completionfrom letta.local_llm.constants import (- INNER_THOUGHTS_KWARG,- INNER_THOUGHTS_KWARG_DESCRIPTION,+ INNER_THOUGHTS_KWARG,+ INNER_THOUGHTS_KWARG_DESCRIPTION,)from letta.local_llm.utils import num_tokens_from_functions, num_tokens_from_messagesfrom letta.schemas.llm_config import LLMConfigfrom letta.schemas.message import Messagefrom letta.schemas.openai.chat_completion_request import (- ChatCompletionRequest,- Tool,- cast_message_to_subtype,+ ChatCompletionRequest,+ Tool,+ cast_message_to_subtype,)from letta.schemas.openai.chat_completion_response import ChatCompletionResponsefrom letta.settings import ModelSettingsfrom letta.streaming_interface import (- AgentChunkStreamingInterface,- AgentRefreshStreamingInterface,+ AgentChunkStreamingInterface,+ AgentRefreshStreamingInterface,)LLM_API_PROVIDER_OPTIONS = ["openai", "azure", "anthropic", "google_ai", "cohere", "local", "groq"]diff --git a/letta/llm_api/openai.py b/letta/llm_api/openai.pyindex 407ac6aec..3ad3cf2a3 100644--- a/letta/llm_api/openai.py+++ b/letta/llm_api/openai.py@@ -9,13 +9,13 @@ from httpx_sse._exceptions import SSEErrorfrom letta.constants import OPENAI_CONTEXT_WINDOW_ERROR_SUBSTRINGfrom letta.errors import LLMErrorfrom letta.llm_api.helpers import (- add_inner_thoughts_to_functions,- convert_to_structured_output,- make_post_request,+ add_inner_thoughts_to_functions,+ convert_to_structured_output,+ make_post_request,)from letta.local_llm.constants import (- INNER_THOUGHTS_KWARG,- INNER_THOUGHTS_KWARG_DESCRIPTION,+ INNER_THOUGHTS_KWARG,+ INNER_THOUGHTS_KWARG_DESCRIPTION,)from letta.local_llm.utils import num_tokens_from_functions, num_tokens_from_messagesfrom letta.schemas.llm_config import LLMConfig@@ -23,26 +23,26 @@ from letta.schemas.message import Message as _Messagefrom letta.schemas.message import MessageRole as _MessageRolefrom letta.schemas.openai.chat_completion_request import ChatCompletionRequestfrom letta.schemas.openai.chat_completion_request import (- FunctionCall as ToolFunctionChoiceFunctionCall,+ FunctionCall as ToolFunctionChoiceFunctionCall,)from letta.schemas.openai.chat_completion_request import (- Tool,- ToolFunctionChoice,- cast_message_to_subtype,+ Tool,+ ToolFunctionChoice,+ cast_message_to_subtype,)from letta.schemas.openai.chat_completion_response import (- ChatCompletionChunkResponse,- ChatCompletionResponse,- Choice,- FunctionCall,- Message,- ToolCall,- UsageStatistics,+ ChatCompletionChunkResponse,+ ChatCompletionResponse,+ Choice,+ FunctionCall,+ Message,+ ToolCall,+ UsageStatistics,)from letta.schemas.openai.embedding_response import EmbeddingResponsefrom letta.streaming_interface import (- AgentChunkStreamingInterface,- AgentRefreshStreamingInterface,+ AgentChunkStreamingInterface,+ AgentRefreshStreamingInterface,)from letta.utils import get_tool_call_id, smart_urljoindiff --git a/letta/local_llm/chat_completion_proxy.py b/letta/local_llm/chat_completion_proxy.pyindex 9eba5ca85..aa1731819 100644--- a/letta/local_llm/chat_completion_proxy.py+++ b/letta/local_llm/chat_completion_proxy.py@@ -8,8 +8,8 @@ from letta.errors import LocalLLMConnectionError, LocalLLMErrorfrom letta.local_llm.constants import DEFAULT_WRAPPERfrom letta.local_llm.function_parser import patch_functionfrom letta.local_llm.grammars.gbnf_grammar_generator import (- create_dynamic_model_from_function,- generate_gbnf_grammar_and_documentation,+ create_dynamic_model_from_function,+ generate_gbnf_grammar_and_documentation,)from letta.local_llm.koboldcpp.api import get_koboldcpp_completionfrom letta.local_llm.llamacpp.api import get_llamacpp_completion@@ -20,15 +20,15 @@ from letta.local_llm.utils import count_tokens, get_available_wrappersfrom letta.local_llm.vllm.api import get_vllm_completionfrom letta.local_llm.webui.api import get_webui_completionfrom letta.local_llm.webui.legacy_api import (- get_webui_completion as get_webui_completion_legacy,+ get_webui_completion as get_webui_completion_legacy,)from letta.prompts.gpt_summarize import SYSTEM as SUMMARIZE_SYSTEM_MESSAGEfrom letta.schemas.openai.chat_completion_response import (- ChatCompletionResponse,- Choice,- Message,- ToolCall,- UsageStatistics,+ ChatCompletionResponse,+ Choice,+ Message,+ ToolCall,+ UsageStatistics,)from letta.utils import get_tool_call_id, get_utc_time, json_dumpsdiff --git a/letta/local_llm/constants.py b/letta/local_llm/constants.pyindex ed07f4f1f..4552f1039 100644--- a/letta/local_llm/constants.py+++ b/letta/local_llm/constants.py@@ -1,6 +1,6 @@# import letta.local_llm.llm_chat_completion_wrappers.airoboros as airoborosfrom letta.local_llm.llm_chat_completion_wrappers.chatml import (- ChatMLInnerMonologueWrapper,+ ChatMLInnerMonologueWrapper,)DEFAULT_ENDPOINTS = {diff --git a/letta/local_llm/grammars/gbnf_grammar_generator.py b/letta/local_llm/grammars/gbnf_grammar_generator.pyindex 1cb793ef1..ce3ace739 100644--- a/letta/local_llm/grammars/gbnf_grammar_generator.py+++ b/letta/local_llm/grammars/gbnf_grammar_generator.py@@ -6,16 +6,16 @@ from enum import Enumfrom inspect import getdoc, isclassfrom types import NoneTypefrom typing import (- Any,- Callable,- List,- Optional,- Tuple,- Type,- Union,- _GenericAlias,- get_args,- get_origin,+ Any,+ Callable,+ List,+ Optional,+ Tuple,+ Type,+ Union,+ _GenericAlias,+ get_args,+ get_origin,)from docstring_parser import parsediff --git a/letta/local_llm/llm_chat_completion_wrappers/chatml.py b/letta/local_llm/llm_chat_completion_wrappers/chatml.pyindex baa159232..583b77b99 100644--- a/letta/local_llm/llm_chat_completion_wrappers/chatml.py+++ b/letta/local_llm/llm_chat_completion_wrappers/chatml.py@@ -1,7 +1,7 @@from letta.errors import LLMJSONParsingErrorfrom letta.local_llm.json_parser import clean_jsonfrom letta.local_llm.llm_chat_completion_wrappers.wrapper_base import (- LLMChatCompletionWrapper,+ LLMChatCompletionWrapper,)from letta.schemas.enums import MessageRolefrom letta.utils import json_dumps, json_loads@@ -76,8 +76,8 @@ class ChatMLInnerMonologueWrapper(LLMChatCompletionWrapper):func_str += f"\n params:"if add_inner_thoughts:from letta.local_llm.constants import (- INNER_THOUGHTS_KWARG,- INNER_THOUGHTS_KWARG_DESCRIPTION,+ INNER_THOUGHTS_KWARG,+ INNER_THOUGHTS_KWARG_DESCRIPTION,)func_str += f"\n {INNER_THOUGHTS_KWARG}: {INNER_THOUGHTS_KWARG_DESCRIPTION}"diff --git a/letta/local_llm/llm_chat_completion_wrappers/llama3.py b/letta/local_llm/llm_chat_completion_wrappers/llama3.pyindex fa417b7df..43174dd54 100644--- a/letta/local_llm/llm_chat_completion_wrappers/llama3.py+++ b/letta/local_llm/llm_chat_completion_wrappers/llama3.py@@ -1,7 +1,7 @@from letta.errors import LLMJSONParsingErrorfrom letta.local_llm.json_parser import clean_jsonfrom letta.local_llm.llm_chat_completion_wrappers.wrapper_base import (- LLMChatCompletionWrapper,+ LLMChatCompletionWrapper,)from letta.utils import json_dumps, json_loads@@ -75,8 +75,8 @@ class LLaMA3InnerMonologueWrapper(LLMChatCompletionWrapper):func_str += "\n params:"if add_inner_thoughts:from letta.local_llm.constants import (- INNER_THOUGHTS_KWARG,- INNER_THOUGHTS_KWARG_DESCRIPTION,+ INNER_THOUGHTS_KWARG,+ INNER_THOUGHTS_KWARG_DESCRIPTION,)func_str += f"\n {INNER_THOUGHTS_KWARG}: {INNER_THOUGHTS_KWARG_DESCRIPTION}"diff --git a/letta/local_llm/settings/settings.py b/letta/local_llm/settings/settings.pyindex b4c67a9ed..8a3fcbe8d 100644--- a/letta/local_llm/settings/settings.py+++ b/letta/local_llm/settings/settings.py@@ -3,7 +3,7 @@ import osfrom letta.constants import LETTA_DIRfrom letta.local_llm.settings.deterministic_mirostat import (- settings as det_miro_settings,+ settings as det_miro_settings,)from letta.local_llm.settings.simple import settings as simple_settingsdiff --git a/letta/orm/agent.py b/letta/orm/agent.pyindex de9dd5ce0..b8c541e2d 100644--- a/letta/orm/agent.py+++ b/letta/orm/agent.py@@ -3,9 +3,9 @@ from typing import TYPE_CHECKING, List, Optionalfrom letta.orm.block import Blockfrom letta.orm.custom_columns import (- EmbeddingConfigColumn,- LLMConfigColumn,- ToolRulesColumn,+ EmbeddingConfigColumn,+ LLMConfigColumn,+ ToolRulesColumn,)from letta.orm.message import Messagefrom letta.orm.mixins import OrganizationMixindiff --git a/letta/orm/base.py b/letta/orm/base.pyindex e9491c419..f740ef45d 100644--- a/letta/orm/base.py+++ b/letta/orm/base.py@@ -3,11 +3,11 @@ from typing import Optionalfrom sqlalchemy import Boolean, DateTime, String, func, textfrom sqlalchemy.orm import (- DeclarativeBase,- Mapped,- declarative_mixin,- declared_attr,- mapped_column,+ DeclarativeBase,+ Mapped,+ declarative_mixin,+ declared_attr,+ mapped_column,)diff --git a/letta/orm/custom_columns.py b/letta/orm/custom_columns.pyindex b20760f98..05113a6a5 100644--- a/letta/orm/custom_columns.py+++ b/letta/orm/custom_columns.py@@ -7,10 +7,10 @@ from letta.schemas.enums import ToolRuleTypefrom letta.schemas.llm_config import LLMConfigfrom letta.schemas.openai.chat_completions import ToolCall, ToolCallFunctionfrom letta.schemas.tool_rule import (- ChildToolRule,- ConditionalToolRule,- InitToolRule,- TerminalToolRule,+ ChildToolRule,+ ConditionalToolRule,+ InitToolRule,+ TerminalToolRule,)from sqlalchemy import JSONfrom sqlalchemy.types import BINARY, TypeDecoratordiff --git a/letta/orm/sandbox_config.py b/letta/orm/sandbox_config.pyindex 0b0cad17f..600e0c8a8 100644--- a/letta/orm/sandbox_config.py+++ b/letta/orm/sandbox_config.py@@ -4,7 +4,7 @@ from letta.orm.mixins import OrganizationMixin, SandboxConfigMixinfrom letta.orm.sqlalchemy_base import SqlalchemyBasefrom letta.schemas.sandbox_config import SandboxConfig as PydanticSandboxConfigfrom letta.schemas.sandbox_config import (- SandboxEnvironmentVariable as PydanticSandboxEnvironmentVariable,+ SandboxEnvironmentVariable as PydanticSandboxEnvironmentVariable,)from letta.schemas.sandbox_config import SandboxTypefrom sqlalchemy import JSONdiff --git a/letta/orm/sqlalchemy_base.py b/letta/orm/sqlalchemy_base.pyindex 857d09902..3e307bc4a 100644--- a/letta/orm/sqlalchemy_base.py+++ b/letta/orm/sqlalchemy_base.py@@ -6,10 +6,10 @@ from typing import TYPE_CHECKING, List, Literal, Optionalfrom letta.log import get_loggerfrom letta.orm.base import Base, CommonSqlalchemyMetaMixinsfrom letta.orm.errors import (- DatabaseTimeoutError,- ForeignKeyConstraintViolationError,- NoResultFound,- UniqueConstraintViolationError,+ DatabaseTimeoutError,+ ForeignKeyConstraintViolationError,+ NoResultFound,+ UniqueConstraintViolationError,)from letta.orm.sqlite_functions import adapt_arrayfrom sqlalchemy import String, desc, func, or_, selectdiff --git a/letta/providers.py b/letta/providers.pyindex cb7bf72b7..23964c628 100644--- a/letta/providers.py+++ b/letta/providers.py@@ -2,8 +2,8 @@ from typing import List, Optionalfrom letta.constants import LLM_MAX_TOKENS, MIN_CONTEXT_WINDOWfrom letta.llm_api.azure_openai import (- get_azure_chat_completions_endpoint,- get_azure_embeddings_endpoint,+ get_azure_chat_completions_endpoint,+ get_azure_embeddings_endpoint,)from letta.llm_api.azure_openai_constants import AZURE_MODEL_TO_CONTEXT_LENGTHfrom letta.schemas.embedding_config import EmbeddingConfig@@ -568,7 +568,7 @@ class AzureProvider(Provider):def list_llm_models(self) -> List[LLMConfig]:from letta.llm_api.azure_openai import (- azure_openai_get_chat_completion_model_list,+ azure_openai_get_chat_completion_model_list,)model_options = azure_openai_get_chat_completion_model_list(self.base_url, api_key=self.api_key, api_version=self.api_version)diff --git a/letta/schemas/message.py b/letta/schemas/message.pyindex 24022ece5..9697b550e 100644--- a/letta/schemas/message.py+++ b/letta/schemas/message.py@@ -5,18 +5,18 @@ from datetime import datetime, timezonefrom typing import List, Literal, Optionalfrom letta.constants import (- DEFAULT_MESSAGE_TOOL,- DEFAULT_MESSAGE_TOOL_KWARG,- TOOL_CALL_ID_MAX_LEN,+ DEFAULT_MESSAGE_TOOL,+ DEFAULT_MESSAGE_TOOL_KWARG,+ TOOL_CALL_ID_MAX_LEN,)from letta.local_llm.constants import INNER_THOUGHTS_KWARGfrom letta.schemas.enums import MessageRolefrom letta.schemas.letta_base import OrmMetadataBasefrom letta.schemas.letta_message import (- AssistantMessage,- LettaMessage,- ReasoningMessage,- SystemMessage,+ AssistantMessage,+ LettaMessage,+ ReasoningMessage,+ SystemMessage,)from letta.schemas.letta_message import ToolCall as LettaToolCallfrom letta.schemas.letta_message import ToolCallMessage, ToolReturnMessage, UserMessagediff --git a/letta/schemas/tool.py b/letta/schemas/tool.pyindex 2837ee7fe..cee04fefa 100644--- a/letta/schemas/tool.py+++ b/letta/schemas/tool.py@@ -3,8 +3,8 @@ from typing import Dict, List, Optionalfrom letta.constants import FUNCTION_RETURN_CHAR_LIMITfrom letta.functions.functions import derive_openai_json_schemafrom letta.functions.helpers import (- generate_composio_tool_wrapper,- generate_langchain_tool_wrapper,+ generate_composio_tool_wrapper,+ generate_langchain_tool_wrapper,)from letta.functions.schema_generator import generate_schema_from_args_schema_v2from letta.schemas.letta_base import LettaBasediff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.pyindex 425d9bad7..bb1839359 100644--- a/letta/server/rest_api/app.py+++ b/letta/server/rest_api/app.py@@ -13,33 +13,33 @@ from letta.constants import ADMIN_PREFIX, API_PREFIX, OPENAI_API_PREFIXfrom letta.errors import LettaAgentNotFoundError, LettaUserNotFoundErrorfrom letta.log import get_loggerfrom letta.orm.errors import (- DatabaseTimeoutError,- ForeignKeyConstraintViolationError,- NoResultFound,- UniqueConstraintViolationError,+ DatabaseTimeoutError,+ ForeignKeyConstraintViolationError,+ NoResultFound,+ UniqueConstraintViolationError,)from letta.schemas.letta_response import LettaResponsefrom letta.server.constants import REST_DEFAULT_PORT# NOTE(charles): these are extra routes that are not part of v1 but we still need to mount to pass testsfrom letta.server.rest_api.auth.index import (- setup_auth_router, # TODO: probably remove right?+ setup_auth_router, # TODO: probably remove right?)from letta.server.rest_api.interface import StreamingServerInterfacefrom letta.server.rest_api.routers.openai.assistants.assistants import (- router as openai_assistants_router,+ router as openai_assistants_router,)from letta.server.rest_api.routers.openai.chat_completions.chat_completions import (- router as openai_chat_completions_router,+ router as openai_chat_completions_router,)# from letta.orm.utilities import get_db_session # TODO(ethan) reenable once we merge ORMfrom letta.server.rest_api.routers.v1 import ROUTERS as v1_routesfrom letta.server.rest_api.routers.v1.organizations import (- router as organizations_router,+ router as organizations_router,)from letta.server.rest_api.routers.v1.users import (- router as users_router, # TODO: decide on admin+ router as users_router, # TODO: decide on admin)from letta.server.rest_api.static_files import mount_static_filesfrom letta.server.server import SyncServerdiff --git a/letta/server/rest_api/interface.py b/letta/server/rest_api/interface.pyindex ba06e1d6a..ffc46edd3 100644--- a/letta/server/rest_api/interface.py+++ b/letta/server/rest_api/interface.py@@ -11,22 +11,22 @@ from letta.interface import AgentInterfacefrom letta.local_llm.constants import INNER_THOUGHTS_KWARGfrom letta.schemas.enums import MessageStreamStatusfrom letta.schemas.letta_message import (- AssistantMessage,- LegacyFunctionCallMessage,- LegacyLettaMessage,- LettaMessage,- ReasoningMessage,- ToolCall,- ToolCallDelta,- ToolCallMessage,- ToolReturnMessage,+ AssistantMessage,+ LegacyFunctionCallMessage,+ LegacyLettaMessage,+ LettaMessage,+ ReasoningMessage,+ ToolCall,+ ToolCallDelta,+ ToolCallMessage,+ ToolReturnMessage,)from letta.schemas.message import Messagefrom letta.schemas.openai.chat_completion_response import ChatCompletionChunkResponsefrom letta.streaming_interface import AgentChunkStreamingInterfacefrom letta.streaming_utils import (- FunctionArgumentsStreamHandler,- JSONInnerThoughtsExtractor,+ FunctionArgumentsStreamHandler,+ JSONInnerThoughtsExtractor,)from letta.utils import is_utc_datetimediff --git a/letta/server/rest_api/routers/openai/assistants/assistants.py b/letta/server/rest_api/routers/openai/assistants/assistants.pyindex 59e57cdfe..95f8f01e9 100644--- a/letta/server/rest_api/routers/openai/assistants/assistants.py+++ b/letta/server/rest_api/routers/openai/assistants/assistants.py@@ -4,10 +4,10 @@ from fastapi import APIRouter, Body, HTTPException, Path, Queryfrom letta.constants import DEFAULT_PRESETfrom letta.schemas.openai.openai import AssistantFile, OpenAIAssistantfrom letta.server.rest_api.routers.openai.assistants.schemas import (- CreateAssistantFileRequest,- CreateAssistantRequest,- DeleteAssistantFileResponse,- DeleteAssistantResponse,+ CreateAssistantFileRequest,+ CreateAssistantRequest,+ DeleteAssistantFileResponse,+ DeleteAssistantResponse,)from letta.utils import get_utc_timediff --git a/letta/server/rest_api/routers/openai/assistants/schemas.py b/letta/server/rest_api/routers/openai/assistants/schemas.pyindex 5a6649ebe..069a4d97f 100644--- a/letta/server/rest_api/routers/openai/assistants/schemas.py+++ b/letta/server/rest_api/routers/openai/assistants/schemas.py@@ -1,11 +1,11 @@from typing import List, Optionalfrom letta.schemas.openai.openai import (- MessageRoleType,- OpenAIMessage,- OpenAIThread,- ToolCall,- ToolCallOutput,+ MessageRoleType,+ OpenAIMessage,+ OpenAIThread,+ ToolCall,+ ToolCallOutput,)from pydantic import BaseModel, Fielddiff --git a/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py b/letta/server/rest_api/routers/openai/chat_completions/chat_completions.pyindex 72b647db0..9127787f9 100644--- a/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py+++ b/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py@@ -6,10 +6,10 @@ from letta.schemas.enums import MessageRolefrom letta.schemas.letta_message import LettaMessage, ToolCallfrom letta.schemas.openai.chat_completion_request import ChatCompletionRequestfrom letta.schemas.openai.chat_completion_response import (- ChatCompletionResponse,- Choice,- Message,- UsageStatistics,+ ChatCompletionResponse,+ Choice,+ Message,+ UsageStatistics,)# TODO this belongs in a controller!diff --git a/letta/server/rest_api/routers/v1/__init__.py b/letta/server/rest_api/routers/v1/__init__.pyindex 764a78a3e..bcebeb26c 100644--- a/letta/server/rest_api/routers/v1/__init__.py+++ b/letta/server/rest_api/routers/v1/__init__.py@@ -4,7 +4,7 @@ from letta.server.rest_api.routers.v1.health import router as health_routerfrom letta.server.rest_api.routers.v1.jobs import router as jobs_routerfrom letta.server.rest_api.routers.v1.llms import router as llm_routerfrom letta.server.rest_api.routers.v1.sandbox_configs import (- router as sandbox_configs_router,+ router as sandbox_configs_router,)from letta.server.rest_api.routers.v1.sources import router as sources_routerfrom letta.server.rest_api.routers.v1.tools import router as tools_routerdiff --git a/letta/server/rest_api/routers/v1/agents.py b/letta/server/rest_api/routers/v1/agents.pyindex d66cb193e..a11626538 100644--- a/letta/server/rest_api/routers/v1/agents.py+++ b/letta/server/rest_api/routers/v1/agents.py@@ -4,14 +4,14 @@ from datetime import datetimefrom typing import List, Optional, Unionfrom fastapi import (- APIRouter,- BackgroundTasks,- Body,- Depends,- Header,- HTTPException,- Query,- status,+ APIRouter,+ BackgroundTasks,+ Body,+ Depends,+ Header,+ HTTPException,+ Query,+ status,)from fastapi.responses import JSONResponse, StreamingResponsefrom letta.constants import DEFAULT_MESSAGE_TOOL, DEFAULT_MESSAGE_TOOL_KWARG@@ -19,25 +19,25 @@ from letta.log import get_loggerfrom letta.orm.errors import NoResultFoundfrom letta.schemas.agent import AgentState, CreateAgent, UpdateAgentfrom letta.schemas.block import ( # , BlockLabelUpdate, BlockLimitUpdate- Block,- BlockUpdate,- CreateBlock,+ Block,+ BlockUpdate,+ CreateBlock,)from letta.schemas.enums import MessageStreamStatusfrom letta.schemas.job import Job, JobStatus, JobUpdatefrom letta.schemas.letta_message import (- LegacyLettaMessage,- LettaMessage,- LettaMessageUnion,+ LegacyLettaMessage,+ LettaMessage,+ LettaMessageUnion,)from letta.schemas.letta_request import LettaRequest, LettaStreamingRequestfrom letta.schemas.letta_response import LettaResponsefrom letta.schemas.memory import (- ArchivalMemorySummary,- ContextWindowOverview,- CreateArchivalMemory,- Memory,- RecallMemorySummary,+ ArchivalMemorySummary,+ ContextWindowOverview,+ CreateArchivalMemory,+ Memory,+ RecallMemorySummary,)from letta.schemas.message import Message, MessageCreate, MessageUpdatefrom letta.schemas.passage import Passagediff --git a/letta/server/rest_api/routers/v1/sandbox_configs.py b/letta/server/rest_api/routers/v1/sandbox_configs.pyindex 17dcbb4f3..822ca4f5d 100644--- a/letta/server/rest_api/routers/v1/sandbox_configs.py+++ b/letta/server/rest_api/routers/v1/sandbox_configs.py@@ -5,9 +5,9 @@ from letta.schemas.sandbox_config import SandboxConfig as PydanticSandboxConfigfrom letta.schemas.sandbox_config import SandboxConfigCreate, SandboxConfigUpdatefrom letta.schemas.sandbox_config import SandboxEnvironmentVariable as PydanticEnvVarfrom letta.schemas.sandbox_config import (- SandboxEnvironmentVariableCreate,- SandboxEnvironmentVariableUpdate,- SandboxType,+ SandboxEnvironmentVariableCreate,+ SandboxEnvironmentVariableUpdate,+ SandboxType,)from letta.server.rest_api.utils import get_letta_server, get_user_idfrom letta.server.server import SyncServerdiff --git a/letta/server/rest_api/routers/v1/sources.py b/letta/server/rest_api/routers/v1/sources.pyindex c51fee687..399942da6 100644--- a/letta/server/rest_api/routers/v1/sources.py+++ b/letta/server/rest_api/routers/v1/sources.py@@ -3,13 +3,13 @@ import tempfilefrom typing import List, Optionalfrom fastapi import (- APIRouter,- BackgroundTasks,- Depends,- Header,- HTTPException,- Query,- UploadFile,+ APIRouter,+ BackgroundTasks,+ Depends,+ Header,+ HTTPException,+ Query,+ UploadFile,)from letta.schemas.file import FileMetadatafrom letta.schemas.job import Jobdiff --git a/letta/server/server.py b/letta/server/server.pyindex 17bc5771b..226d8d84b 100644--- a/letta/server/server.py+++ b/letta/server/server.py@@ -27,17 +27,17 @@ from letta.offline_memory_agent import OfflineMemoryAgentfrom letta.orm import Basefrom letta.orm.errors import NoResultFoundfrom letta.providers import (- AnthropicProvider,- AzureProvider,- GoogleAIProvider,- GroqProvider,- LettaProvider,- OllamaProvider,- OpenAIProvider,- Provider,- TogetherProvider,- VLLMChatCompletionsProvider,- VLLMCompletionsProvider,+ AnthropicProvider,+ AzureProvider,+ GoogleAIProvider,+ GroqProvider,+ LettaProvider,+ OllamaProvider,+ OpenAIProvider,+ Provider,+ TogetherProvider,+ VLLMChatCompletionsProvider,+ VLLMCompletionsProvider,)from letta.schemas.agent import AgentState, AgentType, CreateAgentfrom letta.schemas.block import BlockUpdate@@ -49,10 +49,10 @@ from letta.schemas.job import Job, JobUpdatefrom letta.schemas.letta_message import LettaMessage, ToolReturnMessagefrom letta.schemas.llm_config import LLMConfigfrom letta.schemas.memory import (- ArchivalMemorySummary,- ContextWindowOverview,- Memory,- RecallMemorySummary,+ ArchivalMemorySummary,+ ContextWindowOverview,+ Memory,+ RecallMemorySummary,)from letta.schemas.message import Message, MessageCreate, MessageRole, MessageUpdatefrom letta.schemas.organization import Organizationdiff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.pyindex b1040f313..969733913 100644--- a/letta/services/agent_manager.py+++ b/letta/services/agent_manager.py@@ -25,13 +25,13 @@ from letta.schemas.tool_rule import ToolRule as PydanticToolRulefrom letta.schemas.user import User as PydanticUserfrom letta.services.block_manager import BlockManagerfrom letta.services.helpers.agent_manager_helper import (- _process_relationship,- _process_tags,- check_supports_structured_output,- compile_system_message,- derive_system_message,- initialize_message_sequence,- package_initial_message_sequence,+ _process_relationship,+ _process_tags,+ check_supports_structured_output,+ compile_system_message,+ derive_system_message,+ initialize_message_sequence,+ package_initial_message_sequence,)from letta.services.message_manager import MessageManagerfrom letta.services.source_manager import SourceManagerdiff --git a/letta/services/sandbox_config_manager.py b/letta/services/sandbox_config_manager.pyindex 010ae400c..270b1761b 100644--- a/letta/services/sandbox_config_manager.py+++ b/letta/services/sandbox_config_manager.py@@ -10,9 +10,9 @@ from letta.schemas.sandbox_config import SandboxConfig as PydanticSandboxConfigfrom letta.schemas.sandbox_config import SandboxConfigCreate, SandboxConfigUpdatefrom letta.schemas.sandbox_config import SandboxEnvironmentVariable as PydanticEnvVarfrom letta.schemas.sandbox_config import (- SandboxEnvironmentVariableCreate,- SandboxEnvironmentVariableUpdate,- SandboxType,+ SandboxEnvironmentVariableCreate,+ SandboxEnvironmentVariableUpdate,+ SandboxType,)from letta.schemas.user import User as PydanticUserfrom letta.utils import enforce_types, printddiff --git a/letta/streaming_interface.py b/letta/streaming_interface.pyindex f79865309..9dfcfd461 100644--- a/letta/streaming_interface.py+++ b/letta/streaming_interface.py@@ -5,13 +5,13 @@ from typing import List, Optionalfrom letta.interface import CLIInterfacefrom letta.local_llm.constants import (- ASSISTANT_MESSAGE_CLI_SYMBOL,- INNER_THOUGHTS_CLI_SYMBOL,+ ASSISTANT_MESSAGE_CLI_SYMBOL,+ INNER_THOUGHTS_CLI_SYMBOL,)from letta.schemas.message import Messagefrom letta.schemas.openai.chat_completion_response import (- ChatCompletionChunkResponse,- ChatCompletionResponse,+ ChatCompletionChunkResponse,+ ChatCompletionResponse,)# from colorama import Fore, Style, initdiff --git a/letta/system.py b/letta/system.pyindex d903bf1fe..89755c318 100644--- a/letta/system.py+++ b/letta/system.py@@ -3,10 +3,10 @@ import uuidfrom typing import Optionalfrom .constants import (- INITIAL_BOOT_MESSAGE,- INITIAL_BOOT_MESSAGE_SEND_MESSAGE_FIRST_MSG,- INITIAL_BOOT_MESSAGE_SEND_MESSAGE_THOUGHT,- MESSAGE_SUMMARY_WARNING_STR,+ INITIAL_BOOT_MESSAGE,+ INITIAL_BOOT_MESSAGE_SEND_MESSAGE_FIRST_MSG,+ INITIAL_BOOT_MESSAGE_SEND_MESSAGE_THOUGHT,+ MESSAGE_SUMMARY_WARNING_STR,)from .utils import get_local_time, json_dumpsdiff --git a/letta/utils.py b/letta/utils.pyindex f80159644..4e7771c9c 100644--- a/letta/utils.py+++ b/letta/utils.py@@ -23,13 +23,13 @@ import lettaimport pytzimport tiktokenfrom letta.constants import (- CLI_WARNING_PREFIX,- CORE_MEMORY_HUMAN_CHAR_LIMIT,- CORE_MEMORY_PERSONA_CHAR_LIMIT,- ERROR_MESSAGE_PREFIX,- LETTA_DIR,- MAX_FILENAME_LENGTH,- TOOL_CALL_ID_MAX_LEN,+ CLI_WARNING_PREFIX,+ CORE_MEMORY_HUMAN_CHAR_LIMIT,+ CORE_MEMORY_PERSONA_CHAR_LIMIT,+ ERROR_MESSAGE_PREFIX,+ LETTA_DIR,+ MAX_FILENAME_LENGTH,+ TOOL_CALL_ID_MAX_LEN,)from letta.schemas.openai.chat_completion_response import ChatCompletionResponsefrom pathvalidate import sanitize_filename as pathvalidate_sanitize_filenamediff --git a/tests/helpers/endpoints_helper.py b/tests/helpers/endpoints_helper.pyindex 87997aaf7..4ed801468 100644--- a/tests/helpers/endpoints_helper.py+++ b/tests/helpers/endpoints_helper.py@@ -15,10 +15,10 @@ from letta.config import LettaConfigfrom letta.constants import DEFAULT_HUMAN, DEFAULT_PERSONAfrom letta.embeddings import embedding_modelfrom letta.errors import (- InvalidInnerMonologueError,- InvalidToolCallError,- MissingInnerMonologueError,- MissingToolCallError,+ InvalidInnerMonologueError,+ InvalidToolCallError,+ MissingInnerMonologueError,+ MissingToolCallError,)from letta.llm_api.llm_api_tools import createfrom letta.local_llm.constants import INNER_THOUGHTS_KWARG@@ -29,10 +29,10 @@ from letta.schemas.letta_response import LettaResponsefrom letta.schemas.llm_config import LLMConfigfrom letta.schemas.memory import ChatMemoryfrom letta.schemas.openai.chat_completion_response import (- ChatCompletionResponse,- Choice,- FunctionCall,- Message,+ ChatCompletionResponse,+ Choice,+ FunctionCall,+ Message,)from letta.utils import get_human_text, get_persona_text, json_dumpsfrom tests.helpers.utils import cleanupdiff --git a/tests/integration_test_agent_tool_graph.py b/tests/integration_test_agent_tool_graph.pyindex 289b023a5..4144c3477 100644--- a/tests/integration_test_agent_tool_graph.py+++ b/tests/integration_test_agent_tool_graph.py@@ -5,16 +5,16 @@ import pytestfrom letta import create_clientfrom letta.schemas.letta_message import ToolCallMessagefrom letta.schemas.tool_rule import (- ChildToolRule,- ConditionalToolRule,- InitToolRule,- TerminalToolRule,+ ChildToolRule,+ ConditionalToolRule,+ InitToolRule,+ TerminalToolRule,)from tests.helpers.endpoints_helper import (- assert_invoked_function_call,- assert_invoked_send_message_with_keyword,- assert_sanity_checks,- setup_agent,+ assert_invoked_function_call,+ assert_invoked_send_message_with_keyword,+ assert_sanity_checks,+ setup_agent,)from tests.helpers.utils import cleanupdiff --git a/tests/integration_test_offline_memory_agent.py b/tests/integration_test_offline_memory_agent.pyindex 5803e8205..01b04693d 100644--- a/tests/integration_test_offline_memory_agent.py+++ b/tests/integration_test_offline_memory_agent.py@@ -3,11 +3,11 @@ from letta import BasicBlockMemoryfrom letta.client.client import Block, create_clientfrom letta.constants import DEFAULT_HUMAN, DEFAULT_PERSONAfrom letta.offline_memory_agent import (- finish_rethinking_memory,- finish_rethinking_memory_convo,- rethink_memory,- rethink_memory_convo,- trigger_rethink_memory,+ finish_rethinking_memory,+ finish_rethinking_memory_convo,+ rethink_memory,+ rethink_memory_convo,+ trigger_rethink_memory,)from letta.prompts import gpt_systemfrom letta.schemas.agent import AgentTypediff --git a/tests/integration_test_tool_execution_sandbox.py b/tests/integration_test_tool_execution_sandbox.pyindex 0938fdc87..699185c9f 100644--- a/tests/integration_test_tool_execution_sandbox.py+++ b/tests/integration_test_tool_execution_sandbox.py@@ -14,12 +14,12 @@ from letta.schemas.llm_config import LLMConfigfrom letta.schemas.memory import ChatMemoryfrom letta.schemas.organization import Organizationfrom letta.schemas.sandbox_config import (- E2BSandboxConfig,- LocalSandboxConfig,- SandboxConfigCreate,- SandboxConfigUpdate,- SandboxEnvironmentVariableCreate,- SandboxType,+ E2BSandboxConfig,+ LocalSandboxConfig,+ SandboxConfigCreate,+ SandboxConfigUpdate,+ SandboxEnvironmentVariableCreate,+ SandboxType,)from letta.schemas.tool import Tool, ToolCreatefrom letta.schemas.user import User@@ -212,7 +212,7 @@ def clear_core_memory_tool(test_user):@pytest.fixturedef external_codebase_tool(test_user):from tests.test_tool_sandbox.restaurant_management_system.adjust_menu_prices import (- adjust_menu_prices,+ adjust_menu_prices,)tool = create_tool_from_func(adjust_menu_prices)diff --git a/tests/test_cli.py b/tests/test_cli.pyindex 54faa804a..c5595a004 100644--- a/tests/test_cli.py+++ b/tests/test_cli.py@@ -5,8 +5,8 @@ import sysimport pexpectimport pytestfrom letta.local_llm.constants import (- ASSISTANT_MESSAGE_CLI_SYMBOL,- INNER_THOUGHTS_CLI_SYMBOL,+ ASSISTANT_MESSAGE_CLI_SYMBOL,+ INNER_THOUGHTS_CLI_SYMBOL,)original_letta_path = os.path.expanduser("~/.letta")diff --git a/tests/test_client_legacy.py b/tests/test_client_legacy.pyindex a635a28e3..b578d847e 100644--- a/tests/test_client_legacy.py+++ b/tests/test_client_legacy.py@@ -15,13 +15,13 @@ from letta.schemas.agent import AgentStatefrom letta.schemas.embedding_config import EmbeddingConfigfrom letta.schemas.enums import MessageRole, MessageStreamStatusfrom letta.schemas.letta_message import (- AssistantMessage,- LettaMessage,- ReasoningMessage,- SystemMessage,- ToolCallMessage,- ToolReturnMessage,- UserMessage,+ AssistantMessage,+ LettaMessage,+ ReasoningMessage,+ SystemMessage,+ ToolCallMessage,+ ToolReturnMessage,+ UserMessage,)from letta.schemas.letta_response import LettaResponse, LettaStreamingResponsefrom letta.schemas.llm_config import LLMConfigdiff --git a/tests/test_managers.py b/tests/test_managers.pyindex 5dac4c893..052a1819e 100644--- a/tests/test_managers.py+++ b/tests/test_managers.py@@ -8,22 +8,22 @@ from letta.constants import BASE_MEMORY_TOOLS, BASE_TOOLSfrom letta.embeddings import embedding_modelfrom letta.functions.functions import derive_openai_json_schema, parse_source_codefrom letta.orm import (- Agent,- AgentPassage,- Block,- BlocksAgents,- FileMetadata,- Job,- Message,- Organization,- SandboxConfig,- SandboxEnvironmentVariable,- Source,- SourcePassage,- SourcesAgents,- Tool,- ToolsAgents,- User,+ Agent,+ AgentPassage,+ Block,+ BlocksAgents,+ FileMetadata,+ Job,+ Message,+ Organization,+ SandboxConfig,+ SandboxEnvironmentVariable,+ Source,+ SourcePassage,+ SourcesAgents,+ Tool,+ ToolsAgents,+ User,)from letta.orm.agents_tags import AgentsTagsfrom letta.orm.errors import NoResultFound, UniqueConstraintViolationError@@ -41,13 +41,13 @@ from letta.schemas.message import MessageCreate, MessageUpdatefrom letta.schemas.organization import Organization as PydanticOrganizationfrom letta.schemas.passage import Passage as PydanticPassagefrom letta.schemas.sandbox_config import (- E2BSandboxConfig,- LocalSandboxConfig,- SandboxConfigCreate,- SandboxConfigUpdate,- SandboxEnvironmentVariableCreate,- SandboxEnvironmentVariableUpdate,- SandboxType,+ E2BSandboxConfig,+ LocalSandboxConfig,+ SandboxConfigCreate,+ SandboxConfigUpdate,+ SandboxEnvironmentVariableCreate,+ SandboxEnvironmentVariableUpdate,+ SandboxType,)from letta.schemas.source import Source as PydanticSourcefrom letta.schemas.source import SourceUpdatediff --git a/tests/test_model_letta_perfomance.py b/tests/test_model_letta_perfomance.pyindex d45654eaa..59bc90af4 100644--- a/tests/test_model_letta_perfomance.py+++ b/tests/test_model_letta_perfomance.py@@ -3,15 +3,15 @@ import osimport timefrom tests.helpers.endpoints_helper import (- check_agent_archival_memory_insert,- check_agent_archival_memory_retrieval,- check_agent_edit_core_memory,- check_agent_recall_chat_memory,- check_agent_summarize_memory_simple,- check_agent_uses_external_tool,- check_first_response_is_valid_for_llm_endpoint,- check_response_contains_keyword,- run_embedding_endpoint,+ check_agent_archival_memory_insert,+ check_agent_archival_memory_retrieval,+ check_agent_edit_core_memory,+ check_agent_recall_chat_memory,+ check_agent_summarize_memory_simple,+ check_agent_uses_external_tool,+ check_first_response_is_valid_for_llm_endpoint,+ check_response_contains_keyword,+ run_embedding_endpoint,)# directoriesdiff --git a/tests/test_providers.py b/tests/test_providers.pyindex 228e33525..8e4ea5cc7 100644--- a/tests/test_providers.py+++ b/tests/test_providers.py@@ -1,14 +1,14 @@import osfrom letta.providers import (- AnthropicProvider,- AzureProvider,- GoogleAIProvider,- GroqProvider,- MistralProvider,- OllamaProvider,- OpenAIProvider,- TogetherProvider,+ AnthropicProvider,+ AzureProvider,+ GoogleAIProvider,+ GroqProvider,+ MistralProvider,+ OllamaProvider,+ OpenAIProvider,+ TogetherProvider,)from letta.settings import model_settingsdiff --git a/tests/test_server.py b/tests/test_server.pyindex 631ec1f38..e0d51ffcb 100644--- a/tests/test_server.py+++ b/tests/test_server.py@@ -9,12 +9,12 @@ from letta.constants import BASE_MEMORY_TOOLS, BASE_TOOLSfrom letta.schemas.block import CreateBlockfrom letta.schemas.enums import MessageRolefrom letta.schemas.letta_message import (- LettaMessage,- ReasoningMessage,- SystemMessage,- ToolCallMessage,- ToolReturnMessage,- UserMessage,+ LettaMessage,+ ReasoningMessage,+ SystemMessage,+ ToolCallMessage,+ ToolReturnMessage,+ UserMessage,)from letta.schemas.user import Userdiff --git a/tests/test_tool_rule_solver.py b/tests/test_tool_rule_solver.pyindex 3504ed98d..8a9e93537 100644--- a/tests/test_tool_rule_solver.py+++ b/tests/test_tool_rule_solver.py@@ -2,10 +2,10 @@ import pytestfrom letta.helpers import ToolRulesSolverfrom letta.helpers.tool_rule_solver import ToolRuleValidationErrorfrom letta.schemas.tool_rule import (- ChildToolRule,- ConditionalToolRule,- InitToolRule,- TerminalToolRule,+ ChildToolRule,+ ConditionalToolRule,+ InitToolRule,+ TerminalToolRule,)# Constants for tool names used in the testsdiff --git a/tests/test_v1_routes.py b/tests/test_v1_routes.pyindex 266d8dcbd..6877031c6 100644--- a/tests/test_v1_routes.py+++ b/tests/test_v1_routes.py@@ -2,10 +2,10 @@ from unittest.mock import MagicMock, Mock, patchimport pytestfrom composio.client.collections import (- ActionModel,- ActionParametersModel,- ActionResponseModel,- AppModel,+ ActionModel,+ ActionParametersModel,+ ActionResponseModel,+ AppModel,)from fastapi.testclient import TestClientfrom letta.schemas.tool import ToolCreate, ToolUpdate