Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add writer tool #542

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Add writer tool #542

wants to merge 20 commits into from

Conversation

ohdearquant
Copy link
Collaborator

@ohdearquant ohdearquant commented Jan 22, 2025

Pull Request Description

Overview
This pull request introduces a new WriterTool, expanding LionAGI’s ability to handle file writing and saving. The WriterTool enforces a configurable root directory for all disk operations, preventing undesired file access outside the allowed path. It supports creating, opening, writing, and closing documents in memory, as well as saving text or chunk data to disk.

Key Changes

  • Added WriterTool class and associated Pydantic models (WriterRequest, WriterResponse) for in-memory writing.
  • Restricts writing to an allowed_root directory, ensuring safe I/O operations.
  • Updated CI configurations to remove Python 3.13 from the matrix.
  • Enhanced and reorganized documentation under docs/modules/tools.rst.
  • Bumped version from 0.8.6 to 0.8.7 to reflect the new tool.

Why This PR?

  • Improves file management by enabling partial or appended writes, chunk saving, and directory restriction.
  • Complements existing ReaderTool, CoderTool, and GitHubTool for a broader range of local and sandboxed file manipulations.

How to Test

  1. Initialize the WriterTool with an allowed_root path.
  2. Call open to create or open a document.
  3. Use write to append or overwrite content.
  4. Verify you can list_docs, close docs, and save_file/save_chunks within the allowed directory.
  5. Ensure writing outside the allowed path returns an error.

Issue Reference

ohdearquant and others added 20 commits January 22, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant