| 34 | return f"Here are the relevant Wikipedia articles:\n{wiki_links}\n\nBased on all the information, answer the query. \n\nQuery: {prompt}\n\n" |
| 35 | |
| 36 | def get_llm_response(prompt: str, model: str) -> str: |
| 37 | response = client.with_options(timeout=1000.0).chat.completions.create( |
| 38 | model=model, |
| 39 | messages=[ |
| 40 | {"role": "system", "content": "You are a helpful assistant."}, |
| 41 | {"role": "user", "content": prompt} |
| 42 | ], |
| 43 | max_tokens=1000, |
| 44 | n=1, |
| 45 | stop=None, |
| 46 | temperature=0.7, |
| 47 | extra_body={"optillm_approach": "readurls&memory"} |
| 48 | ) |
| 49 | return response.choices[0].message.content.strip() |
| 50 | |
| 51 | def evaluate_response(question: str, llm_response: str, ground_truth: str, model: str) -> Dict[str, str]: |
| 52 | evaluation_prompt = f"""===Task=== |