Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ quantization_config = BitsAndBytesConfig(
|
|
30 |
)
|
31 |
|
32 |
# 2. Create model
|
33 |
-
|
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 |
-
|
51 |
-
|
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
|