Files
letta-server/letta/functions/function_sets/files.py
2025-06-04 17:33:18 -07:00

59 lines
1.6 KiB
Python

from typing import TYPE_CHECKING, List, Optional, Tuple
if TYPE_CHECKING:
from letta.schemas.agent import AgentState
from letta.schemas.file import FileMetadata
async def open_file(agent_state: "AgentState", file_name: str, view_range: Optional[Tuple[int, int]]) -> str:
"""
Open up a file in core memory.
Args:
file_name (str): Name of the file to view.
view_range (Optional[Tuple[int, int]]): Optional tuple indicating range to view.
Returns:
str: A status message
"""
raise NotImplementedError("Tool not implemented. Please contact the Letta team.")
async def close_file(agent_state: "AgentState", file_name: str) -> str:
"""
Close a file in core memory.
Args:
file_name (str): Name of the file to close.
Returns:
str: A status message
"""
raise NotImplementedError("Tool not implemented. Please contact the Letta team.")
async def grep(agent_state: "AgentState", pattern: str) -> str:
"""
Grep tool to search files across data sources with keywords.
Args:
pattern (str): Keyword or regex pattern to search.
Returns:
str: Matching lines or summary output.
"""
raise NotImplementedError("Tool not implemented. Please contact the Letta team.")
async def search_files(agent_state: "AgentState", query: str) -> List["FileMetadata"]:
"""
Get list of most relevant files across all data sources.
Args:
query (str): The search query.
Returns:
List[FileMetadata]: List of matching files.
"""
raise NotImplementedError("Tool not implemented. Please contact the Letta team.")