searchly 2.0.5__tar.gz → 2.2.0__tar.gz
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.
- searchly-2.2.0/PKG-INFO +148 -0
- searchly-2.2.0/README.md +105 -0
- searchly-2.2.0/pyproject.toml +309 -0
- searchly-2.0.5/pyproject.toml → searchly-2.2.0/pyproject.toml.orig +84 -33
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/__init__.py +1 -1
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/exceptions.py +1 -1
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/brave_provider/client.py +3 -3
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/dataforseo_provider/dataforseo.py +2 -2
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/exa_provider/exa.py +14 -7
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/jigsawstack_provider/jigsawstack.py +2 -2
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/kagi_provider/client.py +3 -3
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/linkup_provider/client.py +2 -2
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/search1_provider/client.py +2 -2
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/serper_provider/client.py +2 -2
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/tavily_provider/client.py +9 -7
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/you_provider/you.py +2 -2
- searchly-2.2.0/src/searchly_config/__init__.py +48 -0
- searchly-2.0.5/src/searchly/config.py → searchly-2.2.0/src/searchly_config/configs.py +2 -2
- searchly-2.2.0/src/searchly_config/py.typed +0 -0
- searchly-2.0.5/PKG-INFO +0 -70
- searchly-2.0.5/README.md +0 -26
- {searchly-2.0.5 → searchly-2.2.0}/LICENSE +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/base.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/log.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/brave_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/dataforseo_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/exa_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/jigsawstack_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/kagi_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/linkup_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/search1_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/serpapi_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/serpapi_provider/client.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/serper_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/tavily_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/providers/you_provider/__init__.py +0 -0
- {searchly-2.0.5 → searchly-2.2.0}/src/searchly/py.typed +0 -0
searchly-2.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: searchly
|
|
3
|
+
Version: 2.2.0
|
|
4
|
+
Summary: Unified async clients for web and news search APIs, built for AI agents
|
|
5
|
+
Keywords: agents,ai,async,brave,exa,llm,news-search,search,serper,tavily,web-search
|
|
6
|
+
Author: Philipp Temminghoff
|
|
7
|
+
Author-email: Philipp Temminghoff <philipptemminghoff@googlemail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Framework :: Pydantic
|
|
12
|
+
Classifier: Framework :: Pydantic :: 2
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Dist: anyenv[httpx2]>=2.1.0
|
|
24
|
+
Requires-Dist: pydantic
|
|
25
|
+
Requires-Dist: httpx2>=2.16
|
|
26
|
+
Requires-Dist: schemez>=2.1.5
|
|
27
|
+
Requires-Dist: brave-search-python-client ; extra == 'all'
|
|
28
|
+
Requires-Dist: psutil ; extra == 'all'
|
|
29
|
+
Requires-Dist: exa-py>=2.0.0 ; extra == 'all'
|
|
30
|
+
Requires-Dist: brave-search-python-client ; extra == 'brave-search-python-client'
|
|
31
|
+
Requires-Dist: psutil ; extra == 'brave-search-python-client'
|
|
32
|
+
Requires-Dist: exa-py>=2.0.0 ; extra == 'exa'
|
|
33
|
+
Requires-Python: >=3.13
|
|
34
|
+
Project-URL: Code coverage, https://app.codecov.io/gh/phil65/Searchly
|
|
35
|
+
Project-URL: Documentation, https://phil65.github.io/Searchly/
|
|
36
|
+
Project-URL: Homepage, https://phil65.github.io/Searchly/
|
|
37
|
+
Project-URL: Issues, https://github.com/phil65/Searchly/issues
|
|
38
|
+
Project-URL: Source, https://github.com/phil65/Searchly
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Provides-Extra: brave-search-python-client
|
|
41
|
+
Provides-Extra: exa
|
|
42
|
+
Description-Content-Type: text/markdown
|
|
43
|
+
|
|
44
|
+
# Searchly
|
|
45
|
+
|
|
46
|
+
[](https://pypi.org/project/searchly/)
|
|
47
|
+
[](https://pypi.org/project/searchly/)
|
|
48
|
+
[](https://pypi.org/project/searchly/)
|
|
49
|
+
[](https://pypi.org/project/searchly/)
|
|
50
|
+
[](https://pypi.org/project/searchly/)
|
|
51
|
+
[](https://pypi.org/project/searchly/)
|
|
52
|
+
[](https://pypi.org/project/searchly/)
|
|
53
|
+
[](https://github.com/phil65/searchly/releases)
|
|
54
|
+
[](https://github.com/phil65/searchly/graphs/contributors)
|
|
55
|
+
[](https://github.com/phil65/searchly/forks)
|
|
56
|
+
[](https://github.com/phil65/searchly/issues)
|
|
57
|
+
[](https://github.com/phil65/searchly/pulls)
|
|
58
|
+
[](https://github.com/phil65/searchly/watchers)
|
|
59
|
+
[](https://github.com/phil65/searchly/stars)
|
|
60
|
+
[](https://github.com/phil65/searchly)
|
|
61
|
+
[](https://github.com/phil65/searchly/commits)
|
|
62
|
+
[](https://github.com/phil65/searchly/releases)
|
|
63
|
+
[](https://github.com/phil65/searchly)
|
|
64
|
+
[](https://github.com/phil65/searchly)
|
|
65
|
+
[](https://codecov.io/gh/phil65/searchly/)
|
|
66
|
+
[](https://pyup.io/repos/github/phil65/searchly/)
|
|
67
|
+
|
|
68
|
+
[Read the documentation!](https://phil65.github.io/Searchly/)
|
|
69
|
+
|
|
70
|
+
Searchly gives AI agents (and anyone else) one async interface to many web and news search
|
|
71
|
+
APIs. Every provider returns the same pydantic result models, so switching from Serper to
|
|
72
|
+
Tavily or Brave is a one-line change.
|
|
73
|
+
|
|
74
|
+
## Installation
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install searchly
|
|
78
|
+
# optional SDK-based providers
|
|
79
|
+
pip install "searchly[exa]" # Exa
|
|
80
|
+
pip install "searchly[brave_search_python_client]" # Brave
|
|
81
|
+
pip install "searchly[all]"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Requires Python 3.13+.
|
|
85
|
+
|
|
86
|
+
## Quickstart
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import asyncio
|
|
90
|
+
|
|
91
|
+
from searchly import AsyncSerperClient
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
async def main() -> None:
|
|
95
|
+
client = AsyncSerperClient() # reads SERPER_API_KEY, or pass api_key="..."
|
|
96
|
+
response = await client.web_search("python asyncio tutorial", max_results=5, country="US")
|
|
97
|
+
for result in response.results:
|
|
98
|
+
print(result.title, result.url)
|
|
99
|
+
|
|
100
|
+
news = await client.news_search("open source AI", max_results=3)
|
|
101
|
+
for item in news.results:
|
|
102
|
+
print(item.published, item.source, item.title)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
asyncio.run(main())
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Configuration-driven providers
|
|
109
|
+
|
|
110
|
+
`searchly_config` holds lightweight pydantic configs (a discriminated union on `type`) that
|
|
111
|
+
create providers lazily, which makes search backends easy to put into YAML/JSON settings:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from pydantic import TypeAdapter
|
|
115
|
+
|
|
116
|
+
from searchly import WebSearchProviderConfig
|
|
117
|
+
|
|
118
|
+
config = TypeAdapter(WebSearchProviderConfig).validate_python({"type": "tavily"})
|
|
119
|
+
if config.is_configured(): # api_key field or TAVILY_API_KEY env var
|
|
120
|
+
provider = config.get_provider()
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Providers
|
|
124
|
+
|
|
125
|
+
| Provider | Client | Web | News | API key env var |
|
|
126
|
+
| --- | --- | --- | --- | --- |
|
|
127
|
+
| Brave | `AsyncBraveSearch` | yes | yes | `BRAVE_API_KEY` |
|
|
128
|
+
| DataForSEO | `AsyncDataForSEOClient` | yes | yes | `DATAFORSEO_LOGIN`, `DATAFORSEO_PASSWORD` |
|
|
129
|
+
| Exa | `AsyncExaClient` | yes | | `EXA_API_KEY` |
|
|
130
|
+
| JigsawStack | `AsyncJigsawStackClient` | yes | | `JIGSAWSTACK_API_KEY` |
|
|
131
|
+
| Kagi | `AsyncKagiClient` | yes | | `KAGI_API_KEY` |
|
|
132
|
+
| LinkUp | `AsyncLinkUpClient` | yes | | `LINKUP_API_KEY` |
|
|
133
|
+
| Search1API | `AsyncSearch1API` | yes | | `SEARCH1API_KEY` |
|
|
134
|
+
| SerpAPI | `AsyncSerpAPIClient` | yes | yes | `SERPAPI_KEY` |
|
|
135
|
+
| Serper | `AsyncSerperClient` | yes | yes | `SERPER_API_KEY` |
|
|
136
|
+
| Tavily | `AsyncTavilyClient` | yes | yes | `TAVILY_API_KEY` |
|
|
137
|
+
| You.com | `AsyncYouClient` | yes | yes | `YOU_API_KEY` |
|
|
138
|
+
|
|
139
|
+
## Features
|
|
140
|
+
|
|
141
|
+
- **Common protocols**: `WebSearchProvider.web_search()` and `NewsSearchProvider.news_search()`
|
|
142
|
+
with shared `query`, `max_results`, `country` and `language` arguments; provider-specific
|
|
143
|
+
options are extra keyword arguments.
|
|
144
|
+
- **Unified results**: `WebSearchResponse` / `NewsSearchResponse` with `WebSearchResult`
|
|
145
|
+
(`title`, `url`, `snippet`) and `NewsSearchResult` (adds `source`, `published`).
|
|
146
|
+
- **Typed**: `CountryCode` and `LanguageCode` literals, full type hints, `py.typed`.
|
|
147
|
+
- **Config models**: `WebSearchProviderConfig`, `NewsSearchProviderConfig`, `get_config_class()`
|
|
148
|
+
for building providers from settings, with secrets stored as `SecretStr`.
|
searchly-2.2.0/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Searchly
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/searchly/)
|
|
4
|
+
[](https://pypi.org/project/searchly/)
|
|
5
|
+
[](https://pypi.org/project/searchly/)
|
|
6
|
+
[](https://pypi.org/project/searchly/)
|
|
7
|
+
[](https://pypi.org/project/searchly/)
|
|
8
|
+
[](https://pypi.org/project/searchly/)
|
|
9
|
+
[](https://pypi.org/project/searchly/)
|
|
10
|
+
[](https://github.com/phil65/searchly/releases)
|
|
11
|
+
[](https://github.com/phil65/searchly/graphs/contributors)
|
|
12
|
+
[](https://github.com/phil65/searchly/forks)
|
|
13
|
+
[](https://github.com/phil65/searchly/issues)
|
|
14
|
+
[](https://github.com/phil65/searchly/pulls)
|
|
15
|
+
[](https://github.com/phil65/searchly/watchers)
|
|
16
|
+
[](https://github.com/phil65/searchly/stars)
|
|
17
|
+
[](https://github.com/phil65/searchly)
|
|
18
|
+
[](https://github.com/phil65/searchly/commits)
|
|
19
|
+
[](https://github.com/phil65/searchly/releases)
|
|
20
|
+
[](https://github.com/phil65/searchly)
|
|
21
|
+
[](https://github.com/phil65/searchly)
|
|
22
|
+
[](https://codecov.io/gh/phil65/searchly/)
|
|
23
|
+
[](https://pyup.io/repos/github/phil65/searchly/)
|
|
24
|
+
|
|
25
|
+
[Read the documentation!](https://phil65.github.io/Searchly/)
|
|
26
|
+
|
|
27
|
+
Searchly gives AI agents (and anyone else) one async interface to many web and news search
|
|
28
|
+
APIs. Every provider returns the same pydantic result models, so switching from Serper to
|
|
29
|
+
Tavily or Brave is a one-line change.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install searchly
|
|
35
|
+
# optional SDK-based providers
|
|
36
|
+
pip install "searchly[exa]" # Exa
|
|
37
|
+
pip install "searchly[brave_search_python_client]" # Brave
|
|
38
|
+
pip install "searchly[all]"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Requires Python 3.13+.
|
|
42
|
+
|
|
43
|
+
## Quickstart
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
import asyncio
|
|
47
|
+
|
|
48
|
+
from searchly import AsyncSerperClient
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
async def main() -> None:
|
|
52
|
+
client = AsyncSerperClient() # reads SERPER_API_KEY, or pass api_key="..."
|
|
53
|
+
response = await client.web_search("python asyncio tutorial", max_results=5, country="US")
|
|
54
|
+
for result in response.results:
|
|
55
|
+
print(result.title, result.url)
|
|
56
|
+
|
|
57
|
+
news = await client.news_search("open source AI", max_results=3)
|
|
58
|
+
for item in news.results:
|
|
59
|
+
print(item.published, item.source, item.title)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
asyncio.run(main())
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Configuration-driven providers
|
|
66
|
+
|
|
67
|
+
`searchly_config` holds lightweight pydantic configs (a discriminated union on `type`) that
|
|
68
|
+
create providers lazily, which makes search backends easy to put into YAML/JSON settings:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from pydantic import TypeAdapter
|
|
72
|
+
|
|
73
|
+
from searchly import WebSearchProviderConfig
|
|
74
|
+
|
|
75
|
+
config = TypeAdapter(WebSearchProviderConfig).validate_python({"type": "tavily"})
|
|
76
|
+
if config.is_configured(): # api_key field or TAVILY_API_KEY env var
|
|
77
|
+
provider = config.get_provider()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Providers
|
|
81
|
+
|
|
82
|
+
| Provider | Client | Web | News | API key env var |
|
|
83
|
+
| --- | --- | --- | --- | --- |
|
|
84
|
+
| Brave | `AsyncBraveSearch` | yes | yes | `BRAVE_API_KEY` |
|
|
85
|
+
| DataForSEO | `AsyncDataForSEOClient` | yes | yes | `DATAFORSEO_LOGIN`, `DATAFORSEO_PASSWORD` |
|
|
86
|
+
| Exa | `AsyncExaClient` | yes | | `EXA_API_KEY` |
|
|
87
|
+
| JigsawStack | `AsyncJigsawStackClient` | yes | | `JIGSAWSTACK_API_KEY` |
|
|
88
|
+
| Kagi | `AsyncKagiClient` | yes | | `KAGI_API_KEY` |
|
|
89
|
+
| LinkUp | `AsyncLinkUpClient` | yes | | `LINKUP_API_KEY` |
|
|
90
|
+
| Search1API | `AsyncSearch1API` | yes | | `SEARCH1API_KEY` |
|
|
91
|
+
| SerpAPI | `AsyncSerpAPIClient` | yes | yes | `SERPAPI_KEY` |
|
|
92
|
+
| Serper | `AsyncSerperClient` | yes | yes | `SERPER_API_KEY` |
|
|
93
|
+
| Tavily | `AsyncTavilyClient` | yes | yes | `TAVILY_API_KEY` |
|
|
94
|
+
| You.com | `AsyncYouClient` | yes | yes | `YOU_API_KEY` |
|
|
95
|
+
|
|
96
|
+
## Features
|
|
97
|
+
|
|
98
|
+
- **Common protocols**: `WebSearchProvider.web_search()` and `NewsSearchProvider.news_search()`
|
|
99
|
+
with shared `query`, `max_results`, `country` and `language` arguments; provider-specific
|
|
100
|
+
options are extra keyword arguments.
|
|
101
|
+
- **Unified results**: `WebSearchResponse` / `NewsSearchResponse` with `WebSearchResult`
|
|
102
|
+
(`title`, `url`, `snippet`) and `NewsSearchResult` (adds `source`, `published`).
|
|
103
|
+
- **Typed**: `CountryCode` and `LanguageCode` literals, full type hints, `py.typed`.
|
|
104
|
+
- **Config models**: `WebSearchProviderConfig`, `NewsSearchProviderConfig`, `get_config_class()`
|
|
105
|
+
for building providers from settings, with secrets stored as `SecretStr`.
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "searchly"
|
|
3
|
+
version = "2.2.0"
|
|
4
|
+
description = "Unified async clients for web and news search APIs, built for AI agents"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
keywords = [
|
|
10
|
+
"agents",
|
|
11
|
+
"ai",
|
|
12
|
+
"async",
|
|
13
|
+
"brave",
|
|
14
|
+
"exa",
|
|
15
|
+
"llm",
|
|
16
|
+
"news-search",
|
|
17
|
+
"search",
|
|
18
|
+
"serper",
|
|
19
|
+
"tavily",
|
|
20
|
+
"web-search",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
"Framework :: Pydantic",
|
|
25
|
+
"Framework :: Pydantic :: 2",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Programming Language :: Python :: 3.14",
|
|
32
|
+
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
|
+
"Typing :: Typed",
|
|
36
|
+
]
|
|
37
|
+
dependencies = [
|
|
38
|
+
"anyenv[httpx2]>=2.1.0",
|
|
39
|
+
"pydantic",
|
|
40
|
+
"httpx2>=2.16",
|
|
41
|
+
"schemez>=2.1.5",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[[project.authors]]
|
|
45
|
+
name = "Philipp Temminghoff"
|
|
46
|
+
email = "philipptemminghoff@googlemail.com"
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
"Code coverage" = "https://app.codecov.io/gh/phil65/Searchly"
|
|
50
|
+
Documentation = "https://phil65.github.io/Searchly/"
|
|
51
|
+
Homepage = "https://phil65.github.io/Searchly/"
|
|
52
|
+
Issues = "https://github.com/phil65/Searchly/issues"
|
|
53
|
+
Source = "https://github.com/phil65/Searchly"
|
|
54
|
+
|
|
55
|
+
[project.optional-dependencies]
|
|
56
|
+
all = [
|
|
57
|
+
"brave-search-python-client",
|
|
58
|
+
"psutil",
|
|
59
|
+
"exa-py>=2.0.0",
|
|
60
|
+
]
|
|
61
|
+
brave_search_python_client = [
|
|
62
|
+
"brave-search-python-client",
|
|
63
|
+
"psutil",
|
|
64
|
+
]
|
|
65
|
+
exa = ["exa-py>=2.0.0"]
|
|
66
|
+
|
|
67
|
+
[dependency-groups]
|
|
68
|
+
dev = [
|
|
69
|
+
"deptry",
|
|
70
|
+
"devtools",
|
|
71
|
+
"pyreadline3",
|
|
72
|
+
"pytest",
|
|
73
|
+
"pytest-asyncio",
|
|
74
|
+
"pytest-cov",
|
|
75
|
+
]
|
|
76
|
+
benchmark = ["pyinstrument"]
|
|
77
|
+
docs = [
|
|
78
|
+
"mkdocs-mknodes>=2.1.0",
|
|
79
|
+
"mkdocstrings[python]",
|
|
80
|
+
]
|
|
81
|
+
lint = [
|
|
82
|
+
"ruff==0.17.6",
|
|
83
|
+
"ty==0.0.107",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[build-system]
|
|
87
|
+
requires = ["uv_build>=0.8.22"]
|
|
88
|
+
build-backend = "uv_build"
|
|
89
|
+
|
|
90
|
+
[tool.coverage.report]
|
|
91
|
+
exclude_lines = [
|
|
92
|
+
"pragma: no cover",
|
|
93
|
+
"if TYPE_CHECKING:",
|
|
94
|
+
"@overload",
|
|
95
|
+
"except ImportError",
|
|
96
|
+
'if __name__ == "__main__":',
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
[tool.mknodes]
|
|
100
|
+
allowed-commit-types = [
|
|
101
|
+
"fix",
|
|
102
|
+
"feat",
|
|
103
|
+
"refactor",
|
|
104
|
+
"docs",
|
|
105
|
+
"test",
|
|
106
|
+
"build",
|
|
107
|
+
"chore",
|
|
108
|
+
]
|
|
109
|
+
docstring-style = "google"
|
|
110
|
+
|
|
111
|
+
[tool.pyright]
|
|
112
|
+
venvPath = "."
|
|
113
|
+
venv = ".venv"
|
|
114
|
+
pythonVersion = "3.13"
|
|
115
|
+
pythonPlatform = "All"
|
|
116
|
+
typeCheckingMode = "basic"
|
|
117
|
+
deprecateTypingAliases = true
|
|
118
|
+
reportMissingTypeStubs = false
|
|
119
|
+
reportUnusedCallResult = false
|
|
120
|
+
reportUnknownVariableType = false
|
|
121
|
+
reportAny = false
|
|
122
|
+
reportImplicitOverride = false
|
|
123
|
+
reportUnusedFunction = false
|
|
124
|
+
reportImplicitStringConcatenation = false
|
|
125
|
+
reportIgnoreCommentWithoutRule = false
|
|
126
|
+
reportUnannotatedClassAttribute = false
|
|
127
|
+
reportSelfClsParameterName = false
|
|
128
|
+
reportPrivateImportUsage = false
|
|
129
|
+
|
|
130
|
+
[tool.pytest]
|
|
131
|
+
addopts = [
|
|
132
|
+
"-m",
|
|
133
|
+
"not integration",
|
|
134
|
+
]
|
|
135
|
+
log_cli = true
|
|
136
|
+
log_date_format = "%Y-%m-%d %H:%M:%S"
|
|
137
|
+
log_format = "%(asctime)s %(levelname)s %(message)s"
|
|
138
|
+
markers = ["integration: mark test as integration test (skipped by default)"]
|
|
139
|
+
minversion = "9.0"
|
|
140
|
+
testpaths = ["tests/"]
|
|
141
|
+
asyncio_mode = "auto"
|
|
142
|
+
|
|
143
|
+
[tool.ruff]
|
|
144
|
+
line-length = 100
|
|
145
|
+
extend-exclude = ["docs"]
|
|
146
|
+
target-version = "py313"
|
|
147
|
+
|
|
148
|
+
[tool.ruff.lint]
|
|
149
|
+
future-annotations = true
|
|
150
|
+
select = [
|
|
151
|
+
"A",
|
|
152
|
+
"B",
|
|
153
|
+
"BLE",
|
|
154
|
+
"C",
|
|
155
|
+
"C4",
|
|
156
|
+
"COM",
|
|
157
|
+
"D",
|
|
158
|
+
"E",
|
|
159
|
+
"EM",
|
|
160
|
+
"EXE",
|
|
161
|
+
"F",
|
|
162
|
+
"FA",
|
|
163
|
+
"FLY",
|
|
164
|
+
"G",
|
|
165
|
+
"I",
|
|
166
|
+
"ICN",
|
|
167
|
+
"INP",
|
|
168
|
+
"INT",
|
|
169
|
+
"ISC",
|
|
170
|
+
"N",
|
|
171
|
+
"PERF",
|
|
172
|
+
"PIE",
|
|
173
|
+
"PLE",
|
|
174
|
+
"PLC",
|
|
175
|
+
"PLR",
|
|
176
|
+
"PT",
|
|
177
|
+
"PTH",
|
|
178
|
+
"PYI",
|
|
179
|
+
"Q",
|
|
180
|
+
"RET",
|
|
181
|
+
"RSE",
|
|
182
|
+
"RUF",
|
|
183
|
+
"SIM",
|
|
184
|
+
"SLF",
|
|
185
|
+
"SLOT",
|
|
186
|
+
"T10",
|
|
187
|
+
"TC",
|
|
188
|
+
"TID",
|
|
189
|
+
"TRY",
|
|
190
|
+
"UP",
|
|
191
|
+
"W",
|
|
192
|
+
"YTT",
|
|
193
|
+
]
|
|
194
|
+
ignore = [
|
|
195
|
+
"C408",
|
|
196
|
+
"B905",
|
|
197
|
+
"C901",
|
|
198
|
+
"COM812",
|
|
199
|
+
"D100",
|
|
200
|
+
"D101",
|
|
201
|
+
"D102",
|
|
202
|
+
"D103",
|
|
203
|
+
"D104",
|
|
204
|
+
"D105",
|
|
205
|
+
"D106",
|
|
206
|
+
"D107",
|
|
207
|
+
"D203",
|
|
208
|
+
"D204",
|
|
209
|
+
"D213",
|
|
210
|
+
"D215",
|
|
211
|
+
"D400",
|
|
212
|
+
"D401",
|
|
213
|
+
"D404",
|
|
214
|
+
"D406",
|
|
215
|
+
"D407",
|
|
216
|
+
"D408",
|
|
217
|
+
"D409",
|
|
218
|
+
"D413",
|
|
219
|
+
"EM101",
|
|
220
|
+
"EM102",
|
|
221
|
+
"ISC001",
|
|
222
|
+
"PLC0415",
|
|
223
|
+
"PLR0912",
|
|
224
|
+
"PLR0913",
|
|
225
|
+
"PLR0915",
|
|
226
|
+
"PLR0917",
|
|
227
|
+
"SLF001",
|
|
228
|
+
"TRY003",
|
|
229
|
+
"TC006",
|
|
230
|
+
]
|
|
231
|
+
|
|
232
|
+
[tool.ruff.lint.flake8-quotes]
|
|
233
|
+
docstring-quotes = "double"
|
|
234
|
+
|
|
235
|
+
[tool.ruff.lint.flake8-type-checking]
|
|
236
|
+
runtime-evaluated-base-classes = [
|
|
237
|
+
"pydantic.BaseModel",
|
|
238
|
+
"sqlalchemy.orm.DeclarativeBase",
|
|
239
|
+
"schemez.Schema",
|
|
240
|
+
"sqlmodel.SQLModel",
|
|
241
|
+
]
|
|
242
|
+
runtime-evaluated-decorators = [
|
|
243
|
+
"pydantic.validate_call",
|
|
244
|
+
"fastapi.FastAPI.get",
|
|
245
|
+
"fastapi.FastAPI.post",
|
|
246
|
+
"fastmcp.FastMCP.tool",
|
|
247
|
+
"typer.Typer.command",
|
|
248
|
+
]
|
|
249
|
+
|
|
250
|
+
[tool.ruff.lint.isort]
|
|
251
|
+
lines-after-imports = 2
|
|
252
|
+
force-sort-within-sections = true
|
|
253
|
+
combine-as-imports = true
|
|
254
|
+
|
|
255
|
+
[tool.ruff.lint.mccabe]
|
|
256
|
+
max-complexity = 15
|
|
257
|
+
|
|
258
|
+
[tool.ruff.lint.per-file-ignores]
|
|
259
|
+
"__init__.py" = [
|
|
260
|
+
"E402",
|
|
261
|
+
"I001",
|
|
262
|
+
]
|
|
263
|
+
"scripts/*" = ["INP001"]
|
|
264
|
+
"*tests/*" = ["D100"]
|
|
265
|
+
|
|
266
|
+
[tool.ruff.format]
|
|
267
|
+
preview = true
|
|
268
|
+
|
|
269
|
+
[tool.ty.environment]
|
|
270
|
+
python-version = "3.13"
|
|
271
|
+
python-platform = "all"
|
|
272
|
+
|
|
273
|
+
[tool.ty.src]
|
|
274
|
+
include = ["src"]
|
|
275
|
+
|
|
276
|
+
[tool.ty.analysis]
|
|
277
|
+
allowed-unresolved-imports = []
|
|
278
|
+
|
|
279
|
+
[tool.ty.rules]
|
|
280
|
+
incompatible-mutable-override = "ignore"
|
|
281
|
+
|
|
282
|
+
[tool.uv]
|
|
283
|
+
default-groups = [
|
|
284
|
+
"dev",
|
|
285
|
+
"lint",
|
|
286
|
+
"docs",
|
|
287
|
+
]
|
|
288
|
+
|
|
289
|
+
[tool.uv.build-backend]
|
|
290
|
+
module-name = [
|
|
291
|
+
"searchly",
|
|
292
|
+
"searchly_config",
|
|
293
|
+
]
|
|
294
|
+
wheel-exclude = [
|
|
295
|
+
".mypy_cache/**",
|
|
296
|
+
"__pycache__/**",
|
|
297
|
+
"*.pyc",
|
|
298
|
+
"*.pyo",
|
|
299
|
+
".pytest_cache/**",
|
|
300
|
+
".ruff_cache/**",
|
|
301
|
+
]
|
|
302
|
+
source-exclude = [
|
|
303
|
+
".mypy_cache/**",
|
|
304
|
+
"__pycache__/**",
|
|
305
|
+
"*.pyc",
|
|
306
|
+
"*.pyo",
|
|
307
|
+
".pytest_cache/**",
|
|
308
|
+
".ruff_cache/**",
|
|
309
|
+
]
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
#:tombi schema.strict = false
|
|
2
|
+
|
|
1
3
|
[project]
|
|
2
4
|
name = "searchly"
|
|
3
|
-
version = "2.0
|
|
4
|
-
description = "
|
|
5
|
+
version = "2.2.0"
|
|
6
|
+
description = "Unified async clients for web and news search APIs, built for AI agents"
|
|
5
7
|
readme = "README.md"
|
|
6
8
|
requires-python = ">=3.13"
|
|
7
9
|
license = "MIT"
|
|
@@ -9,7 +11,19 @@ license-files = ["LICENSE"]
|
|
|
9
11
|
authors = [
|
|
10
12
|
{ name = "Philipp Temminghoff", email = "philipptemminghoff@googlemail.com" },
|
|
11
13
|
]
|
|
12
|
-
keywords = [
|
|
14
|
+
keywords = [
|
|
15
|
+
"agents",
|
|
16
|
+
"ai",
|
|
17
|
+
"async",
|
|
18
|
+
"brave",
|
|
19
|
+
"exa",
|
|
20
|
+
"llm",
|
|
21
|
+
"news-search",
|
|
22
|
+
"search",
|
|
23
|
+
"serper",
|
|
24
|
+
"tavily",
|
|
25
|
+
"web-search",
|
|
26
|
+
]
|
|
13
27
|
classifiers = [
|
|
14
28
|
"Development Status :: 4 - Beta",
|
|
15
29
|
"Framework :: Pydantic",
|
|
@@ -18,36 +32,37 @@ classifiers = [
|
|
|
18
32
|
"Operating System :: OS Independent",
|
|
19
33
|
"Programming Language :: Python :: 3",
|
|
20
34
|
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
-
"Programming Language :: Python :: 3.12",
|
|
22
35
|
"Programming Language :: Python :: 3.13",
|
|
23
36
|
"Programming Language :: Python :: 3.14",
|
|
24
|
-
"Topic ::
|
|
25
|
-
"Topic ::
|
|
26
|
-
"Topic ::
|
|
37
|
+
"Topic :: Internet :: WWW/HTTP :: Indexing/Search",
|
|
38
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
39
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
40
|
"Typing :: Typed",
|
|
28
41
|
]
|
|
29
42
|
dependencies = [
|
|
30
|
-
"anyenv[
|
|
43
|
+
"anyenv[httpx2]>=2.1.0",
|
|
31
44
|
"pydantic",
|
|
45
|
+
|
|
32
46
|
# Only add below (Copier)
|
|
47
|
+
"httpx2>=2.16",
|
|
33
48
|
"schemez>=2.1.5",
|
|
34
|
-
"universal-pathlib>=0.2.6",
|
|
35
49
|
]
|
|
36
50
|
|
|
37
51
|
[project.urls]
|
|
38
|
-
"Code coverage" = "https://app.codecov.io/gh/phil65/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Issues = "https://github.com/phil65/
|
|
42
|
-
Source = "https://github.com/phil65/
|
|
52
|
+
"Code coverage" = "https://app.codecov.io/gh/phil65/Searchly"
|
|
53
|
+
Documentation = "https://phil65.github.io/Searchly/"
|
|
54
|
+
Homepage = "https://phil65.github.io/Searchly/"
|
|
55
|
+
Issues = "https://github.com/phil65/Searchly/issues"
|
|
56
|
+
Source = "https://github.com/phil65/Searchly"
|
|
43
57
|
|
|
44
58
|
[project.optional-dependencies]
|
|
45
|
-
all = ["brave-search-python-client", "psutil", "exa-py"]
|
|
59
|
+
all = ["brave-search-python-client", "psutil", "exa-py>=2.0.0"]
|
|
46
60
|
brave_search_python_client = ["brave-search-python-client", "psutil"]
|
|
47
|
-
exa = ["exa-py"]
|
|
61
|
+
exa = ["exa-py>=2.0.0"]
|
|
48
62
|
|
|
49
63
|
[dependency-groups]
|
|
50
64
|
dev = [
|
|
65
|
+
"deptry",
|
|
51
66
|
"devtools",
|
|
52
67
|
"pyreadline3",
|
|
53
68
|
"pytest",
|
|
@@ -57,14 +72,15 @@ dev = [
|
|
|
57
72
|
]
|
|
58
73
|
benchmark = ["pyinstrument"]
|
|
59
74
|
docs = [
|
|
60
|
-
"mkdocs-
|
|
61
|
-
"
|
|
75
|
+
"mkdocs-mknodes>=2.1.0",
|
|
76
|
+
"mkdocstrings[python]",
|
|
62
77
|
# Only add below (Copier)
|
|
63
78
|
]
|
|
64
79
|
lint = [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"ruff",
|
|
80
|
+
# Pinned on purpose: CI, pre-commit and editors all run exactly these versions.
|
|
81
|
+
# Bump them here (template) and roll out via `copier update`.
|
|
82
|
+
"ruff==0.17.6",
|
|
83
|
+
"ty==0.0.107",
|
|
68
84
|
# Only add below (Copier)
|
|
69
85
|
]
|
|
70
86
|
|
|
@@ -93,14 +109,6 @@ allowed-commit-types = [
|
|
|
93
109
|
]
|
|
94
110
|
docstring-style = "google"
|
|
95
111
|
|
|
96
|
-
[tool.mypy]
|
|
97
|
-
python_version = "3.13"
|
|
98
|
-
pretty = true
|
|
99
|
-
strict = true
|
|
100
|
-
check_untyped_defs = true
|
|
101
|
-
exclude = ["venv/", ".venv/", "tests/"]
|
|
102
|
-
plugins = ["pydantic.mypy"]
|
|
103
|
-
|
|
104
112
|
[tool.pyright]
|
|
105
113
|
venvPath = "."
|
|
106
114
|
venv = ".venv"
|
|
@@ -120,16 +128,17 @@ reportUnannotatedClassAttribute = false
|
|
|
120
128
|
reportSelfClsParameterName = false
|
|
121
129
|
reportPrivateImportUsage = false
|
|
122
130
|
|
|
123
|
-
[tool.pytest
|
|
131
|
+
[tool.pytest]
|
|
132
|
+
addopts = ["-m", "not integration"]
|
|
124
133
|
log_cli = true
|
|
125
134
|
log_date_format = "%Y-%m-%d %H:%M:%S"
|
|
126
135
|
log_format = "%(asctime)s %(levelname)s %(message)s"
|
|
127
|
-
testpaths = "tests/"
|
|
128
|
-
asyncio_mode = "auto"
|
|
129
|
-
addopts = "-m 'not integration'"
|
|
130
136
|
markers = [
|
|
131
137
|
"integration: mark test as integration test (skipped by default)",
|
|
132
138
|
]
|
|
139
|
+
minversion = "9.0"
|
|
140
|
+
testpaths = ["tests/"]
|
|
141
|
+
asyncio_mode = "auto"
|
|
133
142
|
|
|
134
143
|
[tool.ruff]
|
|
135
144
|
line-length = 100
|
|
@@ -225,11 +234,14 @@ ignore = [
|
|
|
225
234
|
"D408", # Section underline should be in the line following the section's name ("{name}")
|
|
226
235
|
"D409", # Section underline should match the length of its name ("{name}")
|
|
227
236
|
"D413", # Missing blank line after last section ("{name}")
|
|
237
|
+
"EM101", # Exception must not use a string literal, assign to variable first
|
|
238
|
+
"EM102", # Exception must not use an f-string literal, assign to variable first
|
|
228
239
|
"ISC001",
|
|
229
240
|
"PLC0415",
|
|
230
241
|
"PLR0912", # Too many branches
|
|
231
242
|
"PLR0913", # Too many arguments to function call
|
|
232
243
|
"PLR0915", # Too many statements
|
|
244
|
+
"PLR0917", # Too many positional arguments
|
|
233
245
|
# "PLR2004", # Magic values instead of named consts
|
|
234
246
|
"SLF001", # Private member accessed
|
|
235
247
|
"TRY003", # Avoid specifying long messages outside the exception class
|
|
@@ -261,6 +273,9 @@ lines-after-imports = 2
|
|
|
261
273
|
force-sort-within-sections = true
|
|
262
274
|
combine-as-imports = true
|
|
263
275
|
|
|
276
|
+
[tool.ruff.lint.mccabe]
|
|
277
|
+
max-complexity = 15
|
|
278
|
+
|
|
264
279
|
[tool.ruff.lint.per-file-ignores]
|
|
265
280
|
"__init__.py" = ["E402", "I001"]
|
|
266
281
|
"scripts/*" = ["INP001"]
|
|
@@ -273,5 +288,41 @@ preview = true
|
|
|
273
288
|
python-version = "3.13"
|
|
274
289
|
python-platform = "all"
|
|
275
290
|
|
|
291
|
+
[tool.ty.src]
|
|
292
|
+
# `ty check` (hooks, CI, editors) type-checks the package code only.
|
|
293
|
+
include = ["src"]
|
|
294
|
+
|
|
295
|
+
[tool.ty.analysis]
|
|
296
|
+
# Optional dependencies that are not always installed, e.g. "numpy", "numpy.**".
|
|
297
|
+
# Unresolved imports are errors otherwise, so broken imports are caught.
|
|
298
|
+
allowed-unresolved-imports = []
|
|
299
|
+
|
|
300
|
+
[tool.ty.rules]
|
|
301
|
+
# Narrowing an overridden class attribute (e.g. pydantic discriminators,
|
|
302
|
+
# `Config` attributes) is an intentional pattern.
|
|
303
|
+
incompatible-mutable-override = "ignore"
|
|
304
|
+
|
|
276
305
|
[tool.uv]
|
|
277
306
|
default-groups = ["dev", "lint", "docs"]
|
|
307
|
+
|
|
308
|
+
[tool.uv.build-backend]
|
|
309
|
+
module-name = [
|
|
310
|
+
"searchly",
|
|
311
|
+
"searchly_config",
|
|
312
|
+
]
|
|
313
|
+
wheel-exclude = [
|
|
314
|
+
".mypy_cache/**",
|
|
315
|
+
"__pycache__/**",
|
|
316
|
+
"*.pyc",
|
|
317
|
+
"*.pyo",
|
|
318
|
+
".pytest_cache/**",
|
|
319
|
+
".ruff_cache/**",
|
|
320
|
+
]
|
|
321
|
+
source-exclude = [
|
|
322
|
+
".mypy_cache/**",
|
|
323
|
+
"__pycache__/**",
|
|
324
|
+
"*.pyc",
|
|
325
|
+
"*.pyo",
|
|
326
|
+
".pytest_cache/**",
|
|
327
|
+
".ruff_cache/**",
|
|
328
|
+
]
|
|
@@ -6,8 +6,8 @@ import os
|
|
|
6
6
|
from typing import Any, cast
|
|
7
7
|
|
|
8
8
|
from searchly.base import (
|
|
9
|
-
CountryCode,
|
|
10
|
-
LanguageCode,
|
|
9
|
+
CountryCode,
|
|
10
|
+
LanguageCode,
|
|
11
11
|
NewsSearchProvider,
|
|
12
12
|
NewsSearchResponse,
|
|
13
13
|
NewsSearchResult,
|
|
@@ -34,7 +34,7 @@ class AsyncBraveSearch(WebSearchProvider, NewsSearchProvider):
|
|
|
34
34
|
retries: Number of retries for failed requests.
|
|
35
35
|
wait_time: Time to wait between retries in seconds.
|
|
36
36
|
"""
|
|
37
|
-
import brave_search_python_client as brave
|
|
37
|
+
import brave_search_python_client as brave
|
|
38
38
|
|
|
39
39
|
self.api_key = api_key or os.getenv("BRAVE_API_KEY")
|
|
40
40
|
if not self.api_key:
|
|
@@ -3,17 +3,21 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from typing import Any, Literal
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Literal, cast
|
|
7
7
|
|
|
8
8
|
from searchly.base import (
|
|
9
|
-
CountryCode,
|
|
10
|
-
LanguageCode,
|
|
9
|
+
CountryCode,
|
|
10
|
+
LanguageCode,
|
|
11
11
|
WebSearchProvider,
|
|
12
12
|
WebSearchResponse,
|
|
13
13
|
WebSearchResult,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from exa_py.api import Category, ContentsOptions
|
|
19
|
+
|
|
20
|
+
|
|
17
21
|
class AsyncExaClient(WebSearchProvider):
|
|
18
22
|
"""Async client for Exa API.
|
|
19
23
|
|
|
@@ -81,17 +85,20 @@ class AsyncExaClient(WebSearchProvider):
|
|
|
81
85
|
if max_characters is not None:
|
|
82
86
|
text_opts = {"max_characters": max_characters}
|
|
83
87
|
|
|
84
|
-
|
|
88
|
+
contents: dict[str, Any] = {"text": text_opts}
|
|
89
|
+
if summary:
|
|
90
|
+
contents["summary"] = summary
|
|
91
|
+
|
|
92
|
+
response = await self.client.search(
|
|
85
93
|
query=query,
|
|
86
|
-
|
|
87
|
-
summary=summary,
|
|
94
|
+
contents=cast("ContentsOptions", contents),
|
|
88
95
|
num_results=max_results,
|
|
89
96
|
include_domains=include_domains,
|
|
90
97
|
exclude_domains=exclude_domains,
|
|
91
98
|
start_published_date=start_published_date,
|
|
92
99
|
end_published_date=end_published_date,
|
|
93
100
|
type=search_type,
|
|
94
|
-
category=category,
|
|
101
|
+
category=cast("Category | None", category),
|
|
95
102
|
**kwargs,
|
|
96
103
|
)
|
|
97
104
|
|
|
@@ -8,8 +8,8 @@ from typing import Any, Literal
|
|
|
8
8
|
import anyenv
|
|
9
9
|
|
|
10
10
|
from searchly.base import (
|
|
11
|
-
CountryCode,
|
|
12
|
-
LanguageCode,
|
|
11
|
+
CountryCode,
|
|
12
|
+
LanguageCode,
|
|
13
13
|
WebSearchProvider,
|
|
14
14
|
WebSearchResponse,
|
|
15
15
|
WebSearchResult,
|
|
@@ -142,7 +142,7 @@ class AsyncKagiClient(WebSearchProvider):
|
|
|
142
142
|
data = await anyenv.get_json(
|
|
143
143
|
endpoint, params=params, headers=self.headers, return_type=dict
|
|
144
144
|
)
|
|
145
|
-
return data.get("data", {}).get("output", "")
|
|
145
|
+
return data.get("data", {}).get("output", "")
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
async def example() -> None:
|
|
@@ -8,11 +8,11 @@ import os
|
|
|
8
8
|
from typing import Any, Literal
|
|
9
9
|
|
|
10
10
|
import anyenv
|
|
11
|
-
import
|
|
11
|
+
import httpx2
|
|
12
12
|
|
|
13
13
|
from searchly.base import (
|
|
14
|
-
CountryCode,
|
|
15
|
-
LanguageCode,
|
|
14
|
+
CountryCode,
|
|
15
|
+
LanguageCode,
|
|
16
16
|
NewsSearchProvider,
|
|
17
17
|
NewsSearchResponse,
|
|
18
18
|
NewsSearchResult,
|
|
@@ -49,8 +49,10 @@ class AsyncTavilyClient(WebSearchProvider, NewsSearchProvider):
|
|
|
49
49
|
self.base_url = "https://api.tavily.com"
|
|
50
50
|
self.timeout = 180
|
|
51
51
|
|
|
52
|
-
def _client_creator(self) ->
|
|
53
|
-
return
|
|
52
|
+
def _client_creator(self) -> httpx2.AsyncClient:
|
|
53
|
+
return httpx2.AsyncClient(
|
|
54
|
+
headers=self.headers, base_url=self.base_url, timeout=self.timeout
|
|
55
|
+
)
|
|
54
56
|
|
|
55
57
|
async def _search(
|
|
56
58
|
self,
|
|
@@ -83,7 +85,7 @@ class AsyncTavilyClient(WebSearchProvider, NewsSearchProvider):
|
|
|
83
85
|
response = await client.post("/search", content=anyenv.dump_json(data))
|
|
84
86
|
|
|
85
87
|
if response.status_code == 200: # noqa: PLR2004
|
|
86
|
-
return response.json()
|
|
88
|
+
return response.json()
|
|
87
89
|
if response.status_code == 429: # noqa: PLR2004
|
|
88
90
|
detail = "Too many requests."
|
|
89
91
|
with contextlib.suppress(Exception):
|
|
@@ -92,7 +94,7 @@ class AsyncTavilyClient(WebSearchProvider, NewsSearchProvider):
|
|
|
92
94
|
if response.status_code == 401: # noqa: PLR2004
|
|
93
95
|
raise InvalidAPIKeyError
|
|
94
96
|
response.raise_for_status()
|
|
95
|
-
return response.json()
|
|
97
|
+
return response.json()
|
|
96
98
|
|
|
97
99
|
async def web_search(
|
|
98
100
|
self,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Search provider configuration.
|
|
2
|
+
|
|
3
|
+
This is a lightweight config-only package for fast imports.
|
|
4
|
+
For the actual search providers, use `from searchly import ...`.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from searchly_config.configs import (
|
|
10
|
+
BaseSearchProviderConfig,
|
|
11
|
+
BraveSearchConfig,
|
|
12
|
+
DataForSEOConfig,
|
|
13
|
+
ExaConfig,
|
|
14
|
+
JigsawStackConfig,
|
|
15
|
+
KagiConfig,
|
|
16
|
+
LinkUpConfig,
|
|
17
|
+
NewsSearchProviderConfig,
|
|
18
|
+
NewsSearchProviderName,
|
|
19
|
+
Search1Config,
|
|
20
|
+
SerpAPIConfig,
|
|
21
|
+
SerperConfig,
|
|
22
|
+
TavilyConfig,
|
|
23
|
+
WebSearchProviderConfig,
|
|
24
|
+
WebSearchProviderName,
|
|
25
|
+
YouConfig,
|
|
26
|
+
get_config_class,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"BaseSearchProviderConfig",
|
|
32
|
+
"BraveSearchConfig",
|
|
33
|
+
"DataForSEOConfig",
|
|
34
|
+
"ExaConfig",
|
|
35
|
+
"JigsawStackConfig",
|
|
36
|
+
"KagiConfig",
|
|
37
|
+
"LinkUpConfig",
|
|
38
|
+
"NewsSearchProviderConfig",
|
|
39
|
+
"NewsSearchProviderName",
|
|
40
|
+
"Search1Config",
|
|
41
|
+
"SerpAPIConfig",
|
|
42
|
+
"SerperConfig",
|
|
43
|
+
"TavilyConfig",
|
|
44
|
+
"WebSearchProviderConfig",
|
|
45
|
+
"WebSearchProviderName",
|
|
46
|
+
"YouConfig",
|
|
47
|
+
"get_config_class",
|
|
48
|
+
]
|
|
@@ -56,10 +56,10 @@ class BaseSearchProviderConfig(Schema):
|
|
|
56
56
|
raise NotImplementedError
|
|
57
57
|
|
|
58
58
|
def get_provider(self) -> WebSearchProvider | NewsSearchProvider:
|
|
59
|
-
"""
|
|
59
|
+
"""Create the provider instance.
|
|
60
60
|
|
|
61
61
|
Returns:
|
|
62
|
-
|
|
62
|
+
The configured provider instance.
|
|
63
63
|
"""
|
|
64
64
|
raise NotImplementedError
|
|
65
65
|
|
|
File without changes
|
searchly-2.0.5/PKG-INFO
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: searchly
|
|
3
|
-
Version: 2.0.5
|
|
4
|
-
Summary: Search tools for agents
|
|
5
|
-
Keywords:
|
|
6
|
-
Author: Philipp Temminghoff
|
|
7
|
-
Author-email: Philipp Temminghoff <philipptemminghoff@googlemail.com>
|
|
8
|
-
License-Expression: MIT
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: Framework :: Pydantic
|
|
12
|
-
Classifier: Framework :: Pydantic :: 2
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: Operating System :: OS Independent
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
-
Classifier: Topic :: Documentation
|
|
21
|
-
Classifier: Topic :: Software Development
|
|
22
|
-
Classifier: Topic :: Utilities
|
|
23
|
-
Classifier: Typing :: Typed
|
|
24
|
-
Requires-Dist: anyenv[httpx]>=0.4.4
|
|
25
|
-
Requires-Dist: pydantic
|
|
26
|
-
Requires-Dist: schemez>=2.1.5
|
|
27
|
-
Requires-Dist: universal-pathlib>=0.2.6
|
|
28
|
-
Requires-Dist: brave-search-python-client ; extra == 'all'
|
|
29
|
-
Requires-Dist: psutil ; extra == 'all'
|
|
30
|
-
Requires-Dist: exa-py ; extra == 'all'
|
|
31
|
-
Requires-Dist: brave-search-python-client ; extra == 'brave-search-python-client'
|
|
32
|
-
Requires-Dist: psutil ; extra == 'brave-search-python-client'
|
|
33
|
-
Requires-Dist: exa-py ; extra == 'exa'
|
|
34
|
-
Requires-Python: >=3.13
|
|
35
|
-
Project-URL: Code coverage, https://app.codecov.io/gh/phil65/searchly
|
|
36
|
-
Project-URL: Discussions, https://github.com/phil65/searchly/discussions
|
|
37
|
-
Project-URL: Documentation, https://phil65.github.io/searchly/
|
|
38
|
-
Project-URL: Issues, https://github.com/phil65/searchly/issues
|
|
39
|
-
Project-URL: Source, https://github.com/phil65/searchly
|
|
40
|
-
Provides-Extra: all
|
|
41
|
-
Provides-Extra: brave-search-python-client
|
|
42
|
-
Provides-Extra: exa
|
|
43
|
-
Description-Content-Type: text/markdown
|
|
44
|
-
|
|
45
|
-
# Searchly
|
|
46
|
-
|
|
47
|
-
[](https://pypi.org/project/searchly/)
|
|
48
|
-
[](https://pypi.org/project/searchly/)
|
|
49
|
-
[](https://pypi.org/project/searchly/)
|
|
50
|
-
[](https://pypi.org/project/searchly/)
|
|
51
|
-
[](https://pypi.org/project/searchly/)
|
|
52
|
-
[](https://pypi.org/project/searchly/)
|
|
53
|
-
[](https://pypi.org/project/searchly/)
|
|
54
|
-
[](https://github.com/phil65/searchly/releases)
|
|
55
|
-
[](https://github.com/phil65/searchly/graphs/contributors)
|
|
56
|
-
[](https://github.com/phil65/searchly/discussions)
|
|
57
|
-
[](https://github.com/phil65/searchly/forks)
|
|
58
|
-
[](https://github.com/phil65/searchly/issues)
|
|
59
|
-
[](https://github.com/phil65/searchly/pulls)
|
|
60
|
-
[](https://github.com/phil65/searchly/watchers)
|
|
61
|
-
[](https://github.com/phil65/searchly/stars)
|
|
62
|
-
[](https://github.com/phil65/searchly)
|
|
63
|
-
[](https://github.com/phil65/searchly/commits)
|
|
64
|
-
[](https://github.com/phil65/searchly/releases)
|
|
65
|
-
[](https://github.com/phil65/searchly)
|
|
66
|
-
[](https://github.com/phil65/searchly)
|
|
67
|
-
[](https://codecov.io/gh/phil65/searchly/)
|
|
68
|
-
[](https://pyup.io/repos/github/phil65/searchly/)
|
|
69
|
-
|
|
70
|
-
[Read the documentation!](https://phil65.github.io/searchly/)
|
searchly-2.0.5/README.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Searchly
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/searchly/)
|
|
4
|
-
[](https://pypi.org/project/searchly/)
|
|
5
|
-
[](https://pypi.org/project/searchly/)
|
|
6
|
-
[](https://pypi.org/project/searchly/)
|
|
7
|
-
[](https://pypi.org/project/searchly/)
|
|
8
|
-
[](https://pypi.org/project/searchly/)
|
|
9
|
-
[](https://pypi.org/project/searchly/)
|
|
10
|
-
[](https://github.com/phil65/searchly/releases)
|
|
11
|
-
[](https://github.com/phil65/searchly/graphs/contributors)
|
|
12
|
-
[](https://github.com/phil65/searchly/discussions)
|
|
13
|
-
[](https://github.com/phil65/searchly/forks)
|
|
14
|
-
[](https://github.com/phil65/searchly/issues)
|
|
15
|
-
[](https://github.com/phil65/searchly/pulls)
|
|
16
|
-
[](https://github.com/phil65/searchly/watchers)
|
|
17
|
-
[](https://github.com/phil65/searchly/stars)
|
|
18
|
-
[](https://github.com/phil65/searchly)
|
|
19
|
-
[](https://github.com/phil65/searchly/commits)
|
|
20
|
-
[](https://github.com/phil65/searchly/releases)
|
|
21
|
-
[](https://github.com/phil65/searchly)
|
|
22
|
-
[](https://github.com/phil65/searchly)
|
|
23
|
-
[](https://codecov.io/gh/phil65/searchly/)
|
|
24
|
-
[](https://pyup.io/repos/github/phil65/searchly/)
|
|
25
|
-
|
|
26
|
-
[Read the documentation!](https://phil65.github.io/searchly/)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|