PitchHut logo
TOON Context Optimizer
Seamless integration of TOON format for efficient token usage in VS Code.
Pitch

The TOON Context Optimizer enhances VS Code chat workflows by automatically converting attached JSON files to the TOON format when it reduces token usage. This ensures that teams can adopt TOON effortlessly, without modifying their existing processes, while optimizing interactions with language models.

Description

The TOON Context Optimizer enhances productivity by automatically converting attached JSON files into the TOON format during chats in Visual Studio Code (VS Code). This tool is designed to help teams adopt the TOON format effortlessly without requiring any changes to their existing workflows.

Key Features

  • Automatic Conversion: The TOON Context Optimizer inspects every JSON file attached to VS Code's chat and converts it to TOON format when it reduces token usage, ensuring users always send the most efficient data representation to the Large Language Model (LLM).
  • Token Efficiency: The comparison process between JSON and TOON formats leverages the @dqbd/tiktoken library to evaluate and choose the format that minimizes token usage for each chat request.

How It Functions

  1. A chat participant is registered through the VS Code extension API using @context.
  2. For each chat request, the tool gathers and decodes the JSON contents from attached files.
  3. The tool converts the JSON payloads to TOON and compares their token counts:
    • When TOON format results in fewer tokens, it is selected for sending.
    • If JSON format proves to be more token-efficient, it remains unchanged.
  4. The system streams a summary of the differences back to the user while forwarding the optimized content to the LLM, ensuring seamless communication.

Considerations

  • This tool relies on the @toon-format/toon package for TOON encoding.
  • Currently, it operates effectively on JSON files explicitly mentioned with @context. Work is ongoing to find solutions for intercepting generic file attachments.
  • The integration may evolve to include native browser support, further smoothing the adoption of TOON in workflows.
0 comments

No comments yet.

Sign in to be the first to comment.