Skip to content

An automatic prompt iteration and optimization generator suitable for any scenario

License

Notifications You must be signed in to change notification settings

XiangJinyu/APrompt

Repository files navigation

APrompt 🤖

Project Banner

An automated prompt engineering tool for Large Language Models (LLMs), designed for universal domain adaptation.

License

✨ Features

  • 💰 Ultra-low iteration cost ($0.1 level)
  • 🏷️ Label-free approach - no training data needed
  • 📊 Few-shot learning with minimal examples
  • ⚡ Super simple template configuration
  • 🌐 Multi-language support

🚀 Quick Start

1. Configure Your API Key ⚙️

Create a configuration file config.yaml:

openai:
  api_key: " "
  base_url: " "

2. Define Your Prompt Template 📝

Create a prompt template file settings/task_name.yaml:

prompt: |
  solve question.

requirements: |
  ...

count: None

faq:
  - question: |
      ...
    answer: |
      ...

  - question: |
      ...
    answer: |
      ...

3. Implement the Optimizer 🔧

Use main.py to execute:

from script.optimizer import Optimizer

if __name__ == "__main__":

    optimizer = Optimizer(
        optimized_path="workspace",
        initial_round=1,
        max_rounds=10,
        template="task_name.yaml",
        name="Task",
        optimize_model={"name": "claude-3-5-sonnet-20240620", "temperature": 0.7},
        execute_model={"name": "gpt-4o-mini", "temperature": 0},
        evaluate_model={"name": "gpt-4o-mini", "temperature": 0.3},
        iteration=True,
    )

    optimizer.optimize()

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


Made with ❤️ by the MetaGPT and AFlow Team

About

An automatic prompt iteration and optimization generator suitable for any scenario

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages