Web Analytics

AlphaEvolveWriting

⭐ 114 stars Vietnamese by tamassimonds

🌐 Ngôn ngữ

AlphaEvolve Writing

Quy trình Viết AlphaEvolve

Bạn có thể xem giải thích đầy đủ tại đây

Bạn có thể tham khảo một truyện mẫu đã nộp cho cuộc thi viết tại đây

Một hệ thống viết hiện đại, tiến hóa sử dụng các mô hình AI để tạo ra, đánh giá và phát triển những câu chuyện sáng tạo hoặc các tác phẩm viết thông thường thông qua các vòng thi lặp lại. Được xây dựng với kiến trúc Python sạch sẽ, theo các nguyên tắc thiết kế hiện đại.

✨ Tính năng

🚀 Bắt đầu nhanh

Cài đặt

# Clone the repository
git clone https://github.com/your-org/alphaevolve-writing
cd alphaevolve-writing

Install with uv (recommended)

uv sync

Or install with pip

pip install -e .

Configure your API keys (see Configuration section below)

Chạy Tiến Hóa

# Run 5 evolution iterations
python evolve.py 5

Fresh start with 3 iterations

python evolve.py 3 --fresh

Use general writing mode

python evolve.py 5 --general

Show help

python evolve.py --help

🏗️ Kiến trúc

Hệ thống tuân theo các nguyên tắc thiết kế Python hiện đại với sự phân tách rõ ràng các mối quan tâm:

├── src/
│   ├── core/           # Pipeline orchestration
│   │   └── pipeline.py # Main EvolutionPipeline class
│   ├── generators/     # Story generation logic
│   │   ├── story_generator.py      # Initial & next batch generators
│   │   ├── generate_response.py    # Creative writing generation
│   │   ├── generate_response_general.py # General writing generation
│   │   └── judge_response.py       # AI judging system
│   ├── rankers/        # ELO ranking system
│   │   ├── elo_rank.py            # Core ELO algorithm
│   │   └── tournament_runner.py    # Tournament management
│   └── utils/          # Utility functions
│       └── inference.py           # Multi-provider LLM interface
├── evolve.py           # Clean CLI entry point
├── pyproject.toml      # Modern Python packaging
├── config.json         # Configuration
└── web_interface/      # Web UI for validation

Các Thành Phần Chính

📖 Cách Hoạt Động

Hệ thống tuân theo chu kỳ tiến hóa ba giai đoạn:

1. Tạo Lô Ban Đầu

2. Chạy Giải Đấu ELO

3. Tạo Lô Kế Tiếp

Quy trình lặp này giúp cải thiện chất lượng tác phẩm theo thời gian.

⚙️ Cấu Hình

Cài Đặt Cơ Bản

Chỉnh sửa các tệp quan trọng sau:

Thiết Lập API Keys

Hệ thống hỗ trợ nhiều nhà cung cấp AI khác nhau cấu hình qua config.json. Cấu hình này ánh xạ các mô hình đến nhà cung cấp và chỉ định biến môi trường chứa API keys:

{
  "llm_providers": {
    "openai": {
      "type": "openai",
      "base_url": "https://api.openai.com/v1",
      "api_key_env": "OPENAI_API_KEY"
    },
    "anthropic": {
      "type": "anthropic", 
      "api_key_env": "ANTHROPIC_API_KEY"
    },
    "deepinfra": {
      "type": "openai_compatible",
      "base_url": "https://api.deepinfra.com/v1/openai",
      "api_key_env": "DEEPINFRA_API_KEY"
    },
    "deepseek": {
      "type": "openai_compatible",
      "base_url": "https://api.deepseek.com/v1",
      "api_key_env": "DEEPSEEK_API_KEY"
    },
    "gemini": {
      "type": "openai_compatible",
      "api_key_env": "GEMINI_API_KEY",
      "base_url": "https://generativelanguage.googleapis.com/v1beta/openai/"
    }
  },
  "model_provider_mapping": {
    "gpt-4": "openai",
    "gpt-3.5-turbo": "openai", 
    "claude-3-sonnet-20240229": "anthropic",
    "meta-llama/Meta-Llama-3-70B-Instruct": "deepinfra",
    "deepseek-chat": "deepseek",
    "gemini-2.5-flash": "gemini"
  }
}
Sau đó, đặt các khóa API của bạn dưới dạng biến môi trường:

export OPENAI_API_KEY="your-openai-key"        # For GPT models
export ANTHROPIC_API_KEY="your-anthropic-key"  # For Claude models  
export DEEPINFRA_API_KEY="your-deepinfra-key"  # For Llama models
export DEEPSEEK_API_KEY="your-deepseek-key"    # For DeepSeek models
export GEMINI_API_KEY="your-gemini-key"          # For Gemini models
Bạn chỉ cần thiết lập các khóa cho các nhà cung cấp mà bạn dự định sử dụng. Hệ thống sẽ tự động chuyển các yêu cầu mô hình đến đúng nhà cung cấp dựa trên cấu hình.

Tùy chọn cấu hình

Tệp config.json kiểm soát toàn bộ hành vi của hệ thống:

{
  "batch_generation": {
    "num_stories": 10,
    "model": "gpt-4",
    "initial_elo": 1500
  },
  "elo_ranking": {
    "tournament_rounds": 50,
    "judge_model": "claude-3-sonnet-20240229",
    "k_factor": 32
  },
  "next_batch_generation": {
    "top_stories_to_select": 3,
    "variants_per_story": 2,
    "include_original_stories": true
  },
  "evolution_pipeline": {
    "max_iterations": 5,
    "auto_continue_from_existing": true
  }
}

🎭 Chế Độ Viết

Chế Độ Viết Sáng Tạo (Mặc Định)

Chế Độ Viết Chung (--general)

🔧 Cấu Hình Nâng Cao

Tùy Chỉnh Chiến Lược Tạo Nội Dung

Đối với người dùng nâng cao, bạn có thể tùy chỉnh các prompt tạo nội dung, phong cách tác giả, và tập nhiệm vụ bằng cách chỉnh sửa các file trong thư mục src/generators/:

#### Tùy Chỉnh Viết Sáng Tạo (src/generators/generate_response.py)

Tập Nhiệm Vụ - Định nghĩa các phương pháp và mục tiêu sáng tạo:

mission_sets = {
    "emotional_depth": [
        "Focus on the psychological depth of characters",
        "Explore complex emotional landscapes", 
        "Create moments of genuine human connection"
    ],
    "narrative_craft": [
        "Experiment with unique narrative structures",
        "Use vivid, sensory descriptions",
        "Create compelling story arcs"
    ],
    "dialogue_mastery": [
        "Write authentic, character-specific dialogue",
        "Use subtext and implied meaning",
        "Balance dialogue with action and description"
    ]
}
Phong cách tác giả - Mô phỏng các cách viết khác nhau:

author_styles = [
    "Write with the psychological insight of Virginia Woolf",
    "Adopt the sparse, powerful prose of Ernest Hemingway", 
    "Use the magical realism style of Gabriel García Márquez",
    "Employ the detailed world-building of Tolkien"
]
#### Tùy chỉnh Viết Chung (src/generators/generate_response_general.py)

Các Lĩnh Vực Học Thuật Trọng Tâm - Nhắm mục tiêu các lĩnh vực viết cụ thể:

academic_focuses = [
    "Rigorous analytical argument development",
    "Clear thesis statement and supporting evidence",
    "Proper academic citation and source integration",
    "Logical flow and coherent structure"
]
Phương pháp Viết - Định nghĩa các chiến lược phân tích:

writing_approaches = [
    "Comparative analysis with multiple perspectives",
    "Problem-solution framework with evidence",
    "Cause-and-effect reasoning with examples",
    "Critical evaluation with balanced arguments"
]

Tùy chỉnh Tiêu chí Đánh giá (src/generators/judge_response.py)

Bạn có thể sửa đổi các tiêu chí đánh giá và câu nhắc đánh giá để tập trung vào các khía cạnh cụ thể của chất lượng bài viết:

# Edit the judge_responses function to customize evaluation criteria
evaluation_criteria = [
    "Technical writing proficiency",
    "Creative originality and innovation", 
    "Emotional impact and reader engagement",
    "Structural coherence and flow",
    "Character development and authenticity"
]

Mẹo cho Cấu Hình Nâng Cao

Cách tiếp cận theo mô-đun này cho phép bạn tinh chỉnh quá trình tiến hóa cho mục tiêu và lĩnh vực viết của riêng mình.

🌐 Giao Diện Web

Xác minh kết quả tiến hóa của bạn với giao diện web tích hợp sẵn:

cd web_interface
pip install -r requirements.txt
python app.py
Mở http://localhost:5000 để truy cập:

```

--- Tranlated By Open Ai Tx | Last indexed: 2025-07-18 ---