Get response from the LLM for a given problem. Args: problem (str): The problem text model (str): The model identifier Returns: str: Model's response
(problem: str, model: str)
| 675 | return result |
| 676 | |
| 677 | def get_llm_response(problem: str, model: str) -> str: |
| 678 | """ |
| 679 | Get response from the LLM for a given problem. |
| 680 | |
| 681 | Args: |
| 682 | problem (str): The problem text |
| 683 | model (str): The model identifier |
| 684 | |
| 685 | Returns: |
| 686 | str: Model's response |
| 687 | """ |
| 688 | try: |
| 689 | response = client.chat.completions.create( |
| 690 | model=model, |
| 691 | temperature=0.6, # Lower temperature for more consistent answers |
| 692 | messages=[ |
| 693 | {"role": "user", "content": SYSTEM_PROMPT + "\n" + problem} |
| 694 | ], |
| 695 | max_tokens=8192, # for thinking models, we need to use a lot more tokens |
| 696 | # extra_body = { |
| 697 | # "decoding" : "thinkdeeper", |
| 698 | # } |
| 699 | ) |
| 700 | return response.choices[0].message.content.strip() |
| 701 | |
| 702 | except Exception as e: |
| 703 | logger.error(f"Error getting LLM response: {e}") |
| 704 | return "" |
| 705 | |
| 706 | def load_existing_results(filename: str) -> list[Dict]: |
| 707 | """Load existing results from file if it exists.""" |