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

[EPIC] Migrate AgentM Library from JavaScript to Python #22

Open
9 of 22 tasks
debuggerone opened this issue Sep 5, 2024 · 0 comments
Open
9 of 22 tasks

[EPIC] Migrate AgentM Library from JavaScript to Python #22

debuggerone opened this issue Sep 5, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@debuggerone
Copy link
Collaborator

debuggerone commented Sep 5, 2024

Epic: Migrate AgentM Library from JavaScript to Python

Setup and Infrastructure

  • Setup Python Environment
    • Use pipenv for managing dependencies and virtual environments.
    • Create a requirements.txt file to specify project dependencies.
    • Implement a basic project layout with directories for modules, tests, and documentation.

Core Utilities

  • Token Counter Migration
    • Replace the JavaScript tokenCounter function with tiktoken in Python.
  • Error Handling
    • Implement an error handler in Python that writes errors to .var/log/error and ensures proper access controls.
  • Concurrency Management
    • Use asyncio for managing concurrency in Python.
  • Prompt Generation
    • Translate composePrompt.ts to Python to enable dynamic prompt generation.

Agent Implementations

  • Migrate Agent Functions
    • Migrate functions such as filterList, mapList, sortList, and groundedAnswer to Python.
    • Ensure all logic, especially asynchronous functions, is properly translated to Python's async/await syntax.
  • Utility Function Translation
    • Convert utility functions (e.g., those in splitText.ts) to Python, ensuring all functionalities are preserved.

OpenAI Integration

  • API Client Setup
    • Use an existing OpenAI Python client for API interactions.
    • Migrate OpenAI-specific configurations and functions from openai.ts to Python. (Store these in .settings/config.py).
  • Model Handling
    • Implement Python functions to handle OpenAI model completions, structured outputs, and error cases.
    • Ensure robust error handling, including wait logic for handling 429 status codes.
  • Tokenizer Support
    • Migrate tokenizer configuration logic from openai.ts to Python.
    • Ensure compatibility with Python tokenizer libraries.

Testing and Validation

  • Unit Testing
    • Write unit tests for each module to ensure feature parity with the JavaScript version.
    • Use pytest or similar Python testing frameworks for comprehensive test coverage.
  • Integration Testing
    • Implement integration tests to verify that modules interact correctly within the Python environment.
  • Performance Testing
    • Perform benchmarks to ensure the Python version maintains performance standards comparable to the JavaScript implementation.

Documentation and Examples

  • Update Documentation
    • Update all documentation to reflect the Python implementation, including function signatures and usage examples.
  • Convert Example Scripts
    • Translate example scripts from JavaScript to Python, ensuring they demonstrate the same functionality and workflows.
  • Readme and Setup Instructions
    • Update the README file with Python-specific setup instructions and usage guidelines.
  • Contribute.md
    • Create a Contribute.md file outlining the process for contributing to the Python version of the library.

Acceptance Criteria

  • All functionalities from the JavaScript version are successfully migrated to Python.
  • The Python library passes all unit, integration, and performance tests.
  • Documentation is complete and accurately reflects the Python version.
  • Example scripts are functional and demonstrate key features of the library.
  • The Python package is ready for distribution (e.g., available on PyPI).
@debuggerone debuggerone added the good first issue Good for newcomers label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant