60 lines
1.8 KiB
Python
60 lines
1.8 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, include: Optional[str] = None) -> str:
|
|
"""
|
|
Grep tool to search files across data sources with a keyword or regex pattern.
|
|
|
|
Args:
|
|
pattern (str): Keyword or regex pattern to search within file contents.
|
|
include (Optional[str]): Optional keyword or regex pattern to filter filenames to include in the 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.")
|