Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/FoundationAgents/SPO
/ functions
Functions
61 in github.com/FoundationAgents/SPO
⨍
Functions
61
◇
Types & classes
14
↓ 23 callers
Method
get
Get the configuration for a specific LLM by name
llm/async_llm.py:64
↓ 4 callers
Method
get_instance
Get the global instance
utils/llm_client.py:72
↓ 4 callers
Method
get_price
Get the price per 1K tokens for a specific model and token type (input/output)
llm/async_llm.py:107
↓ 4 callers
Method
responser
(self, request_type: RequestType, messages: List[dict])
utils/llm_client.py:52
↓ 3 callers
Method
_load_llm_config
(self, kwargs: dict)
utils/llm_client.py:29
↓ 3 callers
Function
extract_content
(xml_string: str, tag: str)
utils/llm_client.py:79
↓ 3 callers
Method
get_best_round
(self)
utils/data_utils.py:25
↓ 3 callers
Method
initialize
Initialize the global instance
utils/llm_client.py:67
↓ 3 callers
Method
write
(self, message)
app.py:179
↓ 2 callers
Method
create_round_directory
(self, prompt_path: Path, round_number: int)
utils/prompt_utils.py:10
↓ 2 callers
Method
default
Get or create a default configuration from YAML file
llm/async_llm.py:33
↓ 2 callers
Method
evaluate_prompt
( self, optimizer: Any, samples: Optional[dict], new_samples: dict, pa
utils/evaluation_utils.py:36
↓ 2 callers
Method
execute_prompt
(self, optimizer: Any, prompt_path: Path)
utils/evaluation_utils.py:24
↓ 2 callers
Method
get_results_file_path
(self, prompt_path: Path)
utils/data_utils.py:34
↓ 2 callers
Method
list_to_markdown
Convert a list of question-answer dictionaries to a formatted Markdown string. Args: questions_list (list): List of dict
utils/data_utils.py:79
↓ 2 callers
Method
load_results
(self, path: Path)
utils/data_utils.py:16
↓ 2 callers
Method
optimize
(self)
components/optimizer.py:40
↓ 2 callers
Method
write_answers
(self, directory: Path, answers: dict, name: str = "answers.txt")
utils/prompt_utils.py:24
↓ 2 callers
Method
write_prompt
(self, directory: Path, prompt: str)
utils/prompt_utils.py:32
↓ 1 callers
Method
_evaluate_new_prompt
(self, prompt_path, data, directory)
components/optimizer.py:121
↓ 1 callers
Method
_generate_optimized_prompt
(self)
components/optimizer.py:93
↓ 1 callers
Method
_handle_first_round
(self, prompt_path: Path, data: List[dict])
components/optimizer.py:79
↓ 1 callers
Method
_load_scores
(self)
utils/data_utils.py:45
↓ 1 callers
Method
_log_optimization_result
(self, success)
components/optimizer.py:134
↓ 1 callers
Method
_optimize_prompt
(self)
components/optimizer.py:58
↓ 1 callers
Method
add_usage
Add token usage for a specific API call
llm/async_llm.py:131
↓ 1 callers
Function
count_tokens
(sample: dict)
utils/evaluation_utils.py:12
↓ 1 callers
Method
create_result_data
(self, round: int, answers: list[dict], prompt: str, succeed: bool, tokens: int)
utils/data_utils.py:37
↓ 1 callers
Function
display_optimization_results
(result_data)
app.py:37
↓ 1 callers
Function
get_response
()
app.py:262
↓ 1 callers
Method
get_summary
Get a summary of token usage and costs
llm/async_llm.py:158
↓ 1 callers
Method
load_prompt
(self, round_number: int, prompts_path: Path)
utils/prompt_utils.py:15
↓ 1 callers
Function
load_yaml_template
(template_path: Path)
app.py:13
↓ 1 callers
Function
main
()
app.py:74
↓ 1 callers
Function
main
()
optimize.py:28
↓ 1 callers
Function
parse_args
()
optimize.py:7
↓ 1 callers
Method
prompt_evaluate
Evaluate two samples and return the evaluation result Returns: True: New sample is better False: Old sample i
components/evaluator.py:50
↓ 1 callers
Method
prompt_execute
(self)
components/evaluator.py:24
↓ 1 callers
Method
save_results
(self, json_file_path: Path, data: Union[List, Dict])
utils/data_utils.py:41
↓ 1 callers
Function
save_yaml_template
(template_path: Path, data: Dict)
app.py:20
↓ 1 callers
Method
show_final_result
(self)
components/optimizer.py:49
Method
__call__
(self, messages)
llm/async_llm.py:194
Method
__init__
( self, optimized_path: str = None, initial_round: int = 1, max_rounds: int =
components/optimizer.py:20
Method
__init__
(self, prompt: str)
components/evaluator.py:20
Method
__init__
(self)
components/evaluator.py:47
Method
__init__
( self, optimize_kwargs: Optional[dict] = None, evaluate_kwargs: Optional[dict] = None
utils/llm_client.py:18
Method
__init__
(self, root_path: Path)
utils/prompt_utils.py:7
Method
__init__
(self, root_path: Path)
utils/data_utils.py:12
Method
__init__
(self, root_path: Path)
utils/evaluation_utils.py:21
Method
__init__
(self, config: dict)
llm/async_llm.py:14
Method
__init__
Initialize with an optional configuration dictionary
llm/async_llm.py:28
Method
__init__
(self)
llm/async_llm.py:125
Method
__init__
Initialize the AsyncLLM with a configuration Args: config: Either an LLMConfig instance or a string representing the LLM
llm/async_llm.py:171
Method
add_config
Add or update a configuration
llm/async_llm.py:83
Function
create_llm_instance
Create an AsyncLLM instance using the provided configuration Args: llm_config: Either an LLMConfig instance, a dictionary of configu
llm/async_llm.py:237
Method
fetch_answer
(q: str)
components/evaluator.py:28
Method
get_all_names
Get names of all available LLM configurations
llm/async_llm.py:87
Method
get_usage_summary
Get a summary of token usage and costs
llm/async_llm.py:232
Function
load_meta_data
(k: int = SAMPLE_K)
utils/load.py:14
Function
prompt_optimizer_filter
(record)
app.py:189
Function
set_file_name
(name: str)
utils/load.py:9