increment chnages
Browse files- core/generation_utils.py +3 -1
core/generation_utils.py
CHANGED
|
@@ -18,7 +18,7 @@ from tenacity import retry, stop_after_attempt, wait_incrementing
|
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
-
@retry(stop=stop_after_attempt(3), wait=wait_incrementing(increment=
|
| 22 |
def cot_or_da_func(problem: str, llm: BaseLLM = None, **kwargs) -> COTorDAPromptOutput:
|
| 23 |
|
| 24 |
cot_decision_message = [
|
|
@@ -92,6 +92,8 @@ def generate_answer(messages: list[dict], max_steps: int = 20, llm: BaseLLM = No
|
|
| 92 |
# Get the final answer after all thoughts are processed
|
| 93 |
MESSAGES += [{"role": "user", "content": f"{final_answer_prompt}"}]
|
| 94 |
|
|
|
|
|
|
|
| 95 |
raw_final_answers = llm.chat(messages=MESSAGES, **kwargs)
|
| 96 |
final_answer = raw_final_answers.choices[0].message.content
|
| 97 |
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
+
@retry(stop=stop_after_attempt(3), wait=wait_incrementing(increment=5))
|
| 22 |
def cot_or_da_func(problem: str, llm: BaseLLM = None, **kwargs) -> COTorDAPromptOutput:
|
| 23 |
|
| 24 |
cot_decision_message = [
|
|
|
|
| 92 |
# Get the final answer after all thoughts are processed
|
| 93 |
MESSAGES += [{"role": "user", "content": f"{final_answer_prompt}"}]
|
| 94 |
|
| 95 |
+
kwargs['max_tokens'] = kwargs.get('max_tokens', 1000) * 3 # giving more tokens to the final answer
|
| 96 |
+
|
| 97 |
raw_final_answers = llm.chat(messages=MESSAGES, **kwargs)
|
| 98 |
final_answer = raw_final_answers.choices[0].message.content
|
| 99 |
|