Skip to content

Commit d080c88

Browse files
committed
Update spl_plugin.py
1 parent ae0cbf9 commit d080c88

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

optillm/plugins/spl_plugin.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,25 @@
1313
LLM incrementally better at solving problems by learning from its experiences.
1414
"""
1515

16-
import os
17-
import sys
18-
import importlib.util
1916
from typing import Tuple
17+
from optillm.plugins.spl import run_spl
2018

2119
# Plugin identifier
2220
SLUG = "spl"
2321

2422
def run(system_prompt: str, initial_query: str, client, model: str, request_config: dict = None) -> Tuple[str, int]:
2523
"""
2624
Plugin entry point for System Prompt Learning.
27-
25+
2826
Args:
2927
system_prompt: The system prompt
3028
initial_query: The user's query
3129
client: The LLM client
3230
model: The model identifier
3331
request_config: Optional request configuration
3432
Can include {'spl_learning': True} to enable learning mode
35-
33+
3634
Returns:
3735
Tuple[str, int]: The LLM response and token count
3836
"""
39-
# Get the directory where this plugin is located
40-
plugin_dir = os.path.dirname(os.path.abspath(__file__))
41-
spl_dir = os.path.join(plugin_dir, 'spl')
42-
main_file = os.path.join(spl_dir, 'main.py')
43-
44-
# Load the main module dynamically
45-
spec = importlib.util.spec_from_file_location("spl_main", main_file)
46-
spl_main = importlib.util.module_from_spec(spec)
47-
48-
# Add the spl directory to the Python path temporarily
49-
if spl_dir not in sys.path:
50-
sys.path.insert(0, spl_dir)
51-
52-
try:
53-
spec.loader.exec_module(spl_main)
54-
return spl_main.run_spl(system_prompt, initial_query, client, model, request_config)
55-
finally:
56-
# Remove from path after use
57-
if spl_dir in sys.path:
58-
sys.path.remove(spl_dir)
37+
return run_spl(system_prompt, initial_query, client, model, request_config)

0 commit comments

Comments
 (0)