ContextUtility
- Session-based directory management
- Generic markdown file operations
- Text-based search through files
- File metadata handling
- Agent memory record retrieval
init
- working_directory (str, optional): The directory path where files will be stored. If not provided, a default directory will be used.
_setup_storage
_generate_session_id
_create_or_update_note
- note_name (str): Name of the note (without .md extension).
- content (str): Content to write to the note.
save_markdown_file
- filename (str): Name without .md extension.
- content (str): Main content to save.
- title (str, optional): Title for the markdown file.
- metadata (Dict, optional): Additional metadata to include.
load_markdown_file
- filename (str): Name without .md extension.
file_exists
- filename (str): Name without .md extension.
list_markdown_files
get_agent_memory_records
- agent (ChatAgent): The agent to extract memory records from.
format_memory_as_conversation
- memory_records (List[MemoryRecord]): Memory records to format.
create_session_directory
- base_dir (str, optional): Base directory. If None, uses current working directory.
- session_id (str, optional): Custom session ID. If None, generates new one.
get_session_metadata
list_sessions
- base_dir (str, optional): Base directory to search. If None, uses parent of working directory.
search_in_file
- file_path (Path): Path to the file to search.
- keywords (List[str]): Keywords to search for.
- top_k (int): Maximum number of results to return.
get_working_directory
get_session_id
load_markdown_context_to_memory
- agent (ChatAgent): The agent to append context to.
- filename (str): Name of the markdown file (without .md extension).