Skip to content

Commit 335b900

Browse files
committed
Update autothink.py
1 parent 23de918 commit 335b900

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

optillm/autothink/autothink.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import Dict, List, Any, Optional
1010
from transformers import PreTrainedModel, PreTrainedTokenizer
1111

12-
from .processor import AutoThinkProcessor
12+
from .processor import AutoThinkProcessor as InternalProcessor
1313

1414
logger = logging.getLogger(__name__)
1515

@@ -34,8 +34,11 @@ def __init__(self, model: PreTrainedModel, tokenizer: PreTrainedTokenizer, confi
3434
self.tokenizer = tokenizer
3535

3636
def __call__(self, messages: List[Dict[str, str]]) -> str:
37-
"""
38-
Process messages with AutoThink's controlled thinking.
37+
"""Process messages with AutoThink's controlled thinking."""
38+
return self.process(messages)
39+
40+
def process(self, messages: List[Dict[str, str]]) -> str:
41+
"""Process messages with AutoThink's controlled thinking.
3942
4043
Args:
4144
messages: List of message dictionaries
@@ -51,7 +54,7 @@ def __call__(self, messages: List[Dict[str, str]]) -> str:
5154

5255
def _create_processor(self):
5356
"""Create the internal processor instance."""
54-
return AutoThinkProcessor(self.config, self.tokenizer, self.model)
57+
return InternalProcessor(self.config, self.tokenizer, self.model)
5558

5659
def autothink_decode(
5760
model: PreTrainedModel,
@@ -80,7 +83,7 @@ def autothink_decode(
8083

8184
try:
8285
processor = AutoThinkProcessor(model, tokenizer, config)
83-
response = processor(messages)
86+
response = processor.process(messages)
8487
return response
8588

8689
except Exception as e:

0 commit comments

Comments
 (0)