Umer797 commited on
Commit
fcaef68
·
verified ·
1 Parent(s): 1123ae2

Update llm_node.py

Browse files
Files changed (1) hide show
  1. llm_node.py +16 -3
llm_node.py CHANGED
@@ -1,7 +1,16 @@
1
- from langchain_community.chat_models import ChatOpenAI
2
 
3
  def llm_node(question):
4
- llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)
 
 
 
 
 
 
 
 
 
5
  prompt = f"""You are solving a GAIA benchmark evaluation question.
6
 
7
  ⚠️ VERY IMPORTANT:
@@ -15,5 +24,9 @@ Here’s the question:
15
  {question}
16
 
17
  Your direct answer:"""
 
 
18
  response = llm.invoke(prompt)
19
- return response.content.strip()
 
 
 
1
+ from langchain_community.llms import HuggingFaceHub
2
 
3
  def llm_node(question):
4
+ # Initialize the Hugging Face model
5
+ llm = HuggingFaceHub(
6
+ repo_id="HuggingFaceH4/zephyr-7b-beta", # You can replace with e.g., mistralai/Mistral-7B-Instruct-v0.2
7
+ model_kwargs={
8
+ "temperature": 0.1, # Keep responses deterministic
9
+ "max_new_tokens": 500 # Allow for longer outputs if needed
10
+ }
11
+ )
12
+
13
+ # Craft the prompt carefully for exact-match outputs
14
  prompt = f"""You are solving a GAIA benchmark evaluation question.
15
 
16
  ⚠️ VERY IMPORTANT:
 
24
  {question}
25
 
26
  Your direct answer:"""
27
+
28
+ # Run the model
29
  response = llm.invoke(prompt)
30
+
31
+ # Clean up whitespace or stray characters
32
+ return response.strip()