Spaces:
Sleeping
Sleeping
File size: 705 Bytes
0d53058 485fdc3 0d53058 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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()
|