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 Multiple Output Format Support for Artifacts #621

Merged

Conversation

sambhavnoobcoder
Copy link
Contributor

@sambhavnoobcoder sambhavnoobcoder commented Nov 4, 2024

Overview

This PR adds support for exporting artifacts to multiple file formats (.md, .txt, .pdf, .py) along with comprehensive test coverage. This enhancement allows users to flexibly convert and save their artifacts in different formats while maintaining content integrity.

Features

  • Support for multiple output formats:
    • Markdown (.md)
    • Plain text (.txt)
    • PDF (.pdf)
    • Python (.py) with proper docstrings
  • Automatic format-specific formatting
  • Comprehensive error handling
  • Extensive test coverage

Changes

  • Added save_as method to Artifact class
  • Implemented format-specific output handlers
  • Added PDF generation support using reportlab
  • Enhanced test suite with format-specific tests
  • Added proper cleanup in test teardown
  • Improved error handling and validation

Testing

  • Added unit tests for all supported formats
  • Added mock tests for file operations
  • Added tests for error conditions

Documentation

  • Updated existing docs with now being able to choose from multiple output types.
  • Updated docstrings with new functionality
  • Added examples for each format
  • Updated type hints and validation rules

Screenshots

Here are screenshots showing:

  1. Example outputs in different formats
  2. Test coverage report
  3. Documentation updates
Screenshot 2024-11-04 at 1 29 54 PM Screenshot 2024-11-04 at 1 28 26 PM Screenshot 2024-11-04 at 1 30 54 PM

Video Demonstration

Here is a short video demonstrating:

  1. Converting artifacts to different formats
  2. Test execution
    Here's the link for the same : https://drive.google.com/file/d/1Xq9EBUER5EB76uHkLiU9qpA5CHD9Z5DB/view?usp=sharing

Accessibility

  • Text-based formats maintain accessibility
  • PDF output follows accessibility guidelines
  • Format conversion preserves content structure

📚 Documentation preview 📚: https://swarms--621.org.readthedocs.build/en/621/

added support for 
- md
- pdf
- py 
- txt
add test for all output types
updated docs to reflect on the changes in the types of artifact support .
need this for pdf creation from scratch , used in artifact output type
make the comments more generailsed
@github-actions github-actions bot added documentation Improvements or additions to documentation tests artifacts labels Nov 4, 2024
added dependency to pyproject.toml  .
@kyegomez kyegomez merged commit e927669 into kyegomez:master Nov 4, 2024
4 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
artifacts documentation Improvements or additions to documentation tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants