Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/AIcling/agentic_geo
/ functions
Functions
107 in github.com/AIcling/agentic_geo
⨍
Functions
107
◇
Types & classes
5
↓ 14 callers
Function
format_number_7decimals
Format number to 7 decimal places.
src/run_geo.py:24
↓ 14 callers
Function
format_scores_7decimals
Format scores (can be nested lists/arrays) to 7 decimal places.
src/run_geo.py:33
↓ 10 callers
Function
call_gpt
Synchronous wrapper that calls async or sync version based on config. Note: Caching has been removed to prevent cache corruption from concurr
src/geo_functions.py:131
↓ 8 callers
Function
load_config
Load configuration from an INI file. Uses Python's standard configparser module. Args: config_file: Path to the configuratio
src/config_loader.py:15
↓ 7 callers
Function
get_local_llm_model
Get local LLM model name from config.
src/config_loader.py:131
↓ 7 callers
Function
impression_subjective_impression
(sentences, query, n = 5, normalize = True, idx = 0, metric = 'subjective_impression')
src/utils.py:149
↓ 7 callers
Function
use_local_llm
Check if local LLM should be used.
src/config_loader.py:121
↓ 6 callers
Function
extract_citations_new
(text)
src/utils.py:36
↓ 4 callers
Function
get_answer
Get answer for a query using cached sources and real-time LLM generation. Args: query: The query string summaries: Optional l
src/utils.py:301
↓ 4 callers
Function
get_effective_api_config
Get the effective API configuration based on USE_LOCAL_LLM setting.
src/config_loader.py:141
↓ 4 callers
Function
search_handler
(req, source_count = 8)
src/search_try.py:172
↓ 3 callers
Function
get_model_name
Get the current LLM model name for file naming.
src/run_geo.py:181
↓ 3 callers
Function
get_num_words
(line)
src/utils.py:33
↓ 3 callers
Function
use_async
Check if async mode should be used.
src/config_loader.py:136
↓ 2 callers
Function
_safe_write_cache
Safely write cache JSON to disk using atomic write (temp file + rename). If writing fails, does not interrupt main process. Note: This no
src/utils.py:255
↓ 2 callers
Function
call_gpt_async
Async version of call_gpt using AsyncOpenAI client. Note: Caching has been removed to prevent cache corruption from concurrent writes. Al
src/geo_functions.py:62
↓ 2 callers
Function
clean_source_gpt35_async
Async version of clean_source_gpt35 using AsyncOpenAI client.
src/search_try.py:31
↓ 2 callers
Function
generate_answer_async
Async version of generate_answer using AsyncOpenAI client.
src/generative_le.py:32
↓ 2 callers
Function
get_summary
Extract summary from LLM response, removing code blocks if present.
src/geo_functions.py:33
↓ 2 callers
Function
load_results
Load JSON result file.
src/merge_and_analyze_results.py:9
↓ 2 callers
Function
process_single_query_async
Async process a single query with error handling and immediate result saving.
src/run_geo.py:1081
↓ 2 callers
Method
rank_strategies
Rank all strategies for given query and context. Args: query: User query context: Content to optimize str
src/surrogate_model_evolved.py:393
↓ 2 callers
Function
returnable_score_from_scores
(scores)
src/utils.py:152
↓ 2 callers
Function
sanitize_string
Sanitize string to prevent JSON encoding issues. Args: s: String to sanitize Returns: Sanitized string safe for JSON encoding
src/run_geo.py:367
↓ 2 callers
Method
select
(self, indices)
src/run_geo.py:1429
↓ 2 callers
Method
shuffle
(self, seed=None)
src/run_geo.py:1425
↓ 1 callers
Function
_extract_rewritten_content
Best-effort extractor to return ONLY rewritten content. Some evolved strategies include an output format like: - "First output your plan, then the
src/run_geo.py:46
↓ 1 callers
Method
_init_weights
(self, init_bias: float)
src/surrogate_model_evolved.py:101
↓ 1 callers
Method
_load_backbone_checkpoint
Load pretrained backbone weights from checkpoint file. Args: ckpt_path: Path to pytorch_model.bin or similar checkpoint file
src/surrogate_model_evolved.py:272
↓ 1 callers
Function
apply_evolved_strategy
Apply an evolved strategy to rewrite content using LLM. This function implements the Oracle Rewrite logic for evolved strategies. The strategy_pro
src/run_geo.py:98
↓ 1 callers
Function
build_critic_prompt
Build Critic input prompt (aligned with training).
src/surrogate_model_evolved.py:51
↓ 1 callers
Function
calculate_method_statistics
Calculate statistics for each method.
src/merge_and_analyze_results.py:30
↓ 1 callers
Function
clean_source_gpt35
Synchronous wrapper that calls async or sync version based on config.
src/search_try.py:86
↓ 1 callers
Function
clean_source_text
(text: str)
src/search_try.py:154
↓ 1 callers
Function
convert_to_number
(x, min_val = 1.0)
src/utils.py:198
↓ 1 callers
Function
ecn
(sentence)
src/utils.py:37
↓ 1 callers
Function
generate_answer
Synchronous wrapper that calls async or sync version based on config.
src/generative_le.py:81
↓ 1 callers
Function
get_api_key
Get OpenAI API key from config.
src/config_loader.py:108
↓ 1 callers
Function
impression_pos_count_simple
(sentences, n = 5, normalize=True)
src/utils.py:76
↓ 1 callers
Function
impression_word_count_simple
(sentences, n = 5, normalize=True)
src/utils.py:64
↓ 1 callers
Function
impression_wordpos_count_simple
(sentences, n = 5, normalize=True)
src/utils.py:51
↓ 1 callers
Function
init_results_file
Initialize results file with model name.
src/run_geo.py:191
↓ 1 callers
Function
main
()
src/merge_and_analyze_results.py:184
↓ 1 callers
Function
main
()
src/merge_results.py:135
↓ 1 callers
Function
main
()
scripts/archive_to_strategies.py:23
↓ 1 callers
Function
main
()
scripts/prep_evolved_for_hf.py:19
↓ 1 callers
Function
main
()
base_model/download_base_model.py:20
↓ 1 callers
Function
main_async
Main async entry point.
src/run_geo.py:1234
↓ 1 callers
Function
merge_results
Merge two result files.
src/merge_and_analyze_results.py:15
↓ 1 callers
Function
merge_results
Merge all split result files.
src/merge_results.py:18
↓ 1 callers
Function
preload_geobench_to_cache
Preload GEO-Bench sources into cache. Args: dataset_file: Path to GEO-Bench jsonl cache_file: Target cache file path max_
src/preload_cache_from_geobench.py:8
↓ 1 callers
Function
preload_msdata_to_cache
Preload MSdata sources into cache. Args: dataset_file: Path to MSdata JSON file (JSON array format) cache_file: Target cache file
src/preload_cache_from_msdata.py:8
↓ 1 callers
Function
print_statistics
Print statistics.
src/merge_and_analyze_results.py:116
↓ 1 callers
Function
process_with_semaphore
(task)
src/run_geo.py:1214
↓ 1 callers
Function
run_concurrent_async
Concurrent execution using asyncio.
src/run_geo.py:1204
↓ 1 callers
Function
run_sequential_async
Sequential execution using async (original method, but async).
src/run_geo.py:1194
↓ 1 callers
Function
sanitize_for_json
Convert object to JSON-serializable form. Args: obj: Object to sanitize Returns: JSON-serializable version of the object
src/run_geo.py:419
↓ 1 callers
Function
save_merged_results
Save merged results.
src/merge_and_analyze_results.py:165
↓ 1 callers
Function
save_statistics
Save statistics to JSON.
src/merge_and_analyze_results.py:177
↓ 1 callers
Method
score_strategy
Score a single strategy using SHORT_PROMPT. Args: query: User query context: Content to optimize strategy
src/surrogate_model_evolved.py:332
↓ 1 callers
Method
select_best_strategy
Select the best strategy based on Critic prediction. Critic SHORT_PROMPT strategy FULL_PROMPT Args: query: User query
src/surrogate_model_evolved.py:483
↓ 1 callers
Function
summarize_text_identity
(source, query)
src/search_try.py:168
↓ 1 callers
Function
truncate_content
Truncate content, Head+Tail mode supported. IMPORTANT: This must match the truncation used during training to ensure training-inference consi
src/surrogate_model_evolved.py:22
↓ 1 callers
Function
validate_json_serializable
Validate that an object can be JSON serialized. Args: obj: Object to validate path: Current path in object tree (for error reporting) Return
src/run_geo.py:325
Method
__getitem__
(self, idx)
src/run_geo.py:1397
Method
__getitem__
(self, idx)
src/run_geo.py:1418
Method
__init__
(self, data_dict)
src/run_geo.py:1390
Method
__init__
(self, data_dict)
src/run_geo.py:1411
Method
__init__
( self, hidden_size: int = 1536, intermediate_size: int = 1024, dropout: float
src/surrogate_model_evolved.py:84
Method
__init__
Initialize the evolved Critic model. Args: base_model_path: Path to Qwen2.5-1.5B-Instruct base model (for structure)
src/surrogate_model_evolved.py:134
Method
__init__
Initialize the evolved strategy selector. Args: base_model_path: Path to Qwen2.5-1.5B-Instruct base model (for structure)
src/surrogate_model_evolved.py:429
Method
__iter__
(self)
src/run_geo.py:1400
Method
__iter__
(self)
src/run_geo.py:1421
Method
__len__
(self)
src/run_geo.py:1394
Method
__len__
(self)
src/run_geo.py:1415
Function
authoritative_optimization_mine
(summary)
src/geo_functions.py:234
Function
check_summaries_exist
(sources, summaries)
src/utils.py:294
Function
citing_credible_sources_mine
(summary)
src/geo_functions.py:270
Function
fluent_optimization_gpt
(summary)
src/geo_functions.py:220
Method
forward
Args: hidden_states: (batch_size, hidden_size) Returns: scores: (batch_size,)
src/surrogate_model_evolved.py:107
Function
get_api_base
Get OpenAI API base URL from config.
src/config_loader.py:116
Function
get_local_llm_base
Get local LLM base URL from config.
src/config_loader.py:126
Function
get_prompt
(source, query)
src/utils.py:19
Method
get_strategy_by_id
Get strategy by genotype_id.
src/surrogate_model_evolved.py:535
Function
get_strategy_prompts
Get strategy prompts (for compatibility with old interface). Note: This is kept for API compatibility, but evolved strategies are loaded from
src/surrogate_model_evolved.py:547
Function
identity
(summary, source=None)
src/run_geo.py:139
Function
impression_diversity_detailed
(sentences, query, n = 5, normalize = True, idx = 0)
src/utils.py:131
Function
impression_follow_detailed
(sentences, query, n = 5, normalize = True, idx = 0)
src/utils.py:137
Function
impression_influence_detailed
(sentences, query, n = 5, normalize = True, idx = 0)
src/utils.py:140
Function
impression_para_based
(sentences, n = 5, normalize = True, alpha = 1.1, beta = 1.5, gamma2 = 1/math.e)
src/utils.py:89
Function
impression_relevance_detailed
(sentences, query, n = 5, normalize = True, idx = 0)
src/utils.py:143
Function
impression_subjcount_detailed
(sentences, query, n = 5, normalize = True, idx = 0)
src/utils.py:146
Function
impression_subjpos_detailed
(sentences, query, n = 5, normalize = True, idx = 0)
src/utils.py:128
Function
impression_uniqueness_detailed
(sentences, query, n = 5, normalize = True, idx = 0)
src/utils.py:134
Function
improve
Process a query through GEO optimization pipeline. Note: static_cache now defaults to True to use pre-loaded cache from GEO-Bench. This prevents u
src/run_geo.py:945
Function
improve_with_model_selection
Process a query using surrogate model for strategy selection. New workflow: 1. Use surrogate model to rank all strategies 2. Select the best stra
src/run_geo.py:628
Function
load_evolved_strategies
Load evolved strategies from JSON file. Args: strategies_path: Path to final_strategies_with_prompts.json Returns: List of s
src/surrogate_model_evolved.py:556
Function
more_quotes_mine
(summary)
src/geo_functions.py:255
Function
reload_config
Force reload configuration from file and environment variables.
src/config_loader.py:160
Function
save_query_result
Append a single query result to the results file with robust error handling. Args: file_path: Path to the results JSON file query_result: Dicti
src/run_geo.py:454
next →
1–100 of 107, ranked by callers