builtsimple-research 1.0.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Built Simple Research - Unified API for PubMed, ArXiv, and Wikipedia"""
|
|
2
|
+
import httpx
|
|
3
|
+
from typing import List, Optional, Dict, Any
|
|
4
|
+
|
|
5
|
+
__version__ = "1.0.0"
|
|
6
|
+
|
|
7
|
+
BASE_URLS = {
|
|
8
|
+
"pubmed": "https://pubmed.built-simple.ai",
|
|
9
|
+
"arxiv": "https://arxiv.built-simple.ai",
|
|
10
|
+
"wikipedia": "https://wikipedia.built-simple.ai"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async def search_pubmed(query: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
14
|
+
"""Search PubMed biomedical literature."""
|
|
15
|
+
async with httpx.AsyncClient() as client:
|
|
16
|
+
response = await client.post(
|
|
17
|
+
f"{BASE_URLS['pubmed']}/search",
|
|
18
|
+
json={"query": query, "limit": limit}
|
|
19
|
+
)
|
|
20
|
+
data = response.json()
|
|
21
|
+
return [{"source": "PubMed", **r} for r in data.get("results", [])]
|
|
22
|
+
|
|
23
|
+
async def search_arxiv(query: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
24
|
+
"""Search ArXiv scientific preprints."""
|
|
25
|
+
async with httpx.AsyncClient() as client:
|
|
26
|
+
response = await client.get(
|
|
27
|
+
f"{BASE_URLS['arxiv']}/api/search",
|
|
28
|
+
params={"q": query, "limit": limit}
|
|
29
|
+
)
|
|
30
|
+
data = response.json()
|
|
31
|
+
return [{"source": "ArXiv", **r} for r in data.get("results", [])]
|
|
32
|
+
|
|
33
|
+
async def search_wikipedia(query: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
34
|
+
"""Search Wikipedia articles."""
|
|
35
|
+
async with httpx.AsyncClient() as client:
|
|
36
|
+
response = await client.post(
|
|
37
|
+
f"{BASE_URLS['wikipedia']}/api/search",
|
|
38
|
+
json={"query": query, "limit": limit}
|
|
39
|
+
)
|
|
40
|
+
data = response.json()
|
|
41
|
+
return [{"source": "Wikipedia", **r} for r in data.get("results", [])]
|
|
42
|
+
|
|
43
|
+
async def search_all(query: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
44
|
+
"""Search all sources in parallel."""
|
|
45
|
+
import asyncio
|
|
46
|
+
results = await asyncio.gather(
|
|
47
|
+
search_pubmed(query, limit),
|
|
48
|
+
search_arxiv(query, limit),
|
|
49
|
+
search_wikipedia(query, limit)
|
|
50
|
+
)
|
|
51
|
+
return results[0] + results[1] + results[2]
|
|
52
|
+
|
|
53
|
+
# Sync versions for convenience
|
|
54
|
+
def search_pubmed_sync(query: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
55
|
+
"""Synchronous PubMed search."""
|
|
56
|
+
response = httpx.post(
|
|
57
|
+
f"{BASE_URLS['pubmed']}/search",
|
|
58
|
+
json={"query": query, "limit": limit}
|
|
59
|
+
)
|
|
60
|
+
return [{"source": "PubMed", **r} for r in response.json().get("results", [])]
|
|
61
|
+
|
|
62
|
+
def search_arxiv_sync(query: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
63
|
+
"""Synchronous ArXiv search."""
|
|
64
|
+
response = httpx.get(
|
|
65
|
+
f"{BASE_URLS['arxiv']}/api/search",
|
|
66
|
+
params={"q": query, "limit": limit}
|
|
67
|
+
)
|
|
68
|
+
return [{"source": "ArXiv", **r} for r in response.json().get("results", [])]
|
|
69
|
+
|
|
70
|
+
def search_wikipedia_sync(query: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
71
|
+
"""Synchronous Wikipedia search."""
|
|
72
|
+
response = httpx.post(
|
|
73
|
+
f"{BASE_URLS['wikipedia']}/api/search",
|
|
74
|
+
json={"query": query, "limit": limit}
|
|
75
|
+
)
|
|
76
|
+
return [{"source": "Wikipedia", **r} for r in response.json().get("results", [])]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: builtsimple-research
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Unified API for PubMed, ArXiv, and Wikipedia semantic search
|
|
5
|
+
Project-URL: Homepage, https://built-simple.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/Built-Simple/python-builtsimple
|
|
7
|
+
Author: Built-Simple.ai
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Keywords: api,arxiv,pubmed,research,semantic-search,wikipedia
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Requires-Dist: httpx>=0.24.0
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# builtsimple-research
|
|
18
|
+
|
|
19
|
+
Unified API for searching PubMed, ArXiv, and Wikipedia.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install builtsimple-research
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### Async (recommended)
|
|
30
|
+
```python
|
|
31
|
+
import asyncio
|
|
32
|
+
from builtsimple_research import search_pubmed, search_arxiv, search_wikipedia, search_all
|
|
33
|
+
|
|
34
|
+
async def main():
|
|
35
|
+
# Search individual sources
|
|
36
|
+
pubmed = await search_pubmed("cancer treatment", limit=5)
|
|
37
|
+
arxiv = await search_arxiv("transformer attention", limit=5)
|
|
38
|
+
wiki = await search_wikipedia("machine learning", limit=5)
|
|
39
|
+
|
|
40
|
+
# Search all at once
|
|
41
|
+
all_results = await search_all("neural networks", limit=5)
|
|
42
|
+
|
|
43
|
+
asyncio.run(main())
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Sync
|
|
47
|
+
```python
|
|
48
|
+
from builtsimple_research import search_pubmed_sync, search_arxiv_sync, search_wikipedia_sync
|
|
49
|
+
|
|
50
|
+
results = search_pubmed_sync("cancer treatment", limit=5)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## API
|
|
54
|
+
|
|
55
|
+
- `search_pubmed(query, limit=10)` - 4.5M+ biomedical articles
|
|
56
|
+
- `search_arxiv(query, limit=10)` - Scientific preprints
|
|
57
|
+
- `search_wikipedia(query, limit=10)` - 4.8M+ articles
|
|
58
|
+
- `search_all(query, limit=10)` - All sources in parallel
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT - Built-Simple.ai
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
builtsimple_research/__init__.py,sha256=XMWHQYSaZkJ1opFgaxsfZ16ZQp0N1xH9Qu_yj0LR_Eo,2923
|
|
2
|
+
builtsimple_research-1.0.0.dist-info/METADATA,sha256=70StI2bfRhlr8kXOQb8iNzYjriaQ-IoKzlzdyxZ6IpY,1740
|
|
3
|
+
builtsimple_research-1.0.0.dist-info/WHEEL,sha256=aha0VrrYvgDJ3Xxl3db_g_MDIW-ZexDdrc_m-Hk8YY4,105
|
|
4
|
+
builtsimple_research-1.0.0.dist-info/RECORD,,
|