legolasyiu commited on
Commit
6d4dc25
·
verified ·
1 Parent(s): 17dba22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -30,7 +30,7 @@ quantization_config = BitsAndBytesConfig(
30
  )
31
 
32
  # 2. Create model
33
- model = HuggingFacePipeline.from_model_id(
34
  model_id="EpistemeAI/Fireball-Meta-Llama-3.1-8B-Instruct-Agent-0.003",
35
  task="text-generation",
36
  pipeline_kwargs=dict(
@@ -47,12 +47,13 @@ tools = load_tools(["serpapi"])
47
  # Get the prompt to use - you can modify this!
48
  prompt = hub.pull("hwchase17/openai-tools-agent")
49
  # print(prompt.messages) -- to see the prompt
50
- agent = create_openai_tools_agent(
51
- model.with_config({"tags": ["agent_llm"]}), tools, prompt
52
- )
53
  agent_executor = AgentExecutor(agent=agent, tools=tools).with_config(
54
  {"run_name": "Agent"}
55
  )
 
56
  async def interact_with_langchain_agent(prompt, messages):
57
  messages.append(ChatMessage(role="user", content=prompt))
58
  yield messages
 
30
  )
31
 
32
  # 2. Create model
33
+ llm = HuggingFacePipeline.from_model_id(
34
  model_id="EpistemeAI/Fireball-Meta-Llama-3.1-8B-Instruct-Agent-0.003",
35
  task="text-generation",
36
  pipeline_kwargs=dict(
 
47
  # Get the prompt to use - you can modify this!
48
  prompt = hub.pull("hwchase17/openai-tools-agent")
49
  # print(prompt.messages) -- to see the prompt
50
+ # Construct the ReAct agent
51
+ agent = create_react_agent(llm, tools, prompt)
52
+
53
  agent_executor = AgentExecutor(agent=agent, tools=tools).with_config(
54
  {"run_name": "Agent"}
55
  )
56
+
57
  async def interact_with_langchain_agent(prompt, messages):
58
  messages.append(ChatMessage(role="user", content=prompt))
59
  yield messages