diff --git a/optillm.py b/optillm.py index c6f03012..ef421160 100644 --- a/optillm.py +++ b/optillm.py @@ -331,7 +331,7 @@ def execute_single_approach(approach, system_prompt, initial_query, client, mode c=server_config['rstar_c']) return rstar.solve(initial_query) elif approach == "cot_reflection": - return cot_reflection(system_prompt, initial_query, client, model, return_full_response=server_config['return_full_response']) + return cot_reflection(system_prompt, initial_query, client, model, return_full_response=server_config['return_full_response'], request_config=request_config) elif approach == 'plansearch': return plansearch(system_prompt, initial_query, client, model, n=server_config['n']) elif approach == 'leap': diff --git a/optillm/__init__.py b/optillm/__init__.py index 610fc269..c7e63bcc 100644 --- a/optillm/__init__.py +++ b/optillm/__init__.py @@ -2,7 +2,7 @@ import os # Version information -__version__ = "0.1.18" +__version__ = "0.1.19" # Get the path to the root optillm.py spec = util.spec_from_file_location( diff --git a/optillm/cot_reflection.py b/optillm/cot_reflection.py index 7feab3a6..dfc6efdb 100644 --- a/optillm/cot_reflection.py +++ b/optillm/cot_reflection.py @@ -3,8 +3,16 @@ logger = logging.getLogger(__name__) -def cot_reflection(system_prompt, initial_query, client, model: str, return_full_response: bool=False): +def cot_reflection(system_prompt, initial_query, client, model: str, return_full_response: bool=False, request_config: dict = None): cot_completion_tokens = 0 + + # Extract temperature and max_tokens from request_config with defaults + temperature = 0.6 # Default to 0.6 as requested + max_tokens = 4096 # Default to 4096 as requested + + if request_config: + temperature = request_config.get('temperature', temperature) + max_tokens = request_config.get('max_tokens', max_tokens) cot_prompt = f""" {system_prompt} @@ -32,15 +40,15 @@ def cot_reflection(system_prompt, initial_query, client, model: str, return_full """ - # Make the API call + # Make the API call using user-provided or default parameters response = client.chat.completions.create( model=model, messages=[ {"role": "system", "content": cot_prompt}, {"role": "user", "content": initial_query} ], - temperature=0.7, - max_tokens=4096 + temperature=temperature, + max_tokens=max_tokens ) # Extract the full response diff --git a/setup.py b/setup.py index 5de8c1dd..d164df56 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="optillm", - version="0.1.18", + version="0.1.19", packages=find_packages(include=['optillm', 'optillm.*']), # This ensures all subpackages are included py_modules=['optillm'], package_data={