Spaces:
Sleeping
Sleeping
| import os | |
| from langchain_community.chat_models import ChatOpenAI | |
| def llm_node(question, search_result): | |
| # Initialize GPT-4 | |
| llm = ChatOpenAI( | |
| model="gpt-4", | |
| temperature=0, | |
| openai_api_key=os.getenv("OPENAI_API_KEY") | |
| ) | |
| prompt = f"""You are solving a GAIA benchmark evaluation question. | |
| Here’s the question: | |
| {question} | |
| Here’s retrieved information: | |
| {search_result} | |
| ⚠️ VERY IMPORTANT: | |
| - ONLY return the final answer, exactly as required. | |
| - Do NOT include explanations, prefixes, or notes. | |
| - If the question asks for a list, give only the list, in the requested format. | |
| Your answer:""" | |
| response = llm.invoke(prompt) | |
| return response.content.strip() | |