{"id":50818226,"url":"https://github.com/igor-olikh/promptizer","last_synced_at":"2026-06-13T11:32:56.185Z","repository":{"id":325421160,"uuid":"1101085637","full_name":"igor-olikh/promptizer","owner":"igor-olikh","description":"A collaborative LLM system that uses OpenAI and Google Gemini to iteratively refine prompts until both models agree on the quality. Features file I/O, markdown comparison, and robust error handling.","archived":false,"fork":false,"pushed_at":"2025-11-21T08:22:56.000Z","size":84,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-21T09:24:17.818Z","etag":null,"topics":["ai","automation","collaborative-ai","gemini","llm","machine-learning","openai","poetry","prompt-engineering","prompt-optimization","prompt-refinement","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igor-olikh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-21T07:07:57.000Z","updated_at":"2025-11-21T08:22:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/igor-olikh/promptizer","commit_stats":null,"previous_names":["igor-olikh/promptizer"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/igor-olikh/promptizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igor-olikh%2Fpromptizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igor-olikh%2Fpromptizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igor-olikh%2Fpromptizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igor-olikh%2Fpromptizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igor-olikh","download_url":"https://codeload.github.com/igor-olikh/promptizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igor-olikh%2Fpromptizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34283390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","automation","collaborative-ai","gemini","llm","machine-learning","openai","poetry","prompt-engineering","prompt-optimization","prompt-refinement","python"],"created_at":"2026-06-13T11:32:55.569Z","updated_at":"2026-06-13T11:32:56.169Z","avatar_url":"https://github.com/igor-olikh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Promptizer\n\nA collaborative LLM system that uses OpenAI and Google Gemini to iteratively refine prompts until both models agree on the quality.\n\n## Overview\n\nPromptizer implements a sophisticated prompt refinement system where two independent Large Language Models (OpenAI GPT-4 and Google Gemini) work together to progressively improve a user-provided prompt. The system continues iterating until both models independently determine that the prompt has reached acceptable quality.\n\n## Features\n\n- **Collaborative Refinement**: Two LLMs work together to improve prompts\n- **Automatic Evaluation**: Models independently evaluate prompt quality\n- **Convergence Detection**: System stops when both models accept the prompt\n- **Asynchronous Processing**: Parallel API calls for efficiency\n- **Iteration Control**: Prevents infinite loops with configurable max iterations\n- **State Tracking**: Maintains history of all refinements\n- **File Input/Output**: Read prompts from files and automatically save outputs\n- **Markdown Comparison**: Generates color-coded markdown files comparing original vs refined prompts\n- **Error Handling**: Stops immediately on API errors to prevent wasting tokens\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/igor-olikh/promptizer.git\ncd promptizer\n```\n\n2. Install dependencies using Poetry:\n```bash\npoetry install\n```\n\n3. Create a `.env` file in the project root:\n```bash\ncp .env.example .env\n```\n\n4. Edit `.env` and add your API keys:\n```\nOPENAI_API_KEY=your_openai_api_key_here\nGOOGLE_API_KEY=your_google_api_key_here\n```\n\n## Usage\n\n### Command Line\n\n**List available models:**\n```bash\npoetry run python -m promptizer.main --list-models\n# Shows all available OpenAI and Gemini models\n# Validates your current configuration\n```\n\n**Direct prompt input:**\n```bash\npoetry run python -m promptizer.main \"Your initial prompt here\"\n```\n\n**File-based input:**\n```bash\n# Place your prompt in the prompt/ folder, then:\npoetry run python -m promptizer.main \"example.txt\"\n# Output will be written to \"example output.txt\" in the same folder\n```\n\n**Interactive mode:**\n```bash\npoetry run python -m promptizer.main\n# Then enter your prompt or file path when prompted\n```\n\n### File Input/Output\n\nThe system supports reading prompts from files and automatically writing outputs:\n\n1. **Place your prompt file** in the `prompt/` folder (or provide a full path)\n2. **Run with the filename**: `poetry run python -m promptizer.main \"my-prompt.txt\"`\n3. **Output is automatically written** to a corresponding file: `my-prompt output.txt`\n\nExample:\n- Input file: `prompt/code prompt to improve.txt`\n- Output file: `prompt/code prompt to improve output.txt`\n\nThe system automatically detects if the input is a file path (by checking for file extensions like `.txt`, `.md`, or if the file exists).\n\n### Markdown Comparison Output\n\nWhen refinement completes successfully, the system automatically generates a markdown comparison file:\n\n- **Input file**: `prompt/my-prompt.txt`\n- **Output file**: `prompt/my-prompt output.txt` (refined prompt)\n- **Markdown file**: `prompt/my-prompt.md` (color-coded comparison)\n\nThe markdown file includes:\n- Summary of the refinement process\n- Original prompt (yellow/amber background)\n- Refined prompt (green background)\n- Side-by-side comparison table\n- Refinement statistics\n\n### Python API\n\n```python\nimport asyncio\nfrom promptizer.orchestrator import PromptRefinementOrchestrator\n\nasync def refine_prompt():\n    orchestrator = PromptRefinementOrchestrator()\n    final_prompt, state_summary = await orchestrator.refine(\n        \"Your initial prompt here\",\n        verbose=True\n    )\n    return final_prompt\n\n# Run it\nfinal = asyncio.run(refine_prompt())\nprint(final)\n```\n\n## Configuration\n\nYou can configure the system via environment variables in your `.env` file:\n\n- `OPENAI_API_KEY`: Your OpenAI API key (required)\n- `GOOGLE_API_KEY`: Your Google Gemini API key (required)\n- `OPENAI_MODEL`: OpenAI model to use (default: `gpt-4`)\n- `GEMINI_MODEL`: Gemini model to use (default: `gemini-1.5-flash`)\n- `MAX_ITERATIONS`: Maximum number of iterations (default: `10`)\n\n### Checking Available Models\n\nIf you encounter model not found errors, use the model listing feature:\n\n```bash\npoetry run python -m promptizer.main --list-models\n```\n\nThis will:\n- List all available OpenAI models\n- List all available Gemini models (with generateContent support)\n- Show your current configuration\n- Validate if your configured models are available\n- Provide recommendations for fixing configuration issues\n\n## How It Works\n\n1. **Initial Prompt**: User provides a raw prompt\n2. **Iteration Loop**:\n   - Model A (OpenAI) receives the current prompt and generates an improved version\n   - Model B (Gemini) receives the current prompt and generates an improved version\n   - Both models evaluate whether the prompt is \"good enough\"\n   - The hub merges the results and updates the current prompt\n3. **Convergence**: When both models respond with \"ACCEPTED\", the loop stops\n4. **Output**: The final refined prompt is returned\n\n## Architecture\n\nSee the [documentation](docs/) folder for detailed architecture diagrams and system design.\n\n## License\n\nMIT License\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figor-olikh%2Fpromptizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figor-olikh%2Fpromptizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figor-olikh%2Fpromptizer/lists"}