Skip to content

Edit Role

The edit role is specialized for text editing, code modification, and content optimization, providing intelligent editing suggestions and improvements.

Configuration

Configure in config.yaml or ~/.bytebuddy/config.yaml:

yaml
models:
  - name: "code-editor"
    provider: "anthropic"
    model: "claude-3-sonnet"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.3
      maxTokens: 2048

Core Features

Code Editing

  • Refactoring: Improve code structure and design
  • Optimization: Enhance code performance and efficiency
  • Fixing: Correct errors and bugs
  • Formatting: Standardize code style

Text Editing

  • Grammar Correction: Identify and fix grammar errors
  • Spell Check: Find and correct spelling mistakes
  • Style Optimization: Improve text style and tone

Edit Scenario Configurations

Code Refactoring

yaml
models:
  - name: "refactor-editor"
    provider: "anthropic"
    model: "claude-3-sonnet"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.2
      maxTokens: 4096

Document Editing

yaml
models:
  - name: "doc-editor"
    provider: "openai"
    model: "gpt-4"
    apiKey: "${OPENAI_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.4
      maxTokens: 2048

Quick Fix

yaml
models:
  - name: "quick-fix"
    provider: "openai"
    model: "gpt-3.5-turbo"
    apiKey: "${OPENAI_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.2
      maxTokens: 1024

Specialized Editor Configurations

Academic Writing Editor

yaml
models:
  - name: "academic-editor"
    provider: "openai"
    model: "gpt-4"
    apiKey: "${OPENAI_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.2
      maxTokens: 4096

Technical Documentation Editor

yaml
models:
  - name: "technical-editor"
    provider: "anthropic"
    model: "claude-3-sonnet"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.1
      maxTokens: 8192

Business Writing Editor

yaml
models:
  - name: "business-editor"
    provider: "google"
    model: "gemini-pro"
    apiKey: "${GOOGLE_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.3
      maxTokens: 2048

Creative Writing Editor

yaml
models:
  - name: "creative-editor"
    provider: "openai"
    model: "gpt-4"
    apiKey: "${OPENAI_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.7
      maxTokens: 3072

Multi-Model Configuration

yaml
models:
  - name: "code-edit"
    provider: "anthropic"
    model: "claude-3-sonnet"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.2
      maxTokens: 4096

  - name: "text-edit"
    provider: "openai"
    model: "gpt-4"
    apiKey: "${OPENAI_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.4
      maxTokens: 2048

  - name: "quick-edit"
    provider: "openai"
    model: "gpt-3.5-turbo"
    apiKey: "${OPENAI_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.3
      maxTokens: 1024

Best Practices

1. Temperature Settings

  • Code Refactoring (0.1-0.3): Requires precision
  • Document Optimization (0.3-0.5): Balance accuracy and creativity
  • Creative Editing (0.6-0.8): More creativity

2. Token Management

  • Small Changes: 512-1024 tokens
  • Medium Edits: 1024-2048 tokens
  • Large Refactoring: 2048-4096 tokens
  • Complete Rewrite: 4096+ tokens

3. Editing Strategy

  • Clearly specify editing goals
  • Provide sufficient context
  • Handle one major change at a time
  • Validate editing results

4. Quality Control

  • Use lower temperature for accuracy
  • Check consistency of edits
  • Preserve original intent
  • Test code changes

Troubleshooting

Common Issues

  1. Over-Editing

    • Lower temperature value
    • Explicitly limit edit scope
    • Use more conservative prompts
  2. Insufficient Changes

    • Increase temperature
    • Provide more detailed requirements
    • Use more powerful models
  3. Formatting Issues

    • Specify output format
    • Provide format examples
    • Use dedicated formatting tools

Environment Variables

bash
# ~/.bashrc or ~/.zshrc
export OPENAI_API_KEY="your-openai-api-key"
export ANTHROPIC_API_KEY="your-anthropic-api-key"
export GOOGLE_API_KEY="your-google-api-key"

Through proper edit role configuration, you can achieve efficient and accurate code and text editing experience.