Spaces:
Running
Running
tool debug
Browse files
app.py
CHANGED
@@ -59,19 +59,6 @@ llm = HuggingFaceEndpoint(
|
|
59 |
|
60 |
model = ChatHuggingFace(llm=llm, verbose=True)
|
61 |
|
62 |
-
"""
|
63 |
-
def predict(message, history):
|
64 |
-
history_langchain_format = []
|
65 |
-
for msg in history:
|
66 |
-
if msg['role'] == "user":
|
67 |
-
history_langchain_format.append(HumanMessage(content=msg['content']))
|
68 |
-
elif msg['role'] == "assistant":
|
69 |
-
history_langchain_format.append(AIMessage(content=msg['content']))
|
70 |
-
history_langchain_format.append(HumanMessage(content=message))
|
71 |
-
gpt_response = model.invoke(history_langchain_format)
|
72 |
-
return gpt_response.content
|
73 |
-
"""
|
74 |
-
|
75 |
def predict(message, history):
|
76 |
# Convert Gradio history to LangChain message format
|
77 |
history_langchain_format = []
|
@@ -100,7 +87,7 @@ guest_info_tool = Tool(
|
|
100 |
func=extract_text,
|
101 |
description="Retrieves detailed information about gala guests based on their name or relation."
|
102 |
)
|
103 |
-
|
104 |
search_tool = DuckDuckGoSearchRun()
|
105 |
|
106 |
def get_weather_info(location: str) -> str:
|
@@ -143,7 +130,7 @@ hub_stats_tool = Tool(
|
|
143 |
func=get_hub_stats,
|
144 |
description="Fetches the most downloaded model from a specific author on the Hugging Face Hub."
|
145 |
)
|
146 |
-
|
147 |
#tools = [guest_info_tool, search_tool, weather_info_tool, hub_stats_tool]
|
148 |
tools = [guest_info_tool]
|
149 |
chat_with_tools = model.bind_tools(tools)
|
|
|
59 |
|
60 |
model = ChatHuggingFace(llm=llm, verbose=True)
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
def predict(message, history):
|
63 |
# Convert Gradio history to LangChain message format
|
64 |
history_langchain_format = []
|
|
|
87 |
func=extract_text,
|
88 |
description="Retrieves detailed information about gala guests based on their name or relation."
|
89 |
)
|
90 |
+
"""
|
91 |
search_tool = DuckDuckGoSearchRun()
|
92 |
|
93 |
def get_weather_info(location: str) -> str:
|
|
|
130 |
func=get_hub_stats,
|
131 |
description="Fetches the most downloaded model from a specific author on the Hugging Face Hub."
|
132 |
)
|
133 |
+
"""
|
134 |
#tools = [guest_info_tool, search_tool, weather_info_tool, hub_stats_tool]
|
135 |
tools = [guest_info_tool]
|
136 |
chat_with_tools = model.bind_tools(tools)
|