Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/SalesforceAIResearch/promptomatix
/ functions
Functions
248 in github.com/SalesforceAIResearch/promptomatix
⨍
Functions
248
◇
Types & classes
22
↓ 118 callers
Method
get
(self, session_id, default=None)
src/promptomatix/main.py:55
↓ 96 callers
Method
_get_output_value
Helper method to get the output value from an item using the first output field
src/promptomatix/metrics/metrics.py:65
↓ 23 callers
Method
get_value
Get the current lambda penalty value.
src/promptomatix/core/config.py:50
↓ 11 callers
Method
get_session
Retrieve a session by ID.
src/promptomatix/core/session.py:195
↓ 10 callers
Function
log_llm_interaction
Log an LLM interaction with structured data. Args: prompt (str): The prompt sent to the LLM response (str): The response rece
src/promptomatix/core/config.py:166
↓ 6 callers
Method
add_entry
(self, event_type: str, details: Dict[str, Any])
src/promptomatix/logger.py:12
↓ 6 callers
Method
configure
Configure the MetricsManager with output fields. Args: output_fields (List[str]): List of output field names
src/promptomatix/metrics/metrics.py:56
↓ 6 callers
Function
process_input
Process an initial optimization request.
src/promptomatix/main.py:62
↓ 5 callers
Function
improvise_raw_input
(human_input: str)
src/promptomatix/core/prompts.py:298
↓ 4 callers
Method
_clean_llm_response
Clean and format LLM response.
src/promptomatix/core/optimizer.py:254
↓ 4 callers
Method
add_entry
Add a new log entry. Args: entry_type (str): Type of log entry (e.g., "ERROR", "INFO") data (Dict[st
src/promptomatix/utils/logging.py:62
↓ 4 callers
Method
format
(self, record)
src/promptomatix/core/config.py:154
↓ 4 callers
Method
to_dict
Convert config to a serializable dictionary.
src/promptomatix/core/config.py:818
↓ 4 callers
Method
to_dict
Convert feedback to dictionary format.
src/promptomatix/core/feedback.py:33
↓ 3 callers
Method
_call_llm_api_directly
Call LLM API directly based on the configured provider. Args: prompt (str): The prompt to send to the LLM
src/promptomatix/core/optimizer.py:562
↓ 3 callers
Method
_prepare_dataset
Prepare a dataset from input data.
src/promptomatix/core/optimizer.py:693
↓ 3 callers
Method
run
Run the optimization process using the configured backend. Args: initial_flag (bool): Whether this is the initia
src/promptomatix/core/optimizer.py:262
↓ 3 callers
Method
update_optimized_prompt
Update the latest optimized prompt.
src/promptomatix/core/session.py:73
↓ 2 callers
Method
_calculate_dataset_sizes
Calculate sizes for training and validation datasets.
src/promptomatix/core/config.py:1655
↓ 2 callers
Method
_develop_prompt_template_components
Develop prompt template components from raw input. Flexibly extracts components from raw_input regardless of their order.
src/promptomatix/core/config.py:528
↓ 2 callers
Method
_evaluate_prompt_meta_backend
Evaluate a prompt using the meta-prompt backend by testing it against synthetic data. Args: prompt (str): The pr
src/promptomatix/core/optimizer.py:430
↓ 2 callers
Method
_extract_fields
Extract input and output fields from task description and sample data. Args: tmp_lm: Language model instance Retu
src/promptomatix/core/config.py:1186
↓ 2 callers
Method
_extract_task_description
Extract or set task description from human input. Args: tmp_lm: Language model instance Returns: str:
src/promptomatix/core/config.py:1053
↓ 2 callers
Method
_extract_task_type
Extract task type from task description and sample data. Args: tmp_lm: Language model instance Returns:
src/promptomatix/core/config.py:1273
↓ 2 callers
Method
_extract_tools
Extract tools for agentic/programming tasks. Args: tmp_lm: Language model instance Returns: Optional[
src/promptomatix/core/config.py:1322
↓ 2 callers
Method
_parse_fields
Parse field definitions from string or list.
src/promptomatix/core/optimizer.py:106
↓ 2 callers
Method
_parse_input_fields
Parse input fields from config.
src/promptomatix/core/optimizer.py:687
↓ 2 callers
Method
_prepare_results
Prepare the final results dictionary.
src/promptomatix/core/optimizer.py:734
↓ 2 callers
Method
_process_human_feedback
Process and simplify human feedback if present in input. Args: tmp_lm: Language model instance Returns:
src/promptomatix/core/config.py:1359
↓ 2 callers
Method
_save_session
Save session data to a file.
src/promptomatix/core/session.py:145
↓ 2 callers
Method
_set_dspy_module
Set appropriate DSPy module based on task description and sample data. Args: tmp_lm: Language model instance Retu
src/promptomatix/core/config.py:1383
↓ 2 callers
Method
_set_search_type_config
Configure parameters based on search type. Sets data and optimizer related parameters according to the search strategy (quick
src/promptomatix/core/config.py:673
↓ 2 callers
Method
_set_trainer
Set trainer based on task type.
src/promptomatix/core/config.py:1423
↓ 2 callers
Method
_setup_model_config
Set up model configuration based on provider. Returns: dspy.LM: Configured language model instance Raise
src/promptomatix/core/config.py:873
↓ 2 callers
Method
add_feedback
Add a new feedback to the store.
src/promptomatix/core/feedback.py:53
↓ 2 callers
Method
calculate_overall_quality_score
Calculate comprehensive quality scores.
examples/scripts/custom_metrics.py:142
↓ 2 callers
Method
generate_synthetic_data
Generate synthetic training data based on sample data in batches.
src/promptomatix/core/optimizer.py:115
↓ 2 callers
Method
get_feedback_for_prompt
Get all feedback for a specific prompt.
src/promptomatix/core/feedback.py:62
↓ 2 callers
Method
get_final_eval_metrics
Get final evaluation metrics for the task type.
src/promptomatix/core/optimizer.py:761
↓ 2 callers
Method
get_performance_summary
Get comprehensive performance summary.
examples/scripts/custom_metrics.py:190
↓ 2 callers
Method
get_summary
Get summary statistics.
examples/scripts/batch_processing.py:137
↓ 2 callers
Function
parse_args
Parse and validate command line arguments. Returns: Dict: Configuration dictionary with all parsed arguments
src/promptomatix/cli/parser.py:8
↓ 2 callers
Method
to_dict
Convert session to dictionary format.
src/promptomatix/core/session.py:89
↓ 1 callers
Method
_apply_common_preprocessing
Apply common preprocessing steps to both datasets.
src/promptomatix/core/config.py:1597
↓ 1 callers
Method
_apply_dataset_config
Apply dataset-specific configurations and preprocessing.
src/promptomatix/core/config.py:1480
↓ 1 callers
Method
_call_anthropic_api
Call Anthropic API directly. Args: prompt (str): The prompt to send Returns: st
src/promptomatix/core/optimizer.py:641
↓ 1 callers
Method
_call_openai_api
Call OpenAI API directly. Args: prompt (str): The prompt to send Returns: str:
src/promptomatix/core/optimizer.py:590
↓ 1 callers
Function
_clean_dict_value
Clean and format dictionary values.
src/promptomatix/utils/parsing.py:103
↓ 1 callers
Function
_clean_parsed_data
Clean parsed JSON data.
src/promptomatix/utils/parsing.py:39
↓ 1 callers
Method
_compile_program
Compile the program using the trainer.
src/promptomatix/core/optimizer.py:721
↓ 1 callers
Method
_create_prediction_object
Create a prediction object with the expected structure for evaluation. Args: prediction_text (str): Raw predicti
src/promptomatix/core/optimizer.py:518
↓ 1 callers
Method
_create_sample_data
Create sample data from available datasets. Args: train_dataset: HuggingFace Dataset for training test_datase
src/promptomatix/core/config.py:1631
↓ 1 callers
Method
_create_synthetic_data_prompt
Generate a high-quality prompt for synthetic data creation with specified batch size.
src/promptomatix/core/optimizer.py:243
↓ 1 callers
Method
_create_task_description
Create task description from dataset.
src/promptomatix/core/config.py:510
↓ 1 callers
Method
_create_test_input_from_sample
Create a test input string from a sample data dictionary. Args: sample (Dict): Sample data containing input fiel
src/promptomatix/core/optimizer.py:483
↓ 1 callers
Method
_extract_sample_data
Extract sample data from task description and human input. Args: tmp_lm: Language model instance Returns:
src/promptomatix/core/config.py:1084
↓ 1 callers
Method
_initialize_trainer
Initialize the DSPy trainer.
src/promptomatix/core/optimizer.py:712
↓ 1 callers
Method
_load_and_process_dataset
Load and preprocess dataset from local files or HuggingFace. Returns: tuple[Dataset, Dataset]: Processed (train_dataset,
src/promptomatix/core/config.py:1427
↓ 1 callers
Method
_load_huggingface_datasets
Load datasets from HuggingFace.
src/promptomatix/core/config.py:1458
↓ 1 callers
Method
_load_local_datasets
Load datasets from local CSV files.
src/promptomatix/core/config.py:1449
↓ 1 callers
Function
_manual_dict_parse
Manually parse dictionary-like strings.
src/promptomatix/utils/parsing.py:49
↓ 1 callers
Method
_populate_config
Populate missing configuration parameters in a specific order. This method handles the core configuration flow: 1. Sets searc
src/promptomatix/core/config.py:426
↓ 1 callers
Method
_populate_config_from_huggingface
Populate configuration from HuggingFace dataset.
src/promptomatix/core/config.py:350
↓ 1 callers
Method
_prepare_datasets
Prepare sample, training, and validation datasets. This method handles: 1. Creating sample data from available datasets
src/promptomatix/core/config.py:1609
↓ 1 callers
Method
_prepare_datasets
Prepare training and validation datasets.
src/promptomatix/core/optimizer.py:701
↓ 1 callers
Method
_prepare_full_validation_dataset
Prepare full validation dataset if available.
src/promptomatix/core/optimizer.py:708
↓ 1 callers
Method
_prepare_sample_data
Prepare sample data for synthetic data generation.
src/promptomatix/core/optimizer.py:215
↓ 1 callers
Method
_prepare_train_valid_splits
Prepare training and validation dataset splits. Args: train_dataset: HuggingFace Dataset for training test_da
src/promptomatix/core/config.py:1662
↓ 1 callers
Function
_process_dict_pairs
Process dictionary pairs into a clean dictionary.
src/promptomatix/utils/parsing.py:91
↓ 1 callers
Method
_process_gsm8k_dataset
Special processing for GSM8K dataset to handle math reasoning steps. Args: train_dataset: HuggingFace Dataset for trainin
src/promptomatix/core/config.py:1514
↓ 1 callers
Method
_process_squad_dataset
Special processing for SQuAD dataset.
src/promptomatix/core/config.py:1566
↓ 1 callers
Method
_run_dspy_backend
Run optimization using DSPy backend. Args: initial_flag (bool): Whether this is the initial optimization
src/promptomatix/core/optimizer.py:279
↓ 1 callers
Method
_run_meta_prompt_backend
Run optimization using meta-prompt backend with direct API calls. Args: initial_flag (bool): Whether this is the
src/promptomatix/core/optimizer.py:378
↓ 1 callers
Function
_split_dict_pairs
Split dictionary content into key-value pairs.
src/promptomatix/utils/parsing.py:65
↓ 1 callers
Method
_validate_synthetic_data
Validate the generated synthetic data for quality and consistency. Args: data (Dict): The generated data sample
src/promptomatix/core/optimizer.py:766
↓ 1 callers
Method
add_result
Add optimization result for tracking.
examples/scripts/custom_metrics.py:172
↓ 1 callers
Method
calculate_cost_efficiency_score
Calculate cost efficiency score.
examples/scripts/custom_metrics.py:74
↓ 1 callers
Method
calculate_prompt_clarity_score
Calculate clarity score based on prompt characteristics.
examples/scripts/custom_metrics.py:35
↓ 1 callers
Method
calculate_synthetic_data_quality_score
Calculate quality score for synthetic data.
examples/scripts/custom_metrics.py:112
↓ 1 callers
Method
calculate_time_efficiency_score
Calculate time efficiency score.
examples/scripts/custom_metrics.py:93
↓ 1 callers
Function
complete_the_main_example
( task: str, question: str = "", context: str = "")
src/promptomatix/core/prompts.py:994
↓ 1 callers
Function
convert_few_shot_examples_to_json
(few_shot_examples: str)
src/promptomatix/core/prompts.py:1544
↓ 1 callers
Method
create_session
Create and store a new optimization session.
src/promptomatix/core/session.py:188
↓ 1 callers
Method
create_signature
Create a DSPy signature for the optimization task. Args: name (str): Name of the signature input_fie
src/promptomatix/core/optimizer.py:68
↓ 1 callers
Function
display_fancy_result
Display optimization results in a fancy, formatted way. Args: result (Dict): The result dictionary from process_input
src/promptomatix/main.py:815
↓ 1 callers
Function
download_nltk_data
Download required NLTK data during installation.
setup.py:12
↓ 1 callers
Method
export_csv
Export results to CSV file.
examples/scripts/batch_processing.py:180
↓ 1 callers
Method
export_metrics
Export metrics to JSON file.
examples/scripts/custom_metrics.py:242
↓ 1 callers
Method
export_results
Export results to JSON file.
examples/scripts/batch_processing.py:166
↓ 1 callers
Method
export_to_file
Export feedback to a JSON file.
src/promptomatix/core/feedback.py:84
↓ 1 callers
Function
extract_fields_from_sample_data
Creates a prompt that instructs an LLM to extract both input and output fields from sample data based on the task. This combined approach is
src/promptomatix/core/prompts.py:1871
↓ 1 callers
Function
extract_task_description_from_raw_input
(human_input: str)
src/promptomatix/core/prompts.py:1388
↓ 1 callers
Function
extract_task_type_from_raw_input
(task_description: str, human_input: str, sample_data: str)
src/promptomatix/core/prompts.py:1661
↓ 1 callers
Function
extract_tools_from_raw_input
(human_input: str)
src/promptomatix/core/prompts.py:1609
↓ 1 callers
Method
format
(self, record)
src/promptomatix/core/optimizer.py:842
↓ 1 callers
Function
generate_dspy_module_from_task_description_and_sample_data
(task_description: str, sample_data: str)
src/promptomatix/core/prompts.py:703
↓ 1 callers
Function
generate_feedback
Generate comprehensive feedback for an optimized prompt using synthetic data with explicit arguments. This function: 1. Uses the pro
src/promptomatix/main.py:567
↓ 1 callers
Function
generate_meta_prompt_7
Return a meta‑prompt that instructs a downstream optimizer to improve the given `initial_prompt` while strictly preserving immutable schema b
src/promptomatix/core/prompts.py:3049
↓ 1 callers
Function
generate_prompt_changes_prompt_4
(prompt, FEEDBACK_LIST)
src/promptomatix/core/prompts.py:2749
↓ 1 callers
Function
generate_prompt_feedback_3
Generate analytical feedback for AI system prompt optimization. Args: user_input (str): Original user input/request ai_s
src/promptomatix/core/prompts.py:2571
next →
1–100 of 248, ranked by callers