MCPcopy Create free account

hub / github.com/FareedKhan-dev/ai-long-task / functions

Functions222 in github.com/FareedKhan-dev/ai-long-task

↓ 121 callersMethodget
Get a program by ID Args: program_id: Program ID Returns: Program or None if not found
data/database.py:376
↓ 33 callersMethodget_fragment
Get and format a smaller text fragment by name.
prompts/templates.py:210
↓ 19 callersFunctionget_fitness_score
Calculate the fitness score from a metrics dictionary, giving priority to 'combined_score' and excluding MAP-Elites feature dimensions from t
utils/metrics_utils.py:88
↓ 13 callersMethodadd
Add a program to the database Args: program: Program to add iteration: Current iteration (defaults to last_i
data/database.py:217
↓ 12 callersMethodto_dict
Convert the Config object back to a dictionary.
config.py:441
↓ 8 callersMethodget_template
Get a template by name.
prompts/templates.py:204
↓ 7 callersMethodload
Load the database from disk Args: path: Path to load from
data/database.py:645
↓ 7 callersFunctionsafe_numeric_average
Calculate the average of numeric values in a metrics dictionary, safely ignoring non-numeric values like strings. Args: metrics:
utils/metrics_utils.py:12
↓ 6 callersMethod_process_evaluation_result
Process evaluation result to handle both dict and EvaluationResult returns Args: result: Raw result from evaluation func
evaluation/evaluator.py:357
↓ 6 callersMethodrun
Run the evolution process with improved parallel processing Args: iterations: Maximum number of iterations (uses config
core/controller.py:286
↓ 5 callersMethod_sample_random_parent
Sample a completely random parent from all programs
data/database.py:1420
↓ 5 callersFunctionformat_metrics_safe
Safely format a metrics dictionary for logging, handling both numeric and string values. Args: metrics: A dictionary of metric names
utils/format_utils.py:9
↓ 5 callersMethodgenerate_with_context
Generate text using a system message and conversational context
llm/openai.py:70
↓ 5 callersMethodhas_artifacts
Check if this result contains any artifacts
evaluation/result.py:46
↓ 5 callersMethodsample
Sample a program and inspirations for the next evolution step Args: num_inspirations: Number of inspiration programs to
data/database.py:388
↓ 4 callersMethod_is_better
Determine if program1 has better FITNESS than program2 Uses fitness calculation that excludes MAP-Elites feature dimensions
data/database.py:1107
↓ 4 callersMethod_scale_feature_value
Scale a feature value according to the configured scaling method Args: feature_name: Name of the feature dimension
data/database.py:2196
↓ 4 callersMethod_update_feature_stats
Update statistics for a feature dimension Args: feature_name: Name of the feature dimension value: New value
data/database.py:2172
↓ 4 callersMethodget_best_program
Get the best program based on a metric Args: metric: Metric to use for ranking (uses combined_score or average if None)
data/database.py:478
↓ 4 callersMethodlog_island_status
Log current status of all islands
data/database.py:2314
↓ 4 callersMethodrun
Run a coroutine within the pool's concurrency limit. Args: coro: The coroutine function to run. *args: Posit
utils/async_utils.py:218
↓ 4 callersMethodupdate_model_params
Update parameters for all models in both evolution and evaluator ensembles.
config.py:206
↓ 3 callersMethod_calculate_feature_coords
Calculate feature coordinates for the MAP-Elites grid Args: program: Program to calculate features for Returns:
data/database.py:840
↓ 3 callersMethod_direct_evaluate
Directly evaluate a program using the evaluation function with timeout Args: program_path: Path to the program file
evaluation/evaluator.py:390
↓ 3 callersMethod_fast_code_diversity
Fast approximation of code diversity using simple metrics Returns diversity score (higher = more diverse)
data/database.py:2045
↓ 3 callersMethod_feature_coords_to_key
Convert feature coordinates to a string key Args: coords: Feature coordinates Returns: String key
data/database.py:962
↓ 3 callersMethod_sample_exploration_parent
Sample a parent for exploration (from current island)
data/database.py:1296
↓ 3 callersMethod_sample_from_island_weighted
Sample a parent from a specific island using fitness-weighted selection Args: island_id: The island to sample from
data/database.py:1431
↓ 3 callersMethodbuild_prompt
Build a prompt for the LLM. Args: current_program: Current program code. parent_program: Parent program from
prompts/sampler.py:56
↓ 3 callersMethodclose
Close the tracer and flush remaining data
data/evolution_trace.py:284
↓ 3 callersMethodevaluate_program
Evaluate a program and return scores Args: program_code: Code to evaluate program_id: Optional ID for loggin
evaluation/evaluator.py:153
↓ 3 callersFunctionexport_traces_json
Export traces to a single JSON file with a metadata wrapper. Args: traces: A list of trace objects. output_path: The path wh
utils/trace_export_utils.py:65
↓ 3 callersFunctionextract_diffs
Extract all SEARCH/REPLACE diff blocks from a given text. Args: diff_text: The text containing diff blocks. diff_pattern: Th
utils/code_utils.py:90
↓ 3 callersMethodget_top_programs
Get the top N programs based on a metric Args: n: Number of programs to return metric: Metric to use for ran
data/database.py:544
↓ 3 callersMethodresearch_topic
Conducts autonomous web research to find the best algorithms or solutions for the task. Args: task_description:
core/researcher.py:39
↓ 3 callersFunctionrun_evolution
Run evolution with flexible inputs - this is the main library API. Args: initial_program: Can be a path to a program file, the progr
api.py:36
↓ 2 callersMethod_apply_security_filter
Apply security filtering to artifact text to remove sensitive info. Args: text: Input text. Returns:
prompts/sampler.py:613
↓ 2 callersMethod_cleanup_stale_island_bests
Remove stale island best program references Cleans up references to programs that no longer exist in the database or are not
data/database.py:1926
↓ 2 callersMethod_create_cascade_error_context
Create rich error context for cascade failures Args: stage: The stage where the error occurred error: The ex
evaluation/evaluator.py:703
↓ 2 callersMethod_determine_program_type
Determine the type/category of an inspiration program Args: program: Program dictionary. feature_dimensions:
prompts/sampler.py:451
↓ 2 callersMethod_load_from_directory
Load all templates (.txt files) and fragments (fragments.json) from a directory.
prompts/templates.py:185
↓ 2 callersMethod_passes_threshold
Check if metrics pass a threshold Uses 'combined_score' if available (for consistency with evolution), otherwise falls back
evaluation/evaluator.py:727
↓ 2 callersMethod_sample_model
Sample a model from the ensemble based on weights
llm/ensemble.py:90
↓ 2 callersMethod_save_program
Save a program to disk Args: program: Program to save base_path: Base path to save to (uses config.db_path i
data/database.py:809
↓ 2 callersMethod_submit_iteration
Submit an iteration to the process pool, optionally pinned to a specific island
core/process_parallel.py:823
↓ 2 callersFunctionapply_diff
Apply a diff to the original code using the specified SEARCH/REPLACE format. Args: original_code: The original source code string.
utils/code_utils.py:48
↓ 2 callersMethodcalculate_improvement
Calculate improvement deltas between parent and child metrics
data/evolution_trace.py:69
↓ 2 callersFunctionexport_traces
A high-level wrapper to export traces to a specified format. Args: traces: A list of trace objects. output_path: The path to
utils/trace_export_utils.py:356
↓ 2 callersMethodflush
Write buffered traces to file
data/evolution_trace.py:248
↓ 2 callersFunctionformat_diff_summary
Create a human-readable summary of the changes in a list of diffs. Args: diff_blocks: A list of (search_text, replace_text) tuples.
utils/code_utils.py:139
↓ 2 callersFunctionformat_feature_coordinates
Format the feature coordinates (values of MAP-Elites dimensions) for display in prompts. Args: metrics: The dictionary of all metric
utils/metrics_utils.py:148
↓ 2 callersMethodgenerate
Generate text using a randomly selected model based on weights
llm/ensemble.py:74
↓ 2 callersMethodget_artifacts
Retrieve all artifacts for a program Args: program_id: ID of the program Returns: Dictionary of art
data/database.py:2382
↓ 2 callersMethodget_pending_artifacts
Get and clear pending artifacts for a program Args: program_id: Program ID Returns: Artifacts dicti
evaluation/evaluator.py:378
↓ 2 callersFunctionload_config
Load configuration from a YAML file, or create a default config.
config.py:451
↓ 2 callersMethodlog_prompt
Log a prompt for a program. Only logs if self.config.log_prompts is True. Args: program_id: ID of the program to log
data/database.py:2537
↓ 2 callersFunctionmain
Main synchronous entry point for the script. Returns: The exit code from the asynchronous main function.
cli.py:201
↓ 2 callersFunctionparse_full_rewrite
Extract a complete code block from an LLM response for a full rewrite. Args: llm_response: The full text response from the LLM.
utils/code_utils.py:109
↓ 2 callersMethodsave
Save the database to disk Args: path: Path to save to (uses config.db_path if None) iteration: Current itera
data/database.py:596
↓ 2 callersMethodset_templates
Set custom templates to use for this sampler instance. Args: system_template: Template name for system message.
prompts/sampler.py:42
↓ 2 callersMethodto_dict
Convert to dictionary representation
data/database.py:97
↓ 1 callersMethod_apply_template_variations
Apply stochastic variations to the template
prompts/sampler.py:546
↓ 1 callersMethod_cache_diversity_value
Cache a diversity value with LRU eviction
data/database.py:2155
↓ 1 callersMethod_calculate_complexity_bin
Calculate the bin index for a given complexity value using feature scaling. Args: complexity: The complexity value (code
data/database.py:908
↓ 1 callersMethod_calculate_diversity_bin
Calculate the bin index for a given diversity value using feature scaling. Args: diversity: The average fast code divers
data/database.py:935
↓ 1 callersMethod_calculate_island_diversity
Calculate diversity within an island (deterministic version)
data/database.py:2010
↓ 1 callersMethod_call_api
Make the actual API call
llm/openai.py:168
↓ 1 callersMethod_cascade_evaluate
Run cascade evaluation with increasingly challenging test cases Args: program_path: Path to the program file Re
evaluation/evaluator.py:420
↓ 1 callersMethod_cleanup_old_artifacts
Remove artifact directories older than the configured retention period. Args: checkpoint_path: The path of the current c
data/database.py:2448
↓ 1 callersMethod_cosine_similarity
Adapted from SakanaAI/ShinkaEvolve (Apache-2.0 License) Original source: https://github.com/SakanaAI/ShinkaEvolve/blob/main/shinka/da
data/database.py:974
↓ 1 callersMethod_create_artifact_dir
Create artifact directory for a program
data/database.py:2434
↓ 1 callersMethod_create_database_snapshot
Create a serializable snapshot of the database state
core/process_parallel.py:492
↓ 1 callersMethod_deserialize_feature_stats
Deserialize feature_stats from loaded JSON Args: stats_dict: Dictionary loaded from JSON Returns: P
data/database.py:2282
↓ 1 callersMethod_distribute_programs_to_islands
Distribute loaded programs across islands when no island metadata exists
data/database.py:795
↓ 1 callersMethod_enforce_population_limit
Enforce the population size limit by removing worst programs if needed Args: exclude_program_id: Program ID to never rem
data/database.py:1682
↓ 1 callersMethod_extract_unique_features
Extract unique features of an inspiration program Args: program: Program dictionary. Returns: Strin
prompts/sampler.py:484
↓ 1 callersMethod_format_evolution_history
Format the evolution history section for the prompt
prompts/sampler.py:236
↓ 1 callersMethod_format_inspirations_section
Format the inspirations section for the prompt Args: inspirations: List of inspiration programs. language: P
prompts/sampler.py:399
↓ 1 callersMethod_format_metrics
Format metrics for the prompt using safe formatting
prompts/sampler.py:162
↓ 1 callersMethod_get_artifact_size
Get size of an artifact value in bytes
data/database.py:2413
↓ 1 callersMethod_get_cached_diversity
Get diversity score for a program using cache and reference set Args: program: The program to calculate diversity for
data/database.py:2073
↓ 1 callersMethod_get_client_model
Initializes and returns the correct OpenAI or AzureOpenAI client and model name.
llm/embedding.py:57
↓ 1 callersMethod_identify_improvement_areas
Identify improvement areas with proper fitness/feature separation
prompts/sampler.py:176
↓ 1 callersMethod_is_novel
Determine if a program is novel based on diversity to existing programs Args: program_id: ID of Program to check
data/database.py:1064
↓ 1 callersFunction_lazy_init_worker_components
Lazily initialize expensive components on first use
core/process_parallel.py:142
↓ 1 callersMethod_llm_evaluate
Use LLM to evaluate code quality Args: program_code: Code to evaluate program_id: Optional ID for logging
evaluation/evaluator.py:608
↓ 1 callersMethod_llm_judge_novelty
Use LLM to judge if a program is novel compared to a similar existing program
data/database.py:997
↓ 1 callersMethod_load_artifact_dir
Load artifacts from a directory
data/database.py:2512
↓ 1 callersMethod_load_checkpoint
Load state from a checkpoint directory
core/controller.py:583
↓ 1 callersMethod_load_evaluation_function
Load the evaluation function from the evaluation file
evaluation/evaluator.py:83
↓ 1 callersMethod_load_initial_program
Load the initial program from file
core/controller.py:279
↓ 1 callersFunction_prepare_evaluator
Helper function to convert the flexible 'evaluator' input into a file path.
api.py:209
↓ 1 callersFunction_prepare_program
Helper function to convert the flexible 'initial_program' input into a file path.
api.py:172
↓ 1 callersMethod_reconstruct_islands
Reconstruct island assignments from saved metadata Args: saved_islands: List of island program ID lists from metadata
data/database.py:715
↓ 1 callersMethod_render_artifacts
Render artifacts for prompt inclusion Args: artifacts: Dictionary of artifact name to content. Returns:
prompts/sampler.py:558
↓ 1 callersFunction_resolve_env_var
Resolve ${VAR} environment variable reference in a string value. The pattern must match the entire string (e.g., "${OPENAI_API_KEY}"), no
config.py:25
↓ 1 callersFunction_run_evolution_async
Asynchronous implementation of the run_evolution function.
api.py:64
↓ 1 callersMethod_run_evolution_with_checkpoints
Run evolution with checkpoint saving support
core/controller.py:596
↓ 1 callersMethod_safe_decode_artifact
Safely decode an artifact value to string Args: value: Artifact value (string or bytes). Returns: S
prompts/sampler.py:587
↓ 1 callersMethod_sample_exploitation_parent
Sample a parent for exploitation (from archive/elite programs)
data/database.py:1380
next →1–100 of 222, ranked by callers