docseek 0.1.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.
- docseek-0.1.0/.dockerignore +8 -0
- docseek-0.1.0/.github/workflows/publish.yml +39 -0
- docseek-0.1.0/.github/workflows/tests.yml +18 -0
- docseek-0.1.0/.gitignore +22 -0
- docseek-0.1.0/Dockerfile +39 -0
- docseek-0.1.0/LICENSE +202 -0
- docseek-0.1.0/PKG-INFO +231 -0
- docseek-0.1.0/README.md +204 -0
- docseek-0.1.0/docker-compose.yml +22 -0
- docseek-0.1.0/docseek/__init__.py +19 -0
- docseek-0.1.0/docseek/__main__.py +143 -0
- docseek-0.1.0/docseek/agent.py +1980 -0
- docseek-0.1.0/docseek/api_mining.py +180 -0
- docseek-0.1.0/docseek/codegen/__init__.py +8 -0
- docseek-0.1.0/docseek/codegen/explorer.py +326 -0
- docseek-0.1.0/docseek/codegen/fetcher.py +217 -0
- docseek-0.1.0/docseek/codegen/programs.py +231 -0
- docseek-0.1.0/docseek/codegen/sandbox.py +165 -0
- docseek-0.1.0/docseek/document_probe.py +116 -0
- docseek-0.1.0/docseek/frontier.py +152 -0
- docseek-0.1.0/docseek/jev.py +239 -0
- docseek-0.1.0/docseek/jev_crawl.py +1116 -0
- docseek-0.1.0/docseek/json_mining.py +117 -0
- docseek-0.1.0/docseek/judge.py +299 -0
- docseek-0.1.0/docseek/learn.py +98 -0
- docseek-0.1.0/docseek/llm.py +291 -0
- docseek-0.1.0/docseek/models.py +116 -0
- docseek-0.1.0/docseek/patterns.py +127 -0
- docseek-0.1.0/docseek/profile.py +57 -0
- docseek-0.1.0/docseek/profiles/fund-reports.json +15 -0
- docseek-0.1.0/docseek/profiles/generic.json +15 -0
- docseek-0.1.0/docseek/query.py +9 -0
- docseek-0.1.0/docseek/reach.py +177 -0
- docseek-0.1.0/docseek/recipes.py +180 -0
- docseek-0.1.0/docseek/scraper.py +1117 -0
- docseek-0.1.0/docseek/server.py +506 -0
- docseek-0.1.0/eval/__init__.py +0 -0
- docseek-0.1.0/eval/frontier_replay.py +148 -0
- docseek-0.1.0/eval/ground_truth/README.md +184 -0
- docseek-0.1.0/eval/ground_truth/__init__.py +0 -0
- docseek-0.1.0/eval/ground_truth/example.json +19 -0
- docseek-0.1.0/eval/judge_compare.py +95 -0
- docseek-0.1.0/eval/run_baseline.py +230 -0
- docseek-0.1.0/eval/run_codegen.py +100 -0
- docseek-0.1.0/eval/run_jev.py +243 -0
- docseek-0.1.0/pyproject.toml +49 -0
- docseek-0.1.0/tests/__init__.py +0 -0
- docseek-0.1.0/tests/conftest.py +14 -0
- docseek-0.1.0/tests/test_agent.py +481 -0
- docseek-0.1.0/tests/test_api_mining.py +24 -0
- docseek-0.1.0/tests/test_codegen_explorer.py +106 -0
- docseek-0.1.0/tests/test_codegen_programs.py +155 -0
- docseek-0.1.0/tests/test_codegen_sandbox.py +166 -0
- docseek-0.1.0/tests/test_codegen_server.py +118 -0
- docseek-0.1.0/tests/test_document_probe.py +66 -0
- docseek-0.1.0/tests/test_filter_reveal.py +125 -0
- docseek-0.1.0/tests/test_frontier.py +110 -0
- docseek-0.1.0/tests/test_harvest_layout.py +73 -0
- docseek-0.1.0/tests/test_improvements.py +270 -0
- docseek-0.1.0/tests/test_jev.py +819 -0
- docseek-0.1.0/tests/test_json_mining.py +50 -0
- docseek-0.1.0/tests/test_judge.py +197 -0
- docseek-0.1.0/tests/test_llm_chat.py +136 -0
- docseek-0.1.0/tests/test_load_more.py +52 -0
- docseek-0.1.0/tests/test_patterns.py +218 -0
- docseek-0.1.0/tests/test_reach.py +97 -0
- docseek-0.1.0/tests/test_recipes.py +66 -0
- docseek-0.1.0/tests/test_recipes_browser.py +42 -0
- docseek-0.1.0/tests/test_run_jev.py +67 -0
- docseek-0.1.0/tests/test_scraper_screenshot.py +156 -0
- docseek-0.1.0/tests/test_search_sites.py +458 -0
- docseek-0.1.0/uv.lock +716 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
# Publishing a GitHub release uploads that version to PyPI. Trusted publishing: PyPI trusts this workflow in this
|
|
4
|
+
# repository (configured once on pypi.org), so no API token is stored anywhere.
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: astral-sh/setup-uv@v6
|
|
15
|
+
- name: The tag matches the package version
|
|
16
|
+
run: |
|
|
17
|
+
version=$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)
|
|
18
|
+
test "v$version" = "${{ github.event.release.tag_name }}" || {
|
|
19
|
+
echo "tag ${{ github.event.release.tag_name }} does not match version $version in pyproject.toml"; exit 1; }
|
|
20
|
+
- run: uv build
|
|
21
|
+
- uses: actions/upload-artifact@v4
|
|
22
|
+
with:
|
|
23
|
+
name: dist
|
|
24
|
+
path: dist/
|
|
25
|
+
|
|
26
|
+
pypi:
|
|
27
|
+
needs: build
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
environment:
|
|
30
|
+
name: pypi
|
|
31
|
+
url: https://pypi.org/project/docseek/
|
|
32
|
+
permissions:
|
|
33
|
+
id-token: write
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/download-artifact@v4
|
|
36
|
+
with:
|
|
37
|
+
name: dist
|
|
38
|
+
path: dist/
|
|
39
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pytest:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: astral-sh/setup-uv@v6
|
|
14
|
+
- run: uv python install 3.12
|
|
15
|
+
- run: uv venv && uv pip install -e ".[dev]"
|
|
16
|
+
- run: uv run ruff check .
|
|
17
|
+
- run: uv run playwright install --with-deps chromium
|
|
18
|
+
- run: uv run pytest -q
|
docseek-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# secrets
|
|
2
|
+
.env
|
|
3
|
+
.env.*
|
|
4
|
+
|
|
5
|
+
# python
|
|
6
|
+
.venv/
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.pyc
|
|
9
|
+
.pytest_cache/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
|
|
14
|
+
# crawl output and local state
|
|
15
|
+
data/
|
|
16
|
+
eval/reports/
|
|
17
|
+
eval/snapshots/
|
|
18
|
+
eval/ground_truth/*.json
|
|
19
|
+
!eval/ground_truth/example.json
|
|
20
|
+
|
|
21
|
+
# generated programs from eval runs
|
|
22
|
+
eval/programs/
|
docseek-0.1.0/Dockerfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
6
|
+
libglib2.0-0 \
|
|
7
|
+
libnss3 \
|
|
8
|
+
libnspr4 \
|
|
9
|
+
libdbus-1-3 \
|
|
10
|
+
libatk1.0-0 \
|
|
11
|
+
libatk-bridge2.0-0 \
|
|
12
|
+
libatspi2.0-0 \
|
|
13
|
+
libx11-6 \
|
|
14
|
+
libxcomposite1 \
|
|
15
|
+
libxdamage1 \
|
|
16
|
+
libxext6 \
|
|
17
|
+
libxfixes3 \
|
|
18
|
+
libxrandr2 \
|
|
19
|
+
libgbm1 \
|
|
20
|
+
libcups2 \
|
|
21
|
+
libxkbcommon0 \
|
|
22
|
+
libpango-1.0-0 \
|
|
23
|
+
libcairo2 \
|
|
24
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
25
|
+
|
|
26
|
+
# Playwright on newer Debian variants may require either libasound2 or libasound2t64.
|
|
27
|
+
RUN apt-get update && (apt-get install -y --no-install-recommends libasound2 || apt-get install -y --no-install-recommends libasound2t64) \
|
|
28
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
29
|
+
|
|
30
|
+
COPY pyproject.toml .
|
|
31
|
+
COPY README.md LICENSE ./
|
|
32
|
+
COPY docseek/ docseek/
|
|
33
|
+
|
|
34
|
+
RUN pip install --no-cache-dir -e . \
|
|
35
|
+
&& playwright install chromium
|
|
36
|
+
|
|
37
|
+
EXPOSE 8010
|
|
38
|
+
|
|
39
|
+
CMD ["uvicorn", "docseek.server:app", "--host", "0.0.0.0", "--port", "8010"]
|
docseek-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
docseek-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: docseek
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Goal-driven document discovery: give it a website and a goal, get back the documents the goal asks for, each with a relevance verdict.
|
|
5
|
+
Project-URL: Homepage, https://github.com/mohojojo/docseek
|
|
6
|
+
Project-URL: Issues, https://github.com/mohojojo/docseek/issues
|
|
7
|
+
Author-email: mohojojo <mohojojoo@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: crawler,document discovery,llm,playwright,web scraping
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Requires-Dist: anthropic>=0.90.0
|
|
17
|
+
Requires-Dist: fastapi>=0.115.0
|
|
18
|
+
Requires-Dist: httpx>=0.27
|
|
19
|
+
Requires-Dist: playwright>=1.40
|
|
20
|
+
Requires-Dist: pydantic>=2.0
|
|
21
|
+
Requires-Dist: python-dotenv>=1.0
|
|
22
|
+
Requires-Dist: uvicorn>=0.30.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
25
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# docseek
|
|
29
|
+
|
|
30
|
+
Goal-driven document discovery. Give it a website and a goal in plain language, in any language:
|
|
31
|
+
|
|
32
|
+
> *"Find the English datasheet of every battery charger"* · *"Töltsd le a 2026-os havi alap jelentéseket"* · *"Finde alle Sitzungsunterlagen vom März"*
|
|
33
|
+
|
|
34
|
+
and it crawls the site with a real browser and returns the documents the goal asks for, each with a
|
|
35
|
+
**relevance verdict** (`accepted`, `unsure`, `rejected`) and facets such as the period and year it covers.
|
|
36
|
+
|
|
37
|
+
It is built for sites where the documents are not one link away: behind year filters and tabs, in
|
|
38
|
+
"load more" listings, in single-page apps that load them from a JSON API, one or two clicks below a
|
|
39
|
+
listing, or spread over hundreds of pages of look-alike documents.
|
|
40
|
+
|
|
41
|
+
## How it decides
|
|
42
|
+
|
|
43
|
+
The crawl is driven by a **relevance judge** that answers four questions, and code does everything else:
|
|
44
|
+
|
|
45
|
+
1. **Is this link a document the goal asks for?** Every candidate gets a relevance score and a verdict.
|
|
46
|
+
2. **What kind of page does this link lead to?** Pages are visited in order of how likely they list documents.
|
|
47
|
+
3. **Does this page still hide documents?** If so, the page is **escalated** to a browsing agent that clicks,
|
|
48
|
+
fills in and scrolls until it finds them.
|
|
49
|
+
4. **Which filter value shows the documents?** Code finds the page's filters, the judge picks the value, code sets it.
|
|
50
|
+
|
|
51
|
+
Two judges are built in:
|
|
52
|
+
|
|
53
|
+
| Judge | What it is |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `llm` | Any LLM: Anthropic, or any OpenAI-compatible endpoint (OpenAI, Azure OpenAI, OpenRouter, Gemini, Ollama, vLLM, LM Studio). Answers on five levels mapped into the verdict bands. |
|
|
56
|
+
| `jev` | [TypeSafe Jev](https://typesafe.ai), a decision model that returns calibrated probabilities. Needs a TypeSafe key. If it becomes unavailable mid-crawl, the LLM judge takes over. |
|
|
57
|
+
|
|
58
|
+
The judge's wording comes from a **domain profile** (`profile`): `generic` works for any goal; `fund-reports`
|
|
59
|
+
is an example of a profile tuned for one domain (periodic fund documents). A profile is a small JSON file -
|
|
60
|
+
see [`docseek/profiles/`](docseek/profiles) - so you can write one for your own domain.
|
|
61
|
+
|
|
62
|
+
The browsing agent (escalations, and the `agent` decision layer that crawls with the agent alone) runs on the
|
|
63
|
+
same LLM configuration.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install docseek
|
|
69
|
+
playwright install chromium
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
or from source:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/mohojojo/docseek && cd docseek
|
|
76
|
+
uv venv && source .venv/bin/activate # or python -m venv .venv
|
|
77
|
+
uv pip install -e ".[dev]"
|
|
78
|
+
playwright install chromium
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Then start the API:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
export ANTHROPIC_API_KEY=... # or configure any other model, see below
|
|
85
|
+
uvicorn docseek.server:app --port 8010
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
curl -s localhost:8010/v1/discover -H 'Content-Type: application/json' -d '{
|
|
90
|
+
"url": "https://www.example.com/",
|
|
91
|
+
"goal": "Find the 2025 annual reports (PDF)",
|
|
92
|
+
"profile": "generic",
|
|
93
|
+
"max_pages": 30
|
|
94
|
+
}'
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Or with Docker: `docker compose up --build`.
|
|
98
|
+
|
|
99
|
+
Or from the command line (the same crawl, printed as JSON):
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
docseek https://www.example.com/ "Find the 2025 annual reports (PDF)" --max-pages 30
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Any model
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# OpenAI
|
|
109
|
+
export LLM_PROVIDER=openai-compatible LLM_MODEL=gpt-4.1-mini LLM_API_KEY=sk-...
|
|
110
|
+
|
|
111
|
+
# a local model through Ollama
|
|
112
|
+
export LLM_PROVIDER=openai-compatible LLM_BASE_URL=http://localhost:11434/v1 LLM_MODEL=llama3.1
|
|
113
|
+
|
|
114
|
+
# Anthropic (the default when ANTHROPIC_API_KEY is set)
|
|
115
|
+
export LLM_PROVIDER=anthropic LLM_MODEL=claude-haiku-4-5
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The client adapts to what a server accepts (for example OpenAI's reasoning models, which take
|
|
119
|
+
`max_completion_tokens` and no `temperature`). The browsing agent needs a model with tool calling;
|
|
120
|
+
screenshots need a vision-capable model.
|
|
121
|
+
|
|
122
|
+
## Generated programs
|
|
123
|
+
|
|
124
|
+
For a site you query again and again, docseek can write a **discovery program**: a coding agent explores the site
|
|
125
|
+
once - raw HTML, rendered pages, the JSON calls a page makes - and writes a small Python function that finds the
|
|
126
|
+
documents the goal asks for. Later requests run the program with no model at all, in seconds, and the relevance
|
|
127
|
+
judge scores what it returns exactly as it scores a crawl.
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
export PROGRAMS_DIR=./programs CODEGEN_MODEL=claude-sonnet-5
|
|
131
|
+
docseek generate https://www.example.com/ "Find the 2025 annual reports (PDF)" # a few minutes, once
|
|
132
|
+
docseek https://www.example.com/ "Find the 2025 annual reports (PDF)" --programs # seconds, no model
|
|
133
|
+
docseek check # has any site changed?
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
With `"programs": true`, `/v1/discover` answers from the site's program when it is **healthy**, and crawls
|
|
137
|
+
otherwise: when the program errors, returns nothing where it used to find documents, or keeps fewer than half of
|
|
138
|
+
what it kept last time, it is marked stale, the crawl answers, and a new program is written in the background.
|
|
139
|
+
`docseek check` (or `POST /v1/programs/check`) replays every program against a snapshot of what it returned
|
|
140
|
+
before - no model, no judge - and reports `ok`, `grew`, `shrank` or `broken`.
|
|
141
|
+
|
|
142
|
+
What a program can do is fenced in: it runs in a separate process with an empty environment, CPU and memory
|
|
143
|
+
limits, an allowlist of standard-library modules, and no network except the parent's fetcher - the site and its
|
|
144
|
+
subdomains, the data hosts and POST endpoints the site's own pages used while the program was written,
|
|
145
|
+
robots.txt, and the same public-address rule as the crawl. **This is a boundary, not a hardened jail**: the code
|
|
146
|
+
was written by a model that read untrusted page text, so the feature is off unless `PROGRAMS_DIR` is set, and a
|
|
147
|
+
docseek that strangers can reach belongs in a container.
|
|
148
|
+
|
|
149
|
+
Health cannot tell when a program confidently returns the wrong slice of a site; a crawl or a person can.
|
|
150
|
+
|
|
151
|
+
## Configuration
|
|
152
|
+
|
|
153
|
+
| Variable | Description |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| `LLM_PROVIDER` | `anthropic` or `openai-compatible`. Default: `anthropic` when `ANTHROPIC_API_KEY` is set. |
|
|
156
|
+
| `LLM_MODEL` | Model for the agent and the LLM judge. Default on `anthropic`: `claude-haiku-4-5`; required for `openai-compatible`. |
|
|
157
|
+
| `LLM_BASE_URL` | Base URL of an OpenAI-compatible endpoint (default `https://api.openai.com/v1`). |
|
|
158
|
+
| `LLM_API_KEY` | Key for the LLM (falls back to `ANTHROPIC_API_KEY` / `OPENAI_API_KEY`; a local server may need none). |
|
|
159
|
+
| `ANTHROPIC_API_KEY` | Enough on its own to run everything on Claude. `/v1/search-sites` uses Anthropic's web search and always needs it. |
|
|
160
|
+
| `TYPESAFE_API_KEY` | Enables the `jev` judge (the default judge when set). |
|
|
161
|
+
| `JEV_PRICE_PER_MTOK` | Your TypeSafe price per million input tokens, used only for the cost the result reports (`jev_cost_usd`). Default 0. |
|
|
162
|
+
| `CRAWLER_API_KEY` | When set, every request must send it as `X-API-Key`. Unset, the API is open - set it before exposing the service. |
|
|
163
|
+
| `PROGRAMS_DIR` | Directory for generated discovery programs. Unset: the feature is off. |
|
|
164
|
+
| `CODEGEN_MODEL` | Model that writes programs, on the configured provider (default: `LLM_MODEL`). Use a strong coding model. |
|
|
165
|
+
| `CODEGEN_MAX_TURNS`, `CODEGEN_MAX_INPUT_TOKENS` | Budget for writing one program (default 45 turns, 3M input tokens including cached reads). |
|
|
166
|
+
| `PATTERNS_DIR` | Directory where learned site knowledge (gate sequences, replayable escalation steps) is kept. Unset: nothing is learned. |
|
|
167
|
+
|
|
168
|
+
## HTTP API
|
|
169
|
+
|
|
170
|
+
| Endpoint | |
|
|
171
|
+
| --- | --- |
|
|
172
|
+
| `POST /v1/discover` | Crawl and return the result as JSON. |
|
|
173
|
+
| `POST /v1/discover-stream` | The same crawl as a server-sent event stream (every page, verdict and escalation as it happens). |
|
|
174
|
+
| `GET /v1/profiles` | The bundled domain profiles. |
|
|
175
|
+
| `POST /v1/search-sites` | Suggest websites for a goal (Anthropic web search). |
|
|
176
|
+
| `GET/DELETE /v1/patterns[/{domain}]` | Learned site knowledge. |
|
|
177
|
+
| `POST /v1/programs` | Write (or rewrite) a site's discovery program in the background. |
|
|
178
|
+
| `GET/DELETE /v1/programs[/{key}]` | Generated programs: code, notes, health. |
|
|
179
|
+
| `POST /v1/programs/check` | Replay programs against their snapshots (drift check). |
|
|
180
|
+
| `GET /health` | Liveness. |
|
|
181
|
+
|
|
182
|
+
Main request fields for `/v1/discover`:
|
|
183
|
+
|
|
184
|
+
| Field | Default | |
|
|
185
|
+
| --- | --- | --- |
|
|
186
|
+
| `url`, `goal` | | Where to start and what to find. |
|
|
187
|
+
| `decision_layer` | judge-driven | `jev` for the judge-driven crawl (despite the name, with any judge), `agent` for the browsing agent alone. |
|
|
188
|
+
| `judge` | `jev` if its key is set, else `llm` | Which relevance judge. |
|
|
189
|
+
| `profile` | `generic` | Domain profile name, or a path to a profile file. |
|
|
190
|
+
| `max_pages`, `max_seconds`, `max_depth` | 10, 180, 3 | Crawl budget. |
|
|
191
|
+
| `same_domain_only`, `allowed_hosts` | `true`, `[]` | Off-domain policy: with `same_domain_only: false` the crawl may cross to one host linked from the start site. |
|
|
192
|
+
| `programs` | `false` | Answer from the site's generated program when it is healthy (needs `PROGRAMS_DIR`). |
|
|
193
|
+
| `include_rejected` | `false` | Also return rejected candidates, to see what the judge threw away. |
|
|
194
|
+
| `model` | `LLM_MODEL` | Agent model override. |
|
|
195
|
+
|
|
196
|
+
The result lists the documents with `relevance`, `verdict`, `source` (page, sitemap, api, agent), `period` and
|
|
197
|
+
`year`, plus `stop_reason`, token counts and which model decided.
|
|
198
|
+
|
|
199
|
+
## Crawling responsibly
|
|
200
|
+
|
|
201
|
+
- **robots.txt** is honoured for every host the crawl touches.
|
|
202
|
+
- **SSRF protection:** only `http(s)` URLs whose host resolves exclusively to public addresses are fetched or
|
|
203
|
+
returned - a hostname pointing at `127.0.0.1` or a cloud metadata address is refused. The same rule applies
|
|
204
|
+
to URLs a page or a model hands the crawler.
|
|
205
|
+
- Pages are visited one at a time by default (`max_concurrent`); set `max_pages` and `max_seconds` to what the
|
|
206
|
+
site can take.
|
|
207
|
+
- Page text reaches the models as data. Instruction-like text in a page is flagged and never acted on.
|
|
208
|
+
- Crawl only what you are allowed to, and respect each site's terms.
|
|
209
|
+
|
|
210
|
+
## Evaluating
|
|
211
|
+
|
|
212
|
+
`eval/` measures recall and precision against hand-checked ground truth: see
|
|
213
|
+
[`eval/ground_truth/README.md`](eval/ground_truth/README.md) for the format and the scripts
|
|
214
|
+
(`run_jev.py` for the judge-driven crawl, `run_baseline.py` for the agent path, `run_codegen.py` for generated
|
|
215
|
+
programs, `judge_compare.py` for scoring a judge offline on a frozen, labelled candidate set).
|
|
216
|
+
|
|
217
|
+
## Development
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
uv pip install -e ".[dev]"
|
|
221
|
+
playwright install chromium
|
|
222
|
+
pytest
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
The tests run offline: DNS resolution and robots.txt are faked (`tests/conftest.py`) and every model call is
|
|
226
|
+
mocked. Browser tests use a local Chromium and are skipped when it is missing.
|
|
227
|
+
|
|
228
|
+
## Licence
|
|
229
|
+
|
|
230
|
+
Apache-2.0 - see [LICENSE](LICENSE). TypeSafe Jev is a third-party service with its own terms; its API client
|
|
231
|
+
is included, its model is not.
|