This issue focuses on migrating core utility functions from the JavaScript version of AgentM to Python. These utilities are fundamental to the library's operations, including token counting, error handling, concurrency management, and dynamic prompt generation.
Tasks
[ ] Token Counter Migration
[ ] Replace the JavaScript tokenCounter function with the tiktoken library in Python.
[ ] Ensure the Python implementation correctly handles tokenization and token counting for various model types.
[x] Error Handling Implementation
[x] Develop an error handler in Python that logs errors to .var/log/error.
[ ] Ensure proper access controls are in place for error logs.
[x] Concurrency Management with asyncio
[x] Implement concurrency handling using asyncio to manage parallel tasks in Python.
[x] Review and translate JavaScript concurrency logic to Python’s async/await syntax.
[x] Prompt Generation Utility
[x] Translate composePrompt.ts to Python to enable dynamic prompt generation.
[x] Ensure that prompt templates and variable replacements are accurately handled in Python.
Subtasks Overview
Token Counter: Migrate the tokenCounter utility to Python using tiktoken to handle token counting and model compatibility.
Error Handling: Implement a robust error logging mechanism in Python to capture and store errors with proper access control.
Concurrency Management: Adapt the JavaScript concurrency mechanisms to Python using asyncio, ensuring all asynchronous tasks are correctly managed.
Dynamic Prompt Generation: Convert the JavaScript utility for dynamic prompt generation to Python, ensuring compatibility with the Python string formatting methods.
Overview
This issue focuses on migrating core utility functions from the JavaScript version of AgentM to Python. These utilities are fundamental to the library's operations, including token counting, error handling, concurrency management, and dynamic prompt generation.
Tasks
[ ] Token Counter Migration
tokenCounter
function with the tiktoken library in Python.[x] Error Handling Implementation
.var/log/error
.[x] Concurrency Management with asyncio
[x] Prompt Generation Utility
composePrompt.ts
to Python to enable dynamic prompt generation.Subtasks Overview
tokenCounter
utility to Python usingtiktoken
to handle token counting and model compatibility.asyncio
, ensuring all asynchronous tasks are correctly managed.