### Install Dependencies Source: https://github.com/codium-ai/alphacodium/blob/main/docs/docs/index.md Setup a virtual environment and install required packages using pip. ```bash pip install -r requirements.txt ``` -------------------------------- ### Setup Virtual Environment and Install Dependencies Source: https://github.com/codium-ai/alphacodium/blob/main/README.md Use these bash commands to set up a Python virtual environment and install project dependencies from the requirements.txt file. ```bash python3 -m venv venv source ./venv/bin/activate pip install -r requirements.txt ``` -------------------------------- ### Install Dependencies and Configure API Key Source: https://context7.com/codium-ai/alphacodium/llms.txt Set up a virtual environment, install project dependencies, and configure your API key by copying and editing the secrets template file. Ensure the processed CodeContests dataset is placed at the project root. ```bash # 1. Create and activate virtual environment python3 -m venv venv source ./venv/bin/activate pip install -r requirements.txt # 2. Set up API key cp alpha_codium/settings/.secrets_template.toml alpha_codium/settings/.secrets.toml # Edit .secrets.toml and fill in your key: # [openai] # key = "sk-..." # 3. Download the processed CodeContests dataset from HuggingFace, extract it, # and place the folder at the project root as: ./valid_and_test_processed/ ``` -------------------------------- ### Custom Problem Definition JSON Source: https://context7.com/codium-ai/alphacodium/llms.txt Example JSON structure for defining a custom problem. It includes problem details, test cases, and expected outputs. ```json // my_problem.json — full schema with all optional fields { "name": "Sorting Andi and Budi Books Problem", "description": "Given n strings of length m, sort them in asc-desc-ending order: odd-indexed character positions are compared ascending, even-indexed positions descending. Output the 1-based indices of the sorted strings.\n\nInput: first line has n and m; next n lines each contain a string of m uppercase Latin letters.\nOutput: n space-separated indices.\n\nExample Input:\n5 2\nAA\nAB\nBB\nBA\nAZ\n\nExample Output:\n5 2 1 3 4", "public_tests": { "input": ["5 2\nAA\nAB\nBB\nBA\nAZ\n"], "is_valid_test": null, "output": ["5 2 1 3 4 \n"] }, "private_tests": { "input": [], "is_valid_test": null, "output": [] }, "generated_tests": { "input": ["5 2\nAA\nAB\nCC\nBA\nAZ\n"], "is_valid_test": null, "output": ["5 2 1 3 4\n"] } } ``` -------------------------------- ### evaluate_solution_on_subset Source: https://context7.com/codium-ai/alphacodium/llms.txt Executes a generated code solution against a named subset of tests (public, private, or generated) and returns pass/fail/timeout counts. Used after every code-generation stage to guide the iterative fixing loop. ```APIDOC ## `evaluate_solution_on_subset` — Run Tests Against a Code Solution Executes a generated code solution against a named subset of tests (public, private, or generated) and returns pass/fail/timeout counts. Used after every code-generation stage to guide the iterative fixing loop. ### Parameters - **evaluation_test_type** (str) - The type of tests to run (e.g., "public_tests", "private_tests", "generated_tests"). - **problem** (dict) - A dictionary containing the problem definition, including test cases. - **name** (str) - The name of the problem. - **description** (str) - A description of the problem. - **public_tests** (dict) - Dictionary with 'input' and 'output' lists for public tests. - **private_tests** (dict) - Dictionary with 'input' and 'output' lists for private tests. - **generated_tests** (dict) - Dictionary with 'input' and 'output' lists for generated tests. - **solution** (str) - The code solution to evaluate. - **silent** (bool, optional) - If True, suppresses output during evaluation. Defaults to False. ### Returns - **test_results** - Detailed results of the test execution. - **passed** (int) - The number of tests that passed. - **failed** (int) - The number of tests that failed. - **timeout** (int) - The number of tests that timed out. ### Request Example ```python from alpha_codium.gen.utils import evaluate_solution_on_subset problem = { "name": "Add Two Numbers", "description": "Print the sum of two integers.", "public_tests": { "input": ["3 5\n", "10 20\n"], "output": ["8\n", "30\n"] }, "private_tests": {"input": [], "output": []}, "generated_tests": {"input": ["100 200\n"], "output": ["300\n"]} } solution_code = "a, b = map(int, input().split())\nprint(a + b)" test_results, passed, failed, timeout = evaluate_solution_on_subset( evaluation_test_type="public_tests", problem=problem, solution=solution_code, silent=False, ) print(f"passed={passed}, failed={failed}, timeout={timeout}") # Check generated tests too _, p2, f2, t2 = evaluate_solution_on_subset("generated_tests", problem, solution_code, silent=True) print(f"generated: passed={p2}, failed={f2}, timeout={t2}") ``` ``` -------------------------------- ### Evaluate Code Solution Against Test Subsets Source: https://context7.com/codium-ai/alphacodium/llms.txt Executes a code solution against specified test subsets (public, private, generated) and returns pass/fail/timeout counts. Essential for guiding iterative code fixing. ```python from alpha_codium.gen.utils import evaluate_solution_on_subset problem = { "name": "Add Two Numbers", "description": "Print the sum of two integers.", "public_tests": { "input": ["3 5\n", "10 20\n"], "output": ["8\n", "30\n"] }, "private_tests": {"input": [], "output": []}, "generated_tests": {"input": ["100 200\n"], "output": ["300\n"]} } solution_code = "a, b = map(int, input().split())\nprint(a + b)" test_results, passed, failed, timeout = evaluate_solution_on_subset( evaluation_test_type="public_tests", problem=problem, solution=solution_code, silent=False, ) print(f"passed={passed}, failed={failed}, timeout={timeout}") # ===================================== # test_passed: 2, test_failed: 0, test_timeout: 0 # ===================================== # passed=2, failed=0, timeout=0 # Check generated tests too _, p2, f2, t2 = evaluate_solution_on_subset("generated_tests", problem, solution_code, silent=True) print(f"generated: passed={p2}, failed={f2}, timeout={t2}") # generated: passed=1, failed=0, timeout=0 ``` -------------------------------- ### Evaluate Solution Database via CLI Source: https://context7.com/codium-ai/alphacodium/llms.txt Use the CLI to compute pass@K accuracy metrics for solutions stored in a database. This command analyzes the results from `solve_dataset`. ```bash python -m alpha_codium.evaluate_dataset \ --dataset_name ./valid_and_test_processed \ --split_name valid \ --database_solution_path ./output/valid_solutions.json # Console output: # problem 0 passed all tests # problem 1 passed all tests # problem 3 passed all tests # ... # total_passed: 51, total_failed: 66 # pass rate: 0.4358974358974359 ``` -------------------------------- ### Lightweight Single-Turn LLM Wrapper with SimplePrompt Source: https://context7.com/codium-ai/alphacodium/llms.txt A simple wrapper for making one-shot LLM calls. Ideal for quick prompt testing or building lightweight tools. ```python import asyncio from alpha_codium.gen.generators import SimplePrompt # Custom system prompt p = SimplePrompt( system_prompt="You are a Python expert. Answer concisely.", temperature=0.2, frequency_penalty=0.0, ) async def main(): response = await p.run("What is the time complexity of binary search?") print(response) # O(log n) - binary search halves the search space each iteration. asyncio.run(main()) ``` -------------------------------- ### Evaluate Dataset Solutions Source: https://github.com/codium-ai/alphacodium/blob/main/docs/docs/index.md Evaluate the generated solutions for the entire dataset. Provide the dataset path, split name, and the path to the saved solutions. ```bash python -m alpha_codium.evaluate_dataset\ --dataset_name /path/to/dataset\ --split_name test\ --database_solution_path /path/to/output/dir/dataset_output.json ``` -------------------------------- ### SimplePrompt Source: https://context7.com/codium-ai/alphacodium/llms.txt A convenience class for making one-shot LLM calls without setting up the full competitor pipeline. Useful for quickly testing prompts or building lightweight tools on top of the AlphaCodium LLM infrastructure. ```APIDOC ## `SimplePrompt` — Lightweight Single-Turn LLM Wrapper A convenience class for making one-shot LLM calls without setting up the full competitor pipeline. Useful for quickly testing prompts or building lightweight tools on top of the AlphaCodium LLM infrastructure. ### Initialization ```python SimplePrompt( system_prompt: str, temperature: float = 0.2, frequency_penalty: float = 0.0, # ... other parameters passed to AiHandler.chat_completion ) ``` ### Parameters - **system_prompt** (str) - The system prompt to guide the LLM's behavior. - **temperature** (float, optional) - Controls randomness. Defaults to 0.2. - **frequency_penalty** (float, optional) - Penalizes new tokens based on their existing frequency. Defaults to 0.0. ### Method - **run(user_prompt: str)**: Executes a single-turn LLM call with the provided user prompt. ### Request Example ```python import asyncio from alpha_codium.gen.generators import SimplePrompt p = SimplePrompt( system_prompt="You are a Python expert. Answer concisely.", temperature=0.2, frequency_penalty=0.0, ) async def main(): response = await p.run("What is the time complexity of binary search?") print(response) asyncio.run(main()) ``` ``` -------------------------------- ### Configure AlphaCodium Settings Source: https://context7.com/codium-ai/alphacodium/llms.txt The `configuration.toml` file controls LLM model selection, rate limits, and per-stage behavior. Tuneable parameters for each stage of the AlphaCodium flow are set here. ```toml [config] model = "gpt-4-0125-preview" # or "gpt-4o-2024-05-13", "gpt-3.5-turbo-16k" frequency_penalty = 0.1 ai_timeout = 90 # seconds per LLM call fallback_models = [] verbosity_level = 0 # 0=minimal, 1=info, 2=debug max_requests_per_minute = 60 [dataset] num_iterations = 1 # pass@K — increase for better results use_iteration_scheme = true [solve] reduce_verbose = false use_baseline = false # if true, skip flow and use single direct prompt use_direct_solutions = false [self_reflection] validate_self_reflection = false # double-validation pass on reflection output [possible_solutions] max_num_of_possible_solutions = 3 use_test_explanations = true remove_bruce_force_solutions = true [generate_ai_tests] validate_ai_tests = false number_of_ai_tests = 6 use_test_explanations = true add_public_tests_to_ai_tests = true [initial_code_generation] max_attempts = 8 [public_tests] max_allowed_calls = 4 max_fixes_per_test = 3 single_stage_fix = true [ai_tests] max_allowed_calls = 4 [code_tester] tester_type = "local" # "local" or "code_contests" sandbox = true delta = 0.0001 ``` -------------------------------- ### Solve Entire Dataset Split via CLI Source: https://context7.com/codium-ai/alphacodium/llms.txt Use the CLI to process all problems within a specified dataset split (e.g., 'valid' or 'test'). Solutions and metrics are saved to a JSON database. Supports resuming interrupted runs. ```bash # Solve the validation split and save results python -m alpha_codium.solve_dataset \ --dataset_name ./valid_and_test_processed \ --split_name valid \ --database_solution_path ./output/valid_solutions.json # Solve the test split (165 problems — may take several days with GPT-4) python -m alpha_codium.solve_dataset \ --dataset_name ./valid_and_test_processed \ --split_name test \ --database_solution_path ./output/test_solutions.json ``` -------------------------------- ### Evaluate Dataset Solutions with AlphaCodium Source: https://github.com/codium-ai/alphacodium/blob/main/README.md Run this command to evaluate the solutions generated for a dataset split. This requires the same dataset and solution path used during the solving process. ```bash python -m alpha_codium.evaluate_dataset \ --dataset_name /path/to/dataset \ --split_name test \ --database_solution_path /path/to/output/dir/dataset_output.json ``` -------------------------------- ### Solve a New Custom Problem with AlphaCodium Source: https://github.com/codium-ai/alphacodium/blob/main/README.md To solve a custom problem, first create a JSON file detailing the problem's fields, then execute this command. The JSON file should include problem name, description, and optionally test cases. ```bash python -m alpha_codium.solve_my_problem \ --my_problem_json_file /path/to/my_problem.json ``` -------------------------------- ### Configure OpenAI API Key Source: https://github.com/codium-ai/alphacodium/blob/main/docs/docs/index.md Duplicate the secrets template and fill in your OpenAI API key to enable API access. ```toml [openai] key = "..." ``` -------------------------------- ### Solve Custom Problem Programmatically Source: https://context7.com/codium-ai/alphacodium/llms.txt Programmatic usage for solving a custom problem. Loads a problem from a JSON file and uses the `solve_my_problem` function. Requires `setup_logger`. ```python # Programmatic usage import json from alpha_codium.gen.coding_competitor import solve_my_problem from alpha_codium.log import setup_logger setup_logger() with open("my_problem.json", "r") as f: problem = json.load(f) solution, test_results = solve_my_problem(problem) print(solution) # Expected output: a working Python function/script, e.g.: # n, m = map(int, input().split()) # books = [input() for _ in range(n)] # def key(s): return tuple(c if i%2==0 else chr(ord('z')*2-ord(c)) for i,c in enumerate(s)) # indices = sorted(range(1, n+1), key=lambda i: key(books[i-1])) # print(*indices) ``` -------------------------------- ### Solve Custom Problem via CLI Source: https://context7.com/codium-ai/alphacodium/llms.txt Use this command to solve a custom problem defined in a JSON file using the CLI. Ensure the JSON file adheres to the CodeContests schema. ```bash python -m alpha_codium.solve_my_problem \ --my_problem_json_file ./my_problem_example.json ``` -------------------------------- ### Problem Statement: Building an Amusement Park Source: https://github.com/codium-ai/alphacodium/blob/main/README.md This snippet outlines the 'Building an Amusement Park' problem, including its description, input format, output requirements, and constraints. It's useful for understanding the problem's geometric and computational challenges. ```plaintext problem name: '1575_B. Building an Amusement Park' problem description: Mr. Chanek lives in a city represented as a plane. He wants to build an amusement park in the shape of a circle of radius r. The circle must touch the origin (point (0, 0)). There are n bird habitats that can be a photo spot for the tourists in the park. The i-th bird habitat is at point p_i = (x_i, y_i). Find the minimum radius r of a park with at least k bird habitats inside. A point is considered to be inside the park if and only if the distance between p_i and the center of the park is less than or equal to the radius of the park. Note that the center and the radius of the park do not need to be integers. In this problem, it is guaranteed that the given input always has a solution with r ≤ 2 ⋅ 10^5. Input The first line contains two integers n and k (1 ≤ n ≤ 10^5, 1 ≤ k ≤ n) — the number of bird habitats in the city and the number of bird habitats required to be inside the park. The i-th of the next n lines contains two integers x_i and y_i (0 ≤ |x_i|, |y_i| ≤ 10^5) — the position of the i-th bird habitat. Output Output a single real number r denoting the minimum radius of a park with at least k bird habitats inside. It is guaranteed that the given input always has a solution with r ≤ 2 ⋅ 10^5. Your answer is considered correct if its absolute or relative error does not exceed 10^{-4}. Formally, let your answer be a, and the jury's answer be b. Your answer is accepted if and only if rac{|a - b|}{max{(1, |b|)}} ≤ 10^{-4}. Examples Input 8 4 -3 1 -4 4 1 5 2 2 2 -2 -2 -4 -1 -1 -6 0 Output 3.1622776589 Input 1 1 0 0 Output 0.0000000000 Note In the first example, Mr. Chanek can put the center of the park at (-3, -1) with radius √{10} ≈ 3.162. It can be proven this is the minimum r. ``` -------------------------------- ### Solve the Entire Dataset with AlphaCodium Source: https://github.com/codium-ai/alphacodium/blob/main/docs/docs/index.md Execute AlphaCodium to process the entire dataset. This is a long-running process and requires specifying output paths for solutions. ```bash python -m alpha_codium.solve_dataset \ --dataset_name /path/to/dataset \ --split_name test --database_solution_path /path/to/output/dir/dataset_output.json ``` -------------------------------- ### Solve Entire Dataset Split Programmatically Source: https://context7.com/codium-ai/alphacodium/llms.txt Programmatic usage for solving a dataset split. Configure the number of iterations in `configuration.toml`. This function processes problems and saves results to a specified database path. ```python # Programmatic usage with custom iteration count # First, in configuration.toml set: dataset.num_iterations = 5 from alpha_codium.gen.dataset_solver import solve_dataset solve_dataset( dataset_name="./valid_and_test_processed", split_name="valid", database_solution_path="./output/valid_solutions.json" ) # Output database structure (valid_solutions.json): # { # "valid": { # "0": { # "iteration_0": { # "solution": "n, m = map(int, ...) ...", # "test_passed_public": 2, # "test_failed_public": 0, # "test_timeout_public": 0, # "test_passed_private": 5, # "test_failed_private": 0, # "test_timeout_private": 0, # "test_passed_generate": 6, # "test_failed_generate": 0, # "test_timeout_generate": 0 # } # }, # ... # } # } ``` -------------------------------- ### Solve a Single Problem from CodeContests Dataset Source: https://context7.com/codium-ai/alphacodium/llms.txt This command loads a problem from the CodeContests dataset, runs the full AlphaCodium flow, and prints the generated solution with test pass/fail counts. You can specify the problem by number or name. ```bash # Solve problem number 12 from the test split python -m alpha_codium.solve_problem \ --dataset_name ./valid_and_test_processed \ --split_name test \ --problem_number 12 # Solve by problem name from the validation split python -m alpha_codium.solve_problem \ --dataset_name ./valid_and_test_processed \ --split_name valid \ --problem_name "1575_B. Building an Amusement Park" # Output logged to: alpha_codium/gen/example.log # Console output (example): # problem_name: 1575_B. Building an Amusement Park # Running code contests competitor, model gpt-4-0125-preview # --reflection stage-- # --generate possible solutions stage-- # --choose best solution stage-- # --generate ai tests stage-- # --initial code generation stage-- # test_passed_public: 2, test_failed_public: 0, test_timeout_public: 0 # test_passed_private: 8, test_failed_private: 0, test_timeout_private: 0 ``` -------------------------------- ### Google Tag Manager Initialization Source: https://github.com/codium-ai/alphacodium/blob/main/docs/overrides/partials/integrations/analytics/custom.html Embed this script to initialize Google Tag Manager. Ensure the GTM ID is correct for your property. ```javascript (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-NP4XQB2G'); ``` -------------------------------- ### AiHandler.chat_completion Source: https://context7.com/codium-ai/alphacodium/llms.txt The async method wrapping `litellm.acompletion` with rate-limiting, retry logic, and multi-model support. Used internally by all pipeline stages; can be called directly for custom LLM interactions. ```APIDOC ## `AiHandler.chat_completion` — Low-Level LLM Invocation The async method wrapping `litellm.acompletion` with rate-limiting, retry logic, and multi-model support. Used internally by all pipeline stages; can be called directly for custom LLM interactions. ### Method Signature ```python async def chat_completion( model: str, system: str, user: str, temperature: float = 0.2, frequency_penalty: float = 0.0, # ... other litellm parameters ) ``` ### Parameters - **model** (str) - The LLM model to use (e.g., "gpt-4-0125-preview"). - **system** (str) - The system prompt to guide the LLM's behavior. - **user** (str) - The user's prompt or question. - **temperature** (float, optional) - Controls randomness. Defaults to 0.2. - **frequency_penalty** (float, optional) - Penalizes new tokens based on their existing frequency. Defaults to 0.0. ### Returns - **response** - The LLM's generated response. - **finish_reason** - The reason the LLM stopped generating text (e.g., "stop"). ### Request Example ```python import asyncio from alpha_codium.llm.ai_handler import AiHandler handler = AiHandler() async def call_llm(): response, finish_reason = await handler.chat_completion( model="gpt-4-0125-preview", system="You are an expert competitive programmer. Respond only in Python.", user="Write a function to check if a number is prime.", temperature=0.2, frequency_penalty=0.1, ) print(f"finish_reason: {finish_reason}") print(response) return response asyncio.run(call_llm()) ``` ``` -------------------------------- ### Run Multiple Iterations for Pass@K Source: https://context7.com/codium-ai/alphacodium/llms.txt Iterates through a problem multiple times to solve it, collecting solutions. Useful for harder problems where multiple attempts increase the chance of success. ```python solutions = [] for i in range(3): sol = competitor.solve_problem_in_dataset(problem, iteration=i) solutions.append(sol) print(f"Iteration {i}: {repr(sol[:60])}") ``` -------------------------------- ### Solve Entire Dataset Split with AlphaCodium Source: https://github.com/codium-ai/alphacodium/blob/main/README.md Use this command to solve a specified dataset split. Ensure you provide valid paths for the dataset, split name, and output directory. This process can be lengthy, especially with larger models and multiple iterations. ```bash python -m alpha_codium.solve_dataset \ --dataset_name /path/to/dataset \ --split_name test \ --database_solution_path /path/to/output/dir/dataset_output.json ``` -------------------------------- ### Robust YAML Parsing for LLM Output Source: https://context7.com/codium-ai/alphacodium/llms.txt Parses YAML from LLMs, handling markdown fences and minor formatting errors. Includes automatic repair for multi-line strings. ```python from alpha_codium.gen.utils import load_yaml # Clean YAML from LLM clean_response = """ ```yaml self_reflection: - The problem requires binary search on the answer - Edge case: when k equals n, the answer is 0 tests_explanations: - input: \"1 1\n0 0\" output: \"0.0000000000\" explanation: \"Single point at origin, radius is 0\" ``` """ data = load_yaml(clean_response) print(data["self_reflection"]) # ['The problem requires binary search on the answer', # 'Edge case: when k equals n, the answer is 0'] # Malformed YAML (missing block scalar) — auto-repaired malformed = """ possible_solutions: - name: Binary Search description: Binary search on the radius value complexity: O(n log n) """ data = load_yaml(malformed, keys_fix_yaml=["description:"]) print(data["possible_solutions"][0]["name"]) # Binary Search ``` -------------------------------- ### Low-Level LLM Invocation with AiHandler Source: https://context7.com/codium-ai/alphacodium/llms.txt Directly calls the chat completion API with built-in rate limiting and retry logic. Use for custom LLM interactions when pipeline stages are not sufficient. ```python import asyncio from alpha_codium.llm.ai_handler import AiHandler from alpha_codium.settings.config_loader import get_settings # Requires .secrets.toml with valid API key handler = AiHandler() async def call_llm(): response, finish_reason = await handler.chat_completion( model="gpt-4-0125-preview", system="You are an expert competitive programmer. Respond only in Python.", user="Write a function to check if a number is prime.", temperature=0.2, frequency_penalty=0.1, ) print(f"finish_reason: {finish_reason}") # "stop" print(response) # def is_prime(n): # if n < 2: return False # for i in range(2, int(n**0.5) + 1): # if n % i == 0: return False # return True return response asyncio.run(call_llm()) ``` -------------------------------- ### Core Flow Orchestrator Class Source: https://context7.com/codium-ai/alphacodium/llms.txt Instantiate `CodeContestsCompetitor` to run the full AlphaCodium multi-stage flow programmatically. This class orchestrates all pipeline stages for solving problems. ```python import asyncio from alpha_codium.gen.coding_competitor import CodeContestsCompetitor from alpha_codium.log import setup_logger setup_logger() problem = { "name": "Sum of Two Numbers", "description": "Given two integers a and b on a single line, print their sum.\nInput: a b (1 <= a, b <= 10^9)\nOutput: a+b", "public_tests": { "input": ["3 5\n", "1000000000 1000000000\n"], "output": ["8\n", "2000000000\n"] } } competitor = CodeContestsCompetitor() # Run one iteration of the full flow solution = competitor.solve_problem_in_dataset(problem, iteration=0) print(solution) # Expected: # a, b = map(int, input().split()) # print(a + b) ``` -------------------------------- ### load_yaml / try_fix_yaml Source: https://context7.com/codium-ai/alphacodium/llms.txt Parses YAML produced by LLMs, which is often wrapped in markdown code fences or contains minor formatting errors. Falls back to `try_fix_yaml` which attempts automatic repair by inserting block scalar indicators (`|-`) around problematic multi-line string values. ```APIDOC ## `load_yaml` / `try_fix_yaml` — Robust YAML Parser for LLM Output Parses YAML produced by LLMs, which is often wrapped in markdown code fences or contains minor formatting errors. Falls back to `try_fix_yaml` which attempts automatic repair by inserting block scalar indicators (`|-`) around problematic multi-line string values. ### Parameters - **yaml_string** (str) - The YAML string to parse. - **keys_fix_yaml** (list[str], optional) - A list of keys for which to attempt automatic repair of multi-line string values. Defaults to None. ### Returns - **dict** - The parsed YAML data as a Python dictionary. ### Request Example (Clean YAML) ```python from alpha_codium.gen.utils import load_yaml clean_response = """ ```yaml self_reflection: - The problem requires binary search on the answer - Edge case: when k equals n, the answer is 0 tests_explanations: - input: \"1 1\n0 0\" output: \"0.0000000000\" explanation: \"Single point at origin, radius is 0\" ``` """ data = load_yaml(clean_response) print(data["self_reflection"]) ``` ### Request Example (Malformed YAML with Auto-Repair) ```python from alpha_codium.gen.utils import load_yaml malformed = """ possible_solutions: - name: Binary Search description: Binary search on the radius value complexity: O(n log n) """ data = load_yaml(malformed, keys_fix_yaml=["description:"]) print(data["possible_solutions"][0]["name"]) ``` ``` -------------------------------- ### Solve a Specific Problem with AlphaCodium Source: https://github.com/codium-ai/alphacodium/blob/main/docs/docs/index.md Run AlphaCodium to solve a single problem from the dataset. Ensure the dataset path and problem number are correctly specified. ```bash python -m alpha_codium.solve_problem \ --dataset_name /path/to/dataset \ --split_name test \ --problem_number 0 ``` -------------------------------- ### Citation for AlphaCodium Source: https://github.com/codium-ai/alphacodium/blob/main/README.md This snippet provides the citation details for the AlphaCodium paper. It is useful for academic referencing. ```bibtex @misc{ridnik2024code, title={Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineering}, author={Tal Ridnik and Dedy Kredo and Itamar Friedman}, year={2024}, eprint={2401.08500}, archivePrefix={arXiv}, primaryClass={cs.LG} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.