Revamp stuff
Browse files- README.md +0 -1
- app.py +1 -0
- requirements.txt +3 -2
- utils/huggingface_mcp_llamaindex.py +6 -2
README.md
CHANGED
@@ -4,7 +4,6 @@ emoji: 🐢
|
|
4 |
colorFrom: green
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 5.27.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
4 |
colorFrom: green
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
|
|
7 |
app_file: app.py
|
8 |
pinned: false
|
9 |
license: mit
|
app.py
CHANGED
@@ -11,6 +11,7 @@ from utils.huggingface_mcp_llamaindex import connect_and_get_tools, call_tool
|
|
11 |
from prompts.devstral_coding_prompt import devstral_code_gen_sys_prompt, devstral_code_gen_user_prompt
|
12 |
from dotenv import load_dotenv
|
13 |
import os
|
|
|
14 |
load_dotenv()
|
15 |
|
16 |
# Import Modal inference function
|
|
|
11 |
from prompts.devstral_coding_prompt import devstral_code_gen_sys_prompt, devstral_code_gen_user_prompt
|
12 |
from dotenv import load_dotenv
|
13 |
import os
|
14 |
+
import asyncio
|
15 |
load_dotenv()
|
16 |
|
17 |
# Import Modal inference function
|
requirements.txt
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
-
|
|
|
2 |
google-genai==1.19.0
|
3 |
-
gradio
|
4 |
pandas==2.3.0
|
5 |
python-dotenv==1.0.1
|
6 |
openpyxl==3.1.5
|
|
|
1 |
+
mcp
|
2 |
+
llama-index-tools-mcp
|
3 |
google-genai==1.19.0
|
4 |
+
gradio
|
5 |
pandas==2.3.0
|
6 |
python-dotenv==1.0.1
|
7 |
openpyxl==3.1.5
|
utils/huggingface_mcp_llamaindex.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from llama_index.tools.mcp import BasicMCPClient
|
2 |
from dotenv import load_dotenv
|
3 |
import os
|
|
|
4 |
load_dotenv()
|
5 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
6 |
async def connect_and_get_tools():
|
@@ -8,10 +9,13 @@ async def connect_and_get_tools():
|
|
8 |
http_client = BasicMCPClient("https://huggingface.co/mcp", headers={"Authorization": f"Bearer {HF_TOKEN}"})
|
9 |
|
10 |
# List available tools
|
11 |
-
tools = await http_client.list_tools()
|
12 |
return tools
|
13 |
|
14 |
async def call_tool(tool_name, tool_args):
|
15 |
http_client = BasicMCPClient("https://huggingface.co/mcp", headers={"Authorization": f"Bearer {HF_TOKEN}"})
|
16 |
-
result = await
|
|
|
|
|
|
|
17 |
return result
|
|
|
1 |
from llama_index.tools.mcp import BasicMCPClient
|
2 |
from dotenv import load_dotenv
|
3 |
import os
|
4 |
+
import asyncio
|
5 |
load_dotenv()
|
6 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
7 |
async def connect_and_get_tools():
|
|
|
9 |
http_client = BasicMCPClient("https://huggingface.co/mcp", headers={"Authorization": f"Bearer {HF_TOKEN}"})
|
10 |
|
11 |
# List available tools
|
12 |
+
tools = await asyncio.wait_for(http_client.list_tools(), timeout=10.0)
|
13 |
return tools
|
14 |
|
15 |
async def call_tool(tool_name, tool_args):
|
16 |
http_client = BasicMCPClient("https://huggingface.co/mcp", headers={"Authorization": f"Bearer {HF_TOKEN}"})
|
17 |
+
result = await asyncio.wait_for(
|
18 |
+
http_client.call_tool(tool_name, tool_args),
|
19 |
+
timeout=30.0
|
20 |
+
)
|
21 |
return result
|