Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

run isort on apps/core

Caren Thomasea0cca7baddd
diff --git a/letta/__init__.py b/letta/__init__.py
index 826b03f99..d7911ff5e 100644
--- a/letta/__init__.py
+++ b/letta/__init__.py
@@ -13,11 +13,11 @@ from letta.schemas.job import Job
from letta.schemas.letta_message import LettaMessage
from letta.schemas.llm_config import LLMConfig
from letta.schemas.memory import (
- ArchivalMemorySummary,
- BasicBlockMemory,
- ChatMemory,
- Memory,
- RecallMemorySummary,
+ ArchivalMemorySummary,
+ BasicBlockMemory,
+ ChatMemory,
+ Memory,
+ RecallMemorySummary,
)
from letta.schemas.message import Message
from letta.schemas.openai.chat_completion_response import UsageStatistics
diff --git a/letta/agent.py b/letta/agent.py
index 0cbaff688..12515ebac 100644
--- a/letta/agent.py
+++ b/letta/agent.py
@@ -7,17 +7,17 @@ from abc import ABC, abstractmethod
from typing import List, Optional, Tuple, Union
from 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 ContextWindowExceededError
from letta.helpers import ToolRulesSolver
@@ -34,11 +34,11 @@ from letta.schemas.enums import MessageRole
from letta.schemas.memory import ContextWindowOverview, Memory
from letta.schemas.message import Message
from letta.schemas.openai.chat_completion_request import (
- Tool as ChatCompletionRequestTool,
+ Tool as ChatCompletionRequestTool,
)
from letta.schemas.openai.chat_completion_response import ChatCompletionResponse
from letta.schemas.openai.chat_completion_response import (
- Message as ChatCompletionMessage,
+ Message as ChatCompletionMessage,
)
from letta.schemas.openai.chat_completion_response import UsageStatistics
from letta.schemas.tool import Tool
@@ -47,30 +47,30 @@ from letta.schemas.usage import LettaUsageStatistics
from letta.services.agent_manager import AgentManager
from letta.services.block_manager import BlockManager
from 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 MessageManager
from letta.services.passage_manager import PassageManager
from letta.services.tool_execution_sandbox import ToolExecutionSandbox
from letta.streaming_interface import StreamingRefreshCLIInterface
from 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.py
index efd58df75..b385a01ca 100644
--- a/letta/cli/cli.py
+++ b/letta/cli/cli.py
@@ -10,10 +10,10 @@ from letta import create_client
from letta.agent import Agent, save_agent
from letta.config import LettaConfig
from 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_SYMBOL
from 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 terminal
from 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, printd
diff --git a/letta/client/client.py b/letta/client/client.py
index 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, Union
import letta.utils
import requests
from 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 DataConnector
from letta.functions.functions import parse_source_code
@@ -27,25 +27,25 @@ from letta.schemas.letta_request import LettaRequest, LettaStreamingRequest
from letta.schemas.letta_response import LettaResponse, LettaStreamingResponse
from letta.schemas.llm_config import LLMConfig
from letta.schemas.memory import (
- ArchivalMemorySummary,
- ChatMemory,
- CreateArchivalMemory,
- Memory,
- RecallMemorySummary,
+ ArchivalMemorySummary,
+ ChatMemory,
+ CreateArchivalMemory,
+ Memory,
+ RecallMemorySummary,
)
from letta.schemas.message import Message, MessageCreate, MessageUpdate
from letta.schemas.openai.chat_completions import ToolCall
from letta.schemas.organization import Organization
from letta.schemas.passage import Passage
from 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, SourceUpdate
from letta.schemas.tool import Tool, ToolCreate, ToolUpdate
diff --git a/letta/client/streaming.py b/letta/client/streaming.py
index 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_SUBSTRING
from letta.errors import LLMError
from letta.schemas.enums import MessageStreamStatus
from letta.schemas.letta_message import (
- ReasoningMessage,
- ToolCallMessage,
- ToolReturnMessage,
+ ReasoningMessage,
+ ToolCallMessage,
+ ToolReturnMessage,
)
from letta.schemas.letta_response import LettaStreamingResponse
from letta.schemas.usage import LettaUsageStatistics
diff --git a/letta/client/utils.py b/letta/client/utils.py
index 871269c7c..1588f7d13 100644
--- a/letta/client/utils.py
+++ b/letta/client/utils.py
@@ -4,8 +4,8 @@ from typing import Optional
from IPython.display import HTML, display
from 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 warnings
diff --git a/letta/config.py b/letta/config.py
index ed9e8668e..a50154a60 100644
--- a/letta/config.py
+++ b/letta/config.py
@@ -5,12 +5,12 @@ from typing import Optional
import letta
from 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_logger
from letta.schemas.embedding_config import EmbeddingConfig
diff --git a/letta/data_sources/connectors.py b/letta/data_sources/connectors.py
index 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, Tuple
import typer
from 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_model
from letta.schemas.file import FileMetadata
diff --git a/letta/embeddings.py b/letta/embeddings.py
index e27ee1add..56f016314 100644
--- a/letta/embeddings.py
+++ b/letta/embeddings.py
@@ -4,9 +4,9 @@ from typing import Any, List, Optional
import numpy as np
import tiktoken
from 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 EmbeddingConfig
from letta.utils import is_valid_url, printd
diff --git a/letta/functions/function_sets/extras.py b/letta/functions/function_sets/extras.py
index c911ffca1..c8edc93cb 100644
--- a/letta/functions/function_sets/extras.py
+++ b/letta/functions/function_sets/extras.py
@@ -4,8 +4,8 @@ from typing import Optional
import requests
from 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 create
from letta.schemas.message import Message
diff --git a/letta/helpers/tool_rule_solver.py b/letta/helpers/tool_rule_solver.py
index 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, Union
from letta.schemas.enums import ToolRuleType
from letta.schemas.tool_rule import (
- BaseToolRule,
- ChildToolRule,
- ConditionalToolRule,
- InitToolRule,
- TerminalToolRule,
+ BaseToolRule,
+ ChildToolRule,
+ ConditionalToolRule,
+ InitToolRule,
+ TerminalToolRule,
)
from pydantic import BaseModel, Field
diff --git a/letta/interface.py b/letta/interface.py
index 41276b17a..22e9678c5 100644
--- a/letta/interface.py
+++ b/letta/interface.py
@@ -5,8 +5,8 @@ from typing import List, Optional
from colorama import Fore, Style, init
from letta.constants import CLI_WARNING_PREFIX
from 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 Message
from letta.utils import json_loads, printd
diff --git a/letta/llm_api/anthropic.py b/letta/llm_api/anthropic.py
index 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_request
from letta.schemas.message import Message
from letta.schemas.openai.chat_completion_request import ChatCompletionRequest, Tool
from 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, UsageStatistics
from letta.utils import get_utc_time, smart_urljoin
diff --git a/letta/llm_api/cohere.py b/letta/llm_api/cohere.py
index 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_tokens
from letta.schemas.message import Message
from letta.schemas.openai.chat_completion_request import ChatCompletionRequest, Tool
from 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, UsageStatistics
from 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 kwarg
from 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.py
index 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_backslash
from letta.local_llm.utils import count_tokens
from letta.schemas.openai.chat_completion_request import Tool
from 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 thoughts
if 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.py
index 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, RateLimitExceededError
from letta.llm_api.anthropic import anthropic_chat_completions_request
from letta.llm_api.azure_openai import azure_openai_chat_completions_request
from 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_completion
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_messages
from letta.schemas.llm_config import LLMConfig
from letta.schemas.message import Message
from 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 ChatCompletionResponse
from letta.settings import ModelSettings
from 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.py
index 407ac6aec..3ad3cf2a3 100644
--- a/letta/llm_api/openai.py
+++ b/letta/llm_api/openai.py
@@ -9,13 +9,13 @@ from httpx_sse._exceptions import SSEError
from letta.constants import OPENAI_CONTEXT_WINDOW_ERROR_SUBSTRING
from letta.errors import LLMError
from 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_messages
from letta.schemas.llm_config import LLMConfig
@@ -23,26 +23,26 @@ from letta.schemas.message import Message as _Message
from letta.schemas.message import MessageRole as _MessageRole
from letta.schemas.openai.chat_completion_request import ChatCompletionRequest
from 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 EmbeddingResponse
from letta.streaming_interface import (
- AgentChunkStreamingInterface,
- AgentRefreshStreamingInterface,
+ AgentChunkStreamingInterface,
+ AgentRefreshStreamingInterface,
)
from letta.utils import get_tool_call_id, smart_urljoin
diff --git a/letta/local_llm/chat_completion_proxy.py b/letta/local_llm/chat_completion_proxy.py
index 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, LocalLLMError
from letta.local_llm.constants import DEFAULT_WRAPPER
from letta.local_llm.function_parser import patch_function
from 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_completion
from letta.local_llm.llamacpp.api import get_llamacpp_completion
@@ -20,15 +20,15 @@ from letta.local_llm.utils import count_tokens, get_available_wrappers
from letta.local_llm.vllm.api import get_vllm_completion
from letta.local_llm.webui.api import get_webui_completion
from 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_MESSAGE
from 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_dumps
diff --git a/letta/local_llm/constants.py b/letta/local_llm/constants.py
index 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 airoboros
from 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.py
index 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 Enum
from inspect import getdoc, isclass
from types import NoneType
from 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 parse
diff --git a/letta/local_llm/llm_chat_completion_wrappers/chatml.py b/letta/local_llm/llm_chat_completion_wrappers/chatml.py
index 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 LLMJSONParsingError
from letta.local_llm.json_parser import clean_json
from letta.local_llm.llm_chat_completion_wrappers.wrapper_base import (
- LLMChatCompletionWrapper,
+ LLMChatCompletionWrapper,
)
from letta.schemas.enums import MessageRole
from 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.py
index 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 LLMJSONParsingError
from letta.local_llm.json_parser import clean_json
from 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.py
index b4c67a9ed..8a3fcbe8d 100644
--- a/letta/local_llm/settings/settings.py
+++ b/letta/local_llm/settings/settings.py
@@ -3,7 +3,7 @@ import os
from letta.constants import LETTA_DIR
from 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_settings
diff --git a/letta/orm/agent.py b/letta/orm/agent.py
index de9dd5ce0..b8c541e2d 100644
--- a/letta/orm/agent.py
+++ b/letta/orm/agent.py
@@ -3,9 +3,9 @@ from typing import TYPE_CHECKING, List, Optional
from letta.orm.block import Block
from letta.orm.custom_columns import (
- EmbeddingConfigColumn,
- LLMConfigColumn,
- ToolRulesColumn,
+ EmbeddingConfigColumn,
+ LLMConfigColumn,
+ ToolRulesColumn,
)
from letta.orm.message import Message
from letta.orm.mixins import OrganizationMixin
diff --git a/letta/orm/base.py b/letta/orm/base.py
index e9491c419..f740ef45d 100644
--- a/letta/orm/base.py
+++ b/letta/orm/base.py
@@ -3,11 +3,11 @@ from typing import Optional
from sqlalchemy import Boolean, DateTime, String, func, text
from 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.py
index b20760f98..05113a6a5 100644
--- a/letta/orm/custom_columns.py
+++ b/letta/orm/custom_columns.py
@@ -7,10 +7,10 @@ from letta.schemas.enums import ToolRuleType
from letta.schemas.llm_config import LLMConfig
from letta.schemas.openai.chat_completions import ToolCall, ToolCallFunction
from letta.schemas.tool_rule import (
- ChildToolRule,
- ConditionalToolRule,
- InitToolRule,
- TerminalToolRule,
+ ChildToolRule,
+ ConditionalToolRule,
+ InitToolRule,
+ TerminalToolRule,
)
from sqlalchemy import JSON
from sqlalchemy.types import BINARY, TypeDecorator
diff --git a/letta/orm/sandbox_config.py b/letta/orm/sandbox_config.py
index 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, SandboxConfigMixin
from letta.orm.sqlalchemy_base import SqlalchemyBase
from letta.schemas.sandbox_config import SandboxConfig as PydanticSandboxConfig
from letta.schemas.sandbox_config import (
- SandboxEnvironmentVariable as PydanticSandboxEnvironmentVariable,
+ SandboxEnvironmentVariable as PydanticSandboxEnvironmentVariable,
)
from letta.schemas.sandbox_config import SandboxType
from sqlalchemy import JSON
diff --git a/letta/orm/sqlalchemy_base.py b/letta/orm/sqlalchemy_base.py
index 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, Optional
from letta.log import get_logger
from letta.orm.base import Base, CommonSqlalchemyMetaMixins
from letta.orm.errors import (
- DatabaseTimeoutError,
- ForeignKeyConstraintViolationError,
- NoResultFound,
- UniqueConstraintViolationError,
+ DatabaseTimeoutError,
+ ForeignKeyConstraintViolationError,
+ NoResultFound,
+ UniqueConstraintViolationError,
)
from letta.orm.sqlite_functions import adapt_array
from sqlalchemy import String, desc, func, or_, select
diff --git a/letta/providers.py b/letta/providers.py
index cb7bf72b7..23964c628 100644
--- a/letta/providers.py
+++ b/letta/providers.py
@@ -2,8 +2,8 @@ from typing import List, Optional
from letta.constants import LLM_MAX_TOKENS, MIN_CONTEXT_WINDOW
from 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_LENGTH
from 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.py
index 24022ece5..9697b550e 100644
--- a/letta/schemas/message.py
+++ b/letta/schemas/message.py
@@ -5,18 +5,18 @@ from datetime import datetime, timezone
from typing import List, Literal, Optional
from 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_KWARG
from letta.schemas.enums import MessageRole
from letta.schemas.letta_base import OrmMetadataBase
from letta.schemas.letta_message import (
- AssistantMessage,
- LettaMessage,
- ReasoningMessage,
- SystemMessage,
+ AssistantMessage,
+ LettaMessage,
+ ReasoningMessage,
+ SystemMessage,
)
from letta.schemas.letta_message import ToolCall as LettaToolCall
from letta.schemas.letta_message import ToolCallMessage, ToolReturnMessage, UserMessage
diff --git a/letta/schemas/tool.py b/letta/schemas/tool.py
index 2837ee7fe..cee04fefa 100644
--- a/letta/schemas/tool.py
+++ b/letta/schemas/tool.py
@@ -3,8 +3,8 @@ from typing import Dict, List, Optional
from letta.constants import FUNCTION_RETURN_CHAR_LIMIT
from letta.functions.functions import derive_openai_json_schema
from 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_v2
from letta.schemas.letta_base import LettaBase
diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py
index 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_PREFIX
from letta.errors import LettaAgentNotFoundError, LettaUserNotFoundError
from letta.log import get_logger
from letta.orm.errors import (
- DatabaseTimeoutError,
- ForeignKeyConstraintViolationError,
- NoResultFound,
- UniqueConstraintViolationError,
+ DatabaseTimeoutError,
+ ForeignKeyConstraintViolationError,
+ NoResultFound,
+ UniqueConstraintViolationError,
)
from letta.schemas.letta_response import LettaResponse
from 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 tests
from 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 StreamingServerInterface
from 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 ORM
from letta.server.rest_api.routers.v1 import ROUTERS as v1_routes
from 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_files
from letta.server.server import SyncServer
diff --git a/letta/server/rest_api/interface.py b/letta/server/rest_api/interface.py
index 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 AgentInterface
from letta.local_llm.constants import INNER_THOUGHTS_KWARG
from letta.schemas.enums import MessageStreamStatus
from 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 Message
from letta.schemas.openai.chat_completion_response import ChatCompletionChunkResponse
from letta.streaming_interface import AgentChunkStreamingInterface
from letta.streaming_utils import (
- FunctionArgumentsStreamHandler,
- JSONInnerThoughtsExtractor,
+ FunctionArgumentsStreamHandler,
+ JSONInnerThoughtsExtractor,
)
from letta.utils import is_utc_datetime
diff --git a/letta/server/rest_api/routers/openai/assistants/assistants.py b/letta/server/rest_api/routers/openai/assistants/assistants.py
index 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, Query
from letta.constants import DEFAULT_PRESET
from letta.schemas.openai.openai import AssistantFile, OpenAIAssistant
from letta.server.rest_api.routers.openai.assistants.schemas import (
- CreateAssistantFileRequest,
- CreateAssistantRequest,
- DeleteAssistantFileResponse,
- DeleteAssistantResponse,
+ CreateAssistantFileRequest,
+ CreateAssistantRequest,
+ DeleteAssistantFileResponse,
+ DeleteAssistantResponse,
)
from letta.utils import get_utc_time
diff --git a/letta/server/rest_api/routers/openai/assistants/schemas.py b/letta/server/rest_api/routers/openai/assistants/schemas.py
index 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, Optional
from letta.schemas.openai.openai import (
- MessageRoleType,
- OpenAIMessage,
- OpenAIThread,
- ToolCall,
- ToolCallOutput,
+ MessageRoleType,
+ OpenAIMessage,
+ OpenAIThread,
+ ToolCall,
+ ToolCallOutput,
)
from pydantic import BaseModel, Field
diff --git a/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py b/letta/server/rest_api/routers/openai/chat_completions/chat_completions.py
index 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 MessageRole
from letta.schemas.letta_message import LettaMessage, ToolCall
from letta.schemas.openai.chat_completion_request import ChatCompletionRequest
from 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__.py
index 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_router
from letta.server.rest_api.routers.v1.jobs import router as jobs_router
from letta.server.rest_api.routers.v1.llms import router as llm_router
from 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_router
from letta.server.rest_api.routers.v1.tools import router as tools_router
diff --git a/letta/server/rest_api/routers/v1/agents.py b/letta/server/rest_api/routers/v1/agents.py
index 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 datetime
from typing import List, Optional, Union
from fastapi import (
- APIRouter,
- BackgroundTasks,
- Body,
- Depends,
- Header,
- HTTPException,
- Query,
- status,
+ APIRouter,
+ BackgroundTasks,
+ Body,
+ Depends,
+ Header,
+ HTTPException,
+ Query,
+ status,
)
from fastapi.responses import JSONResponse, StreamingResponse
from letta.constants import DEFAULT_MESSAGE_TOOL, DEFAULT_MESSAGE_TOOL_KWARG
@@ -19,25 +19,25 @@ from letta.log import get_logger
from letta.orm.errors import NoResultFound
from letta.schemas.agent import AgentState, CreateAgent, UpdateAgent
from letta.schemas.block import ( # , BlockLabelUpdate, BlockLimitUpdate
- Block,
- BlockUpdate,
- CreateBlock,
+ Block,
+ BlockUpdate,
+ CreateBlock,
)
from letta.schemas.enums import MessageStreamStatus
from letta.schemas.job import Job, JobStatus, JobUpdate
from letta.schemas.letta_message import (
- LegacyLettaMessage,
- LettaMessage,
- LettaMessageUnion,
+ LegacyLettaMessage,
+ LettaMessage,
+ LettaMessageUnion,
)
from letta.schemas.letta_request import LettaRequest, LettaStreamingRequest
from letta.schemas.letta_response import LettaResponse
from letta.schemas.memory import (
- ArchivalMemorySummary,
- ContextWindowOverview,
- CreateArchivalMemory,
- Memory,
- RecallMemorySummary,
+ ArchivalMemorySummary,
+ ContextWindowOverview,
+ CreateArchivalMemory,
+ Memory,
+ RecallMemorySummary,
)
from letta.schemas.message import Message, MessageCreate, MessageUpdate
from letta.schemas.passage import Passage
diff --git a/letta/server/rest_api/routers/v1/sandbox_configs.py b/letta/server/rest_api/routers/v1/sandbox_configs.py
index 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 PydanticSandboxConfig
from letta.schemas.sandbox_config import SandboxConfigCreate, SandboxConfigUpdate
from letta.schemas.sandbox_config import SandboxEnvironmentVariable as PydanticEnvVar
from letta.schemas.sandbox_config import (
- SandboxEnvironmentVariableCreate,
- SandboxEnvironmentVariableUpdate,
- SandboxType,
+ SandboxEnvironmentVariableCreate,
+ SandboxEnvironmentVariableUpdate,
+ SandboxType,
)
from letta.server.rest_api.utils import get_letta_server, get_user_id
from letta.server.server import SyncServer
diff --git a/letta/server/rest_api/routers/v1/sources.py b/letta/server/rest_api/routers/v1/sources.py
index 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 tempfile
from typing import List, Optional
from fastapi import (
- APIRouter,
- BackgroundTasks,
- Depends,
- Header,
- HTTPException,
- Query,
- UploadFile,
+ APIRouter,
+ BackgroundTasks,
+ Depends,
+ Header,
+ HTTPException,
+ Query,
+ UploadFile,
)
from letta.schemas.file import FileMetadata
from letta.schemas.job import Job
diff --git a/letta/server/server.py b/letta/server/server.py
index 17bc5771b..226d8d84b 100644
--- a/letta/server/server.py
+++ b/letta/server/server.py
@@ -27,17 +27,17 @@ from letta.offline_memory_agent import OfflineMemoryAgent
from letta.orm import Base
from letta.orm.errors import NoResultFound
from 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, CreateAgent
from letta.schemas.block import BlockUpdate
@@ -49,10 +49,10 @@ from letta.schemas.job import Job, JobUpdate
from letta.schemas.letta_message import LettaMessage, ToolReturnMessage
from letta.schemas.llm_config import LLMConfig
from letta.schemas.memory import (
- ArchivalMemorySummary,
- ContextWindowOverview,
- Memory,
- RecallMemorySummary,
+ ArchivalMemorySummary,
+ ContextWindowOverview,
+ Memory,
+ RecallMemorySummary,
)
from letta.schemas.message import Message, MessageCreate, MessageRole, MessageUpdate
from letta.schemas.organization import Organization
diff --git a/letta/services/agent_manager.py b/letta/services/agent_manager.py
index 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 PydanticToolRule
from letta.schemas.user import User as PydanticUser
from letta.services.block_manager import BlockManager
from 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 MessageManager
from letta.services.source_manager import SourceManager
diff --git a/letta/services/sandbox_config_manager.py b/letta/services/sandbox_config_manager.py
index 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 PydanticSandboxConfig
from letta.schemas.sandbox_config import SandboxConfigCreate, SandboxConfigUpdate
from letta.schemas.sandbox_config import SandboxEnvironmentVariable as PydanticEnvVar
from letta.schemas.sandbox_config import (
- SandboxEnvironmentVariableCreate,
- SandboxEnvironmentVariableUpdate,
- SandboxType,
+ SandboxEnvironmentVariableCreate,
+ SandboxEnvironmentVariableUpdate,
+ SandboxType,
)
from letta.schemas.user import User as PydanticUser
from letta.utils import enforce_types, printd
diff --git a/letta/streaming_interface.py b/letta/streaming_interface.py
index f79865309..9dfcfd461 100644
--- a/letta/streaming_interface.py
+++ b/letta/streaming_interface.py
@@ -5,13 +5,13 @@ from typing import List, Optional
from letta.interface import CLIInterface
from 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 Message
from letta.schemas.openai.chat_completion_response import (
- ChatCompletionChunkResponse,
- ChatCompletionResponse,
+ ChatCompletionChunkResponse,
+ ChatCompletionResponse,
)
# from colorama import Fore, Style, init
diff --git a/letta/system.py b/letta/system.py
index d903bf1fe..89755c318 100644
--- a/letta/system.py
+++ b/letta/system.py
@@ -3,10 +3,10 @@ import uuid
from typing import Optional
from .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_dumps
diff --git a/letta/utils.py b/letta/utils.py
index f80159644..4e7771c9c 100644
--- a/letta/utils.py
+++ b/letta/utils.py
@@ -23,13 +23,13 @@ import letta
import pytz
import tiktoken
from 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 ChatCompletionResponse
from pathvalidate import sanitize_filename as pathvalidate_sanitize_filename
diff --git a/tests/helpers/endpoints_helper.py b/tests/helpers/endpoints_helper.py
index 87997aaf7..4ed801468 100644
--- a/tests/helpers/endpoints_helper.py
+++ b/tests/helpers/endpoints_helper.py
@@ -15,10 +15,10 @@ from letta.config import LettaConfig
from letta.constants import DEFAULT_HUMAN, DEFAULT_PERSONA
from letta.embeddings import embedding_model
from letta.errors import (
- InvalidInnerMonologueError,
- InvalidToolCallError,
- MissingInnerMonologueError,
- MissingToolCallError,
+ InvalidInnerMonologueError,
+ InvalidToolCallError,
+ MissingInnerMonologueError,
+ MissingToolCallError,
)
from letta.llm_api.llm_api_tools import create
from letta.local_llm.constants import INNER_THOUGHTS_KWARG
@@ -29,10 +29,10 @@ from letta.schemas.letta_response import LettaResponse
from letta.schemas.llm_config import LLMConfig
from letta.schemas.memory import ChatMemory
from 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_dumps
from tests.helpers.utils import cleanup
diff --git a/tests/integration_test_agent_tool_graph.py b/tests/integration_test_agent_tool_graph.py
index 289b023a5..4144c3477 100644
--- a/tests/integration_test_agent_tool_graph.py
+++ b/tests/integration_test_agent_tool_graph.py
@@ -5,16 +5,16 @@ import pytest
from letta import create_client
from letta.schemas.letta_message import ToolCallMessage
from 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 cleanup
diff --git a/tests/integration_test_offline_memory_agent.py b/tests/integration_test_offline_memory_agent.py
index 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 BasicBlockMemory
from letta.client.client import Block, create_client
from letta.constants import DEFAULT_HUMAN, DEFAULT_PERSONA
from 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_system
from letta.schemas.agent import AgentType
diff --git a/tests/integration_test_tool_execution_sandbox.py b/tests/integration_test_tool_execution_sandbox.py
index 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 LLMConfig
from letta.schemas.memory import ChatMemory
from letta.schemas.organization import Organization
from letta.schemas.sandbox_config import (
- E2BSandboxConfig,
- LocalSandboxConfig,
- SandboxConfigCreate,
- SandboxConfigUpdate,
- SandboxEnvironmentVariableCreate,
- SandboxType,
+ E2BSandboxConfig,
+ LocalSandboxConfig,
+ SandboxConfigCreate,
+ SandboxConfigUpdate,
+ SandboxEnvironmentVariableCreate,
+ SandboxType,
)
from letta.schemas.tool import Tool, ToolCreate
from letta.schemas.user import User
@@ -212,7 +212,7 @@ def clear_core_memory_tool(test_user):
@pytest.fixture
def 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.py
index 54faa804a..c5595a004 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -5,8 +5,8 @@ import sys
import pexpect
import pytest
from 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.py
index a635a28e3..b578d847e 100644
--- a/tests/test_client_legacy.py
+++ b/tests/test_client_legacy.py
@@ -15,13 +15,13 @@ from letta.schemas.agent import AgentState
from letta.schemas.embedding_config import EmbeddingConfig
from letta.schemas.enums import MessageRole, MessageStreamStatus
from 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, LettaStreamingResponse
from letta.schemas.llm_config import LLMConfig
diff --git a/tests/test_managers.py b/tests/test_managers.py
index 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_TOOLS
from letta.embeddings import embedding_model
from letta.functions.functions import derive_openai_json_schema, parse_source_code
from 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 AgentsTags
from letta.orm.errors import NoResultFound, UniqueConstraintViolationError
@@ -41,13 +41,13 @@ from letta.schemas.message import MessageCreate, MessageUpdate
from letta.schemas.organization import Organization as PydanticOrganization
from letta.schemas.passage import Passage as PydanticPassage
from 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 PydanticSource
from letta.schemas.source import SourceUpdate
diff --git a/tests/test_model_letta_perfomance.py b/tests/test_model_letta_perfomance.py
index d45654eaa..59bc90af4 100644
--- a/tests/test_model_letta_perfomance.py
+++ b/tests/test_model_letta_perfomance.py
@@ -3,15 +3,15 @@ import os
import time
from 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,
)
# directories
diff --git a/tests/test_providers.py b/tests/test_providers.py
index 228e33525..8e4ea5cc7 100644
--- a/tests/test_providers.py
+++ b/tests/test_providers.py
@@ -1,14 +1,14 @@
import os
from letta.providers import (
- AnthropicProvider,
- AzureProvider,
- GoogleAIProvider,
- GroqProvider,
- MistralProvider,
- OllamaProvider,
- OpenAIProvider,
- TogetherProvider,
+ AnthropicProvider,
+ AzureProvider,
+ GoogleAIProvider,
+ GroqProvider,
+ MistralProvider,
+ OllamaProvider,
+ OpenAIProvider,
+ TogetherProvider,
)
from letta.settings import model_settings
diff --git a/tests/test_server.py b/tests/test_server.py
index 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_TOOLS
from letta.schemas.block import CreateBlock
from letta.schemas.enums import MessageRole
from letta.schemas.letta_message import (
- LettaMessage,
- ReasoningMessage,
- SystemMessage,
- ToolCallMessage,
- ToolReturnMessage,
- UserMessage,
+ LettaMessage,
+ ReasoningMessage,
+ SystemMessage,
+ ToolCallMessage,
+ ToolReturnMessage,
+ UserMessage,
)
from letta.schemas.user import User
diff --git a/tests/test_tool_rule_solver.py b/tests/test_tool_rule_solver.py
index 3504ed98d..8a9e93537 100644
--- a/tests/test_tool_rule_solver.py
+++ b/tests/test_tool_rule_solver.py
@@ -2,10 +2,10 @@ import pytest
from letta.helpers import ToolRulesSolver
from letta.helpers.tool_rule_solver import ToolRuleValidationError
from letta.schemas.tool_rule import (
- ChildToolRule,
- ConditionalToolRule,
- InitToolRule,
- TerminalToolRule,
+ ChildToolRule,
+ ConditionalToolRule,
+ InitToolRule,
+ TerminalToolRule,
)
# Constants for tool names used in the tests
diff --git a/tests/test_v1_routes.py b/tests/test_v1_routes.py
index 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, patch
import pytest
from composio.client.collections import (
- ActionModel,
- ActionParametersModel,
- ActionResponseModel,
- AppModel,
+ ActionModel,
+ ActionParametersModel,
+ ActionResponseModel,
+ AppModel,
)
from fastapi.testclient import TestClient
from letta.schemas.tool import ToolCreate, ToolUpdate