Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
6c75a78
1
Parent(s): ac3d272
Remove test files and build artifacts from git tracking
Browse files- Remove testing.py and test_whoosh_search.py
- Remove frontend/tsconfig.tsbuildinfo from tracking
- Add tsconfig.tsbuildinfo to .gitignore
- .gitignore +1 -0
- frontend/tsconfig.tsbuildinfo +0 -1
- test_whoosh_search.py +0 -61
- testing.py +0 -158
.gitignore
CHANGED
|
@@ -68,3 +68,4 @@ models/
|
|
| 68 |
checkpoint-*/
|
| 69 |
runs/
|
| 70 |
wandb/
|
|
|
|
|
|
| 68 |
checkpoint-*/
|
| 69 |
runs/
|
| 70 |
wandb/
|
| 71 |
+
frontend/tsconfig.tsbuildinfo
|
frontend/tsconfig.tsbuildinfo
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
{"root":["./src/app.tsx","./src/main.tsx","./src/theme.ts","./src/vite-env.d.ts","./src/components/approvalmodal/approvalmodal.tsx","./src/components/chat/chatinput.tsx","./src/components/chat/messagebubble.tsx","./src/components/chat/messagelist.tsx","./src/components/layout/applayout.tsx","./src/components/sessionsidebar/sessionsidebar.tsx","./src/hooks/useagentwebsocket.ts","./src/store/agentstore.ts","./src/store/sessionstore.ts","./src/types/agent.ts","./src/types/events.ts"],"errors":true,"version":"5.6.3"}
|
|
|
|
|
|
test_whoosh_search.py
DELETED
|
@@ -1,61 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""Quick manual tester for Whoosh-backed search tools."""
|
| 3 |
-
|
| 4 |
-
import asyncio
|
| 5 |
-
|
| 6 |
-
from agent.tools.docs_tools import explore_hf_docs_handler, search_openapi_handler
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
async def test_docs_search() -> None:
|
| 10 |
-
"""Test HF docs search."""
|
| 11 |
-
print("=" * 60)
|
| 12 |
-
print("Testing explore_hf_docs (optimum, 'chat interface')")
|
| 13 |
-
print("=" * 60)
|
| 14 |
-
result, success = await explore_hf_docs_handler(
|
| 15 |
-
arguments={
|
| 16 |
-
"endpoint": "optimum",
|
| 17 |
-
"query": "chat interface",
|
| 18 |
-
"max_results": 5,
|
| 19 |
-
}
|
| 20 |
-
)
|
| 21 |
-
print(f"Success: {success}")
|
| 22 |
-
print(result[:1000] if len(result) > 1000 else result)
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
async def test_api_search() -> None:
|
| 26 |
-
"""Test OpenAPI search."""
|
| 27 |
-
print("\n" + "=" * 60)
|
| 28 |
-
print("Testing find_hf_api ('list user spaces')")
|
| 29 |
-
print("=" * 60)
|
| 30 |
-
result, success = await search_openapi_handler(
|
| 31 |
-
arguments={
|
| 32 |
-
"query": "list user spaces",
|
| 33 |
-
}
|
| 34 |
-
)
|
| 35 |
-
print(f"Success: {success}")
|
| 36 |
-
print(result[:2000] if len(result) > 2000 else result)
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
async def test_api_search_with_tag() -> None:
|
| 40 |
-
"""Test OpenAPI search with tag filter."""
|
| 41 |
-
print("\n" + "=" * 60)
|
| 42 |
-
print("Testing find_hf_api ('spaces', tag='spaces')")
|
| 43 |
-
print("=" * 60)
|
| 44 |
-
result, success = await search_openapi_handler(
|
| 45 |
-
arguments={
|
| 46 |
-
"query": "list",
|
| 47 |
-
"tag": "spaces",
|
| 48 |
-
}
|
| 49 |
-
)
|
| 50 |
-
print(f"Success: {success}")
|
| 51 |
-
print(result[:2000] if len(result) > 2000 else result)
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
def main() -> None:
|
| 55 |
-
# asyncio.run(test_docs_search())
|
| 56 |
-
asyncio.run(test_api_search())
|
| 57 |
-
# asyncio.run(test_api_search_with_tag())
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
if __name__ == "__main__":
|
| 61 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
testing.py
DELETED
|
@@ -1,158 +0,0 @@
|
|
| 1 |
-
import asyncio
|
| 2 |
-
|
| 3 |
-
from agent.tools.dataset_tools import hf_inspect_dataset_handler, inspect_dataset
|
| 4 |
-
from agent.tools.docs_tools import (
|
| 5 |
-
explore_hf_docs_handler,
|
| 6 |
-
hf_docs_fetch_handler,
|
| 7 |
-
search_openapi_handler,
|
| 8 |
-
)
|
| 9 |
-
from agent.tools.github_find_examples import find_examples, github_find_examples_handler
|
| 10 |
-
from agent.tools.github_list_repos import github_list_repos_handler, list_repos
|
| 11 |
-
from agent.tools.github_read_file import github_read_file_handler, read_file
|
| 12 |
-
from agent.tools.hf_repo_files_tool import hf_repo_files_handler
|
| 13 |
-
from agent.tools.hf_repo_git_tool import hf_repo_git_handler
|
| 14 |
-
from agent.tools.jobs_tool import hf_jobs_handler
|
| 15 |
-
from agent.tools.plan_tool import get_current_plan, plan_tool_handler
|
| 16 |
-
from agent.tools.private_hf_repo_tools import private_hf_repo_handler
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
# Dataset tools
|
| 20 |
-
async def test_inspect_dataset():
|
| 21 |
-
result = await inspect_dataset(dataset="HuggingFaceFW/finetranslations")
|
| 22 |
-
print(result["formatted"], len(result["formatted"]))
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
async def test_hf_inspect_dataset_handler():
|
| 26 |
-
result, success = await hf_inspect_dataset_handler(
|
| 27 |
-
{"dataset": "HuggingFaceFW/finetranslations"}
|
| 28 |
-
)
|
| 29 |
-
print(result, success)
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
# GitHub tools
|
| 33 |
-
def test_list_repos():
|
| 34 |
-
result = list_repos(owner="huggingface", owner_type="org", sort="stars", limit=5)
|
| 35 |
-
print(result["formatted"], len(result["formatted"]))
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
async def test_github_list_repos_handler():
|
| 39 |
-
result, success = await github_list_repos_handler(
|
| 40 |
-
{"owner": "huggingface", "owner_type": "org", "sort": "stars", "limit": 5}
|
| 41 |
-
)
|
| 42 |
-
print(result, success)
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
def test_read_file():
|
| 46 |
-
result = read_file(
|
| 47 |
-
repo="huggingface/transformers",
|
| 48 |
-
path="/src/transformers/loss/loss_for_object_detection.py",
|
| 49 |
-
)
|
| 50 |
-
print(result["formatted"], len(result["formatted"]))
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
async def test_github_read_file_handler():
|
| 54 |
-
result, success = await github_read_file_handler(
|
| 55 |
-
{"repo": "huggingface/transformers", "path": "README.md"}
|
| 56 |
-
)
|
| 57 |
-
print(result, success)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
def test_find_examples():
|
| 61 |
-
result = find_examples(
|
| 62 |
-
keyword="sft",
|
| 63 |
-
repo="transformers",
|
| 64 |
-
org="huggingface",
|
| 65 |
-
max_results=5,
|
| 66 |
-
min_score=40,
|
| 67 |
-
)
|
| 68 |
-
print(result["formatted"], len(result["formatted"]))
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
async def test_github_find_examples_handler():
|
| 72 |
-
result, success = await github_find_examples_handler(
|
| 73 |
-
{"keyword": "grpo", "repo": "trl", "org": "huggingface", "max_results": 5}
|
| 74 |
-
)
|
| 75 |
-
print(result, success)
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
async def test_explore_hf_docs_handler():
|
| 79 |
-
result, success = await explore_hf_docs_handler({"endpoint": "trl"})
|
| 80 |
-
print(result, success)
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
async def test_search_openapi_handler():
|
| 84 |
-
result, success = await search_openapi_handler({"tag": "spaces", "query": "logs"})
|
| 85 |
-
print(result, success)
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
async def test_hf_docs_fetch_handler():
|
| 89 |
-
result, success = await hf_docs_fetch_handler(
|
| 90 |
-
{"url": "https://huggingface.co/docs/trl/main/en/sft_trainer"}
|
| 91 |
-
)
|
| 92 |
-
print(result, success)
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
# Jobs tool
|
| 96 |
-
async def test_hf_jobs_handler():
|
| 97 |
-
result, success = await hf_jobs_handler({"operation": "ps"})
|
| 98 |
-
print(result, success)
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
# Plan tool
|
| 102 |
-
async def test_plan_tool_handler():
|
| 103 |
-
result, success = await plan_tool_handler(
|
| 104 |
-
{"todos": [{"id": "1", "content": "Test task", "status": "pending"}]}
|
| 105 |
-
)
|
| 106 |
-
print(result, success)
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
def test_get_current_plan():
|
| 110 |
-
plan = get_current_plan()
|
| 111 |
-
print(plan)
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
# Private HF Repo tools
|
| 115 |
-
async def test_private_hf_repo_handler():
|
| 116 |
-
result, success = await private_hf_repo_handler(
|
| 117 |
-
{"operation": "list", "repo_id": "test-repo", "repo_type": "dataset"}
|
| 118 |
-
)
|
| 119 |
-
print(result, success)
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
# HF Repo Files tool
|
| 123 |
-
async def test_hf_repo_files_handler():
|
| 124 |
-
result, success = await hf_repo_files_handler(
|
| 125 |
-
{"operation": "list", "repo_id": "bert-base-uncased", "repo_type": "model"}
|
| 126 |
-
)
|
| 127 |
-
print(result, success)
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
# HF Repo Git tool
|
| 131 |
-
async def test_hf_repo_git_handler():
|
| 132 |
-
result, success = await hf_repo_git_handler(
|
| 133 |
-
{"operation": "status", "repo_id": "test-repo", "repo_type": "model"}
|
| 134 |
-
)
|
| 135 |
-
print(result, success)
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
if __name__ == "__main__":
|
| 139 |
-
# Uncomment the test you want to run:
|
| 140 |
-
# asyncio.run(test_inspect_dataset())
|
| 141 |
-
# test_list_repos()
|
| 142 |
-
# asyncio.run(test_github_list_repos_handler())
|
| 143 |
-
# test_read_file()
|
| 144 |
-
# asyncio.run(test_github_read_file_handler())
|
| 145 |
-
# test_search_code()
|
| 146 |
-
# asyncio.run(test_github_search_code_handler())
|
| 147 |
-
# test_find_examples()
|
| 148 |
-
# asyncio.run(test_github_find_examples_handler())
|
| 149 |
-
# asyncio.run(test_explore_hf_docs()) # definitely issues
|
| 150 |
-
# asyncio.run(test_explore_hf_docs_handler())
|
| 151 |
-
asyncio.run(test_search_openapi_handler())
|
| 152 |
-
# asyncio.run(test_hf_docs_fetch_handler())
|
| 153 |
-
# asyncio.run(test_hf_jobs_handler())
|
| 154 |
-
# asyncio.run(test_plan_tool_handler())
|
| 155 |
-
# test_get_current_plan()
|
| 156 |
-
# asyncio.run(test_private_hf_repo_handler())
|
| 157 |
-
# asyncio.run(test_hf_repo_files_handler())
|
| 158 |
-
# asyncio.run(test_hf_repo_git_handler())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|