linxsci 0.3.1__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.
- linxsci-0.3.1/.env.example +8 -0
- linxsci-0.3.1/Install.bat +13 -0
- linxsci-0.3.1/Install.command +11 -0
- linxsci-0.3.1/MANIFEST.in +6 -0
- linxsci-0.3.1/PKG-INFO +188 -0
- linxsci-0.3.1/README.md +177 -0
- linxsci-0.3.1/README.zh-CN.md +177 -0
- linxsci-0.3.1/docs/API.md +98 -0
- linxsci-0.3.1/docs/API.zh-CN.md +98 -0
- linxsci-0.3.1/docs/CLI_GUIDE.md +529 -0
- linxsci-0.3.1/docs/CLI_GUIDE.zh-CN.md +530 -0
- linxsci-0.3.1/docs/DEVELOPMENT.md +265 -0
- linxsci-0.3.1/docs/DEVELOPMENT.zh-CN.md +569 -0
- linxsci-0.3.1/docs/RELEASING.md +65 -0
- linxsci-0.3.1/docs/RELEASING.zh-CN.md +65 -0
- linxsci-0.3.1/docs/TESTING.md +69 -0
- linxsci-0.3.1/docs/TESTING.zh-CN.md +149 -0
- linxsci-0.3.1/docs/USER_GUIDE.md +157 -0
- linxsci-0.3.1/docs/USER_GUIDE.zh-CN.md +157 -0
- linxsci-0.3.1/docs/releases/v0.3.1.md +24 -0
- linxsci-0.3.1/docs/releases/v0.3.1.zh-CN.md +24 -0
- linxsci-0.3.1/examples/research.py +28 -0
- linxsci-0.3.1/install.py +39 -0
- linxsci-0.3.1/linxsci.egg-info/PKG-INFO +188 -0
- linxsci-0.3.1/linxsci.egg-info/SOURCES.txt +55 -0
- linxsci-0.3.1/linxsci.egg-info/dependency_links.txt +1 -0
- linxsci-0.3.1/linxsci.egg-info/entry_points.txt +2 -0
- linxsci-0.3.1/linxsci.egg-info/top_level.txt +1 -0
- linxsci-0.3.1/pyproject.toml +28 -0
- linxsci-0.3.1/setup.cfg +4 -0
- linxsci-0.3.1/skills/linxsci-skills/SKILL.md +143 -0
- linxsci-0.3.1/skills/linxsci-skills/SKILL.zh-CN.md +160 -0
- linxsci-0.3.1/skills/linxsci-skills/__init__.py +5 -0
- linxsci-0.3.1/skills/linxsci-skills/agents/openai.yaml +4 -0
- linxsci-0.3.1/skills/linxsci-skills/references/api.md +98 -0
- linxsci-0.3.1/skills/linxsci-skills/references/api.zh-CN.md +98 -0
- linxsci-0.3.1/skills/linxsci-skills/references/cli.md +495 -0
- linxsci-0.3.1/skills/linxsci-skills/references/cli.zh-CN.md +496 -0
- linxsci-0.3.1/skills/linxsci-skills/scripts/__init__.py +1 -0
- linxsci-0.3.1/skills/linxsci-skills/scripts/cli.py +34 -0
- linxsci-0.3.1/skills/linxsci-skills/scripts/client.py +211 -0
- linxsci-0.3.1/skills/linxsci-skills/scripts/commands.py +371 -0
- linxsci-0.3.1/skills/linxsci-skills/scripts/config.py +111 -0
- linxsci-0.3.1/skills/linxsci-skills/scripts/installer.py +56 -0
- linxsci-0.3.1/skills/linxsci-skills/scripts/output.py +151 -0
- linxsci-0.3.1/skills/linxsci-skills/service.json +4 -0
- linxsci-0.3.1/tests/cli_cases.py +40 -0
- linxsci-0.3.1/tests/env_helpers.py +11 -0
- linxsci-0.3.1/tests/test_api_coverage.py +144 -0
- linxsci-0.3.1/tests/test_cli.py +140 -0
- linxsci-0.3.1/tests/test_client.py +129 -0
- linxsci-0.3.1/tests/test_framework_errors.py +168 -0
- linxsci-0.3.1/tests/test_onboarding.py +156 -0
- linxsci-0.3.1/tests/test_output.py +193 -0
- linxsci-0.3.1/tools/build_release.py +60 -0
- linxsci-0.3.1/tools/check_release.py +92 -0
- linxsci-0.3.1/tools/smoke_release.py +154 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Optional environment overrides. Ordinary users can run setup instead.
|
|
2
|
+
LINXSCI_BASE_URL=https://linxsci.com
|
|
3
|
+
LINXSCI_OPENAPI_KEY=replace-with-your-linxsci-key
|
|
4
|
+
# Test service, when explicitly needed: http://localhost:8000
|
|
5
|
+
# Optional, only when required by the deployed PDF API:
|
|
6
|
+
# LINXSCI_MINERU_API_KEY=replace-with-your-mineru-key
|
|
7
|
+
# Optional alternate local configuration file:
|
|
8
|
+
# LINXSCI_CONFIG_FILE=/absolute/path/config.json
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
chcp 65001 >nul
|
|
3
|
+
cd /d "%~dp0"
|
|
4
|
+
where py >nul 2>nul
|
|
5
|
+
if %errorlevel% equ 0 (
|
|
6
|
+
py -3 install.py %*
|
|
7
|
+
) else (
|
|
8
|
+
python install.py %*
|
|
9
|
+
)
|
|
10
|
+
set "linxsci_result=%errorlevel%"
|
|
11
|
+
if %linxsci_result% neq 0 echo 安装或配置未完成,请查看上方提示。需要 Python 3.9 或更新版本。
|
|
12
|
+
pause
|
|
13
|
+
exit /b %linxsci_result%
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
cd -- "$(dirname -- "$0")" || exit 1
|
|
3
|
+
if command -v python3 >/dev/null 2>&1; then
|
|
4
|
+
python3 install.py "$@"
|
|
5
|
+
result=$?
|
|
6
|
+
else
|
|
7
|
+
echo "请先安装 Python 3.9 或更新版本:https://www.python.org/downloads/"
|
|
8
|
+
result=2
|
|
9
|
+
fi
|
|
10
|
+
read -r -p "按回车关闭窗口…" _linxsci_done
|
|
11
|
+
exit "$result"
|
linxsci-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: linxsci
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: LinxSci OpenAPI v2 CLI and Python client
|
|
5
|
+
Project-URL: Homepage, https://linxsci.com
|
|
6
|
+
Project-URL: Repository, https://github.com/LinxSci/linxsci-skills
|
|
7
|
+
Project-URL: Documentation, https://github.com/LinxSci/linxsci-skills/blob/main/README.md
|
|
8
|
+
Project-URL: Issues, https://github.com/LinxSci/linxsci-skills/issues
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# linxsci-skills
|
|
13
|
+
|
|
14
|
+
[简体中文](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/README.zh-CN.md)
|
|
15
|
+
|
|
16
|
+
Search academic papers, read sections and citations, explore research entities, and parse PDFs through LinxSci OpenAPI v2. Choose the interface that fits your workflow; each supports all 34 documented routes.
|
|
17
|
+
|
|
18
|
+
| Interface | Use it for | Entry point |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| [AI Skill](#ai-skill) | Research with an assistant that supports local skills and scripts | `$linxsci-skills` |
|
|
21
|
+
| [CLI](#cli) | Run commands in a terminal | `linxsci` |
|
|
22
|
+
| [Python SDK](#python-sdk) | Integrate the API into a Python application | `from linxsci import LinxSciClient` |
|
|
23
|
+
|
|
24
|
+
Requires **Python 3.9+** and an existing LinxSci API key for service calls. No third-party Python runtime dependencies are required. The project and Skill are named `linxsci-skills`; the Python distribution is `linxsci`.
|
|
25
|
+
|
|
26
|
+
## AI Skill
|
|
27
|
+
|
|
28
|
+
### Install and configure
|
|
29
|
+
|
|
30
|
+
Download the [Skill installation bundle](https://github.com/LinxSci/linxsci-skills/releases/download/v0.3.1/linxsci-skills-0.3.1.zip), extract it fully, and double-click `Install.command` on macOS or `Install.bat` on Windows. In a terminal opened in the extracted directory, run:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
python3 install.py
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
On Windows use `py -3 install.py`. The installer copies the complete Skill to `~/.agents/skills/linxsci-skills` and guides you through hidden-input key setup. Use `--skills-dir <parent-directory>` for another assistant location. Refresh or restart your assistant after installation.
|
|
37
|
+
|
|
38
|
+
With Node.js/npx and a compatible Skill installer, you can also run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx skills add https://github.com/LinxSci/linxsci-skills --skill linxsci-skills
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If cloning times out, use the ZIP above. After installation, ask your assistant:
|
|
45
|
+
|
|
46
|
+
> Use $linxsci-skills to check configuration and guide me through entering my API key locally if needed. Do not ask me to send the key in chat.
|
|
47
|
+
|
|
48
|
+
### Use the Skill
|
|
49
|
+
|
|
50
|
+
> Use $linxsci-skills to find papers on graph neural networks, read their methods sections, compare the approaches, and cite the returned sources.
|
|
51
|
+
|
|
52
|
+
> Use $linxsci-skills to parse /absolute/path/paper.pdf, record the task ID, and retrieve the result after the task completes.
|
|
53
|
+
|
|
54
|
+
Replace the PDF path with an accessible local file. Parsing uploads it to your configured service. Ask for the number of papers, response length and language you need; the assistant handles retrieval and presentation.
|
|
55
|
+
|
|
56
|
+
### Update and uninstall
|
|
57
|
+
|
|
58
|
+
For copies managed by the bundled installer, extract the new bundle and run from that **new** directory:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python3 install.py --update --no-config
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For a custom destination, repeat the same `--skills-dir` option. Updating preserves settings and backs up the previous managed copy outside the assistant scan directory. Update externally managed copies with their original installer.
|
|
65
|
+
|
|
66
|
+
To uninstall, use the original installer's removal feature or remove the directory created by the bundled installer, then refresh your assistant. If you also want to clear saved settings, ask the assistant to help before removing the Skill.
|
|
67
|
+
|
|
68
|
+
See the [Skill user guide](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/USER_GUIDE.md) for installation options, configuration, examples and troubleshooting.
|
|
69
|
+
|
|
70
|
+
## CLI
|
|
71
|
+
|
|
72
|
+
### Install and configure
|
|
73
|
+
|
|
74
|
+
Install from PyPI in a Python environment:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
python3 -m venv .venv
|
|
78
|
+
source .venv/bin/activate
|
|
79
|
+
python -m pip install linxsci==0.3.1
|
|
80
|
+
linxsci setup
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Alternatively, install from source:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
git clone https://github.com/LinxSci/linxsci-skills.git
|
|
87
|
+
cd linxsci-skills
|
|
88
|
+
python3 -m venv .venv
|
|
89
|
+
source .venv/bin/activate
|
|
90
|
+
python -m pip install .
|
|
91
|
+
linxsci --version
|
|
92
|
+
linxsci setup
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
On Windows create the environment with `py -3 -m venv .venv` and activate it with `.venv\Scripts\activate.bat` in Command Prompt. You can instead install a downloaded wheel with `python -m pip install /path/to/linxsci-0.3.1-py3-none-any.whl`. With uv already installed, `uv tool install /path/to/linxsci-0.3.1-py3-none-any.whl` provides an isolated terminal installation.
|
|
96
|
+
|
|
97
|
+
`linxsci setup` reads your API key using hidden input. The default service root is `https://linxsci.com`, without `/openapi/v2`. `LINXSCI_BASE_URL` and `LINXSCI_OPENAPI_KEY` override saved settings; `LINXSCI_CONFIG_FILE` selects another configuration file. Default settings are stored in `~/.config/linxsci-skills/config.json` on macOS/Linux or `%LOCALAPPDATA%\linxsci-skills\config.json` on Windows.
|
|
98
|
+
|
|
99
|
+
### Search, read and parse
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
linxsci search "graph neural networks"
|
|
103
|
+
linxsci paper "<returned-paper-id>"
|
|
104
|
+
linxsci paper "<returned-paper-id>" --resource toc
|
|
105
|
+
linxsci paper "<returned-paper-id>" --resource sections --item-id "<returned-section-id>"
|
|
106
|
+
linxsci upload /absolute/path/paper.pdf
|
|
107
|
+
linxsci task "<returned-task-id>"
|
|
108
|
+
linxsci task "<returned-task-id>" --result
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use actual IDs from responses. Fetch task results only after completion. PDF commands accept `LINXSCI_MINERU_API_KEY` when the endpoint requires an additional parsing key.
|
|
112
|
+
|
|
113
|
+
Output and errors default to compact JSON. `--pretty` and `--human-errors` provide readable terminal output. Global `--select`, `--fields`, `--limit` and `--table` shape responses locally. Output over 12000 characters and binary responses are saved to files with JSON references; `read-output` reads saved responses without another API call. See [all CLI commands and parameters](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/CLI_GUIDE.md).
|
|
114
|
+
|
|
115
|
+
`linxsci config` shows settings without exposing the key. `linxsci doctor --json` checks `/meta` and consumes a normal API call. `linxsci config --clear` removes saved settings, but leaves environment variables and server-side keys unchanged.
|
|
116
|
+
|
|
117
|
+
### Update and uninstall
|
|
118
|
+
|
|
119
|
+
For a PyPI installation, run `python -m pip install --upgrade linxsci`; for uv use `uv tool upgrade linxsci`. Update the source checkout and run `python -m pip install --upgrade .`, or install a new wheel with `python -m pip install --upgrade /path/to/linxsci-<version>-py3-none-any.whl`. For an isolated uv installation, use `uv tool install --force /path/to/linxsci-<version>-py3-none-any.whl`. Replace `<version>` with the downloaded version.
|
|
120
|
+
|
|
121
|
+
Uninstall using `python -m pip uninstall linxsci` in the installation environment, or `uv tool uninstall linxsci` for an isolated uv installation.
|
|
122
|
+
|
|
123
|
+
## Python SDK
|
|
124
|
+
|
|
125
|
+
### Install
|
|
126
|
+
|
|
127
|
+
Install from PyPI in the same Python environment that runs your application:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
python3 -m venv .venv
|
|
131
|
+
source .venv/bin/activate
|
|
132
|
+
python -m pip install linxsci==0.3.1
|
|
133
|
+
python -c "from linxsci import LinxSciClient; print('SDK import OK')"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
On Windows use `py -3 -m venv .venv` and `.venv\Scripts\activate.bat` in Command Prompt. For a source installation, download or clone this repository and run `python -m pip install .` from its root in your application environment.
|
|
137
|
+
|
|
138
|
+
### Configure and call from Python
|
|
139
|
+
|
|
140
|
+
This example reads the key from the application's environment or prompts without echoing it during local interactive use:
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
import os
|
|
144
|
+
from getpass import getpass
|
|
145
|
+
from linxsci import LinxSciClient, LinxSciError
|
|
146
|
+
|
|
147
|
+
client = LinxSciClient(
|
|
148
|
+
base_url=os.environ.get("LINXSCI_BASE_URL", "https://linxsci.com"),
|
|
149
|
+
api_key=os.environ.get("LINXSCI_OPENAPI_KEY") or getpass("LinxSci API key: "),
|
|
150
|
+
timeout=60,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
try:
|
|
154
|
+
response = client.search("graph neural networks")
|
|
155
|
+
print(response.json())
|
|
156
|
+
except LinxSciError as error:
|
|
157
|
+
print(error.status, error.error_code)
|
|
158
|
+
print(error.request_id, error.framework_request_id)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
For non-interactive applications, inject the key through your deployment environment or secret manager. Constructor arguments take precedence over environment variables, existing configuration files and the release URL default. The SDK does not automatically load `.env` files. Supplying both `base_url` and `api_key` bypasses saved configuration; constructing the client does not send a request or save the key.
|
|
162
|
+
|
|
163
|
+
Reuse the configured client to read a paper or upload a PDF:
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
paper_id = "<actual-returned-paper-id>"
|
|
167
|
+
print(client.paper(paper_id, "toc").json())
|
|
168
|
+
|
|
169
|
+
response = client.upload_pdf(
|
|
170
|
+
"/absolute/path/paper.pdf",
|
|
171
|
+
mineru_key=os.environ.get("LINXSCI_MINERU_API_KEY"),
|
|
172
|
+
)
|
|
173
|
+
print(response.json())
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The SDK returns a `Response` with HTTP status, headers and raw `body`; use `.json()` for JSON or save `body` for binary data. The optional PDF key must be read and passed explicitly. Record the actual task ID from the response; use `client.pdf_task(task_id)` to check its state and `client.pdf_task(task_id, result=True)` only after completion. See [SDK methods, parameters and errors](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/DEVELOPMENT.md).
|
|
177
|
+
|
|
178
|
+
### Update and uninstall
|
|
179
|
+
|
|
180
|
+
For a PyPI installation, run `python -m pip install --upgrade linxsci` in your application environment. Install a new wheel with `python -m pip install --upgrade /path/to/linxsci-<version>-py3-none-any.whl` in your application's environment, or update the source and run `python -m pip install --upgrade .`. Restart long-running Python processes after upgrading.
|
|
181
|
+
|
|
182
|
+
Check the installed version with `python -c "from importlib.metadata import version; print(version('linxsci'))"`. Uninstall with `python -m pip uninstall linxsci`. Package removal does not delete application secrets or revoke API keys.
|
|
183
|
+
|
|
184
|
+
## API reference
|
|
185
|
+
|
|
186
|
+
POST fields, pagination and PDF task states follow the selected endpoint's contract. Preserve returned IDs and request trace IDs. After an uncertain execution or billing result such as `-3905`, check the operation's status before repeating uploads or task creation.
|
|
187
|
+
|
|
188
|
+
See [HTTP endpoints, authentication and errors](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/API.md). Each linked guide includes its Chinese edition.
|
linxsci-0.3.1/README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# linxsci-skills
|
|
2
|
+
|
|
3
|
+
[简体中文](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Search academic papers, read sections and citations, explore research entities, and parse PDFs through LinxSci OpenAPI v2. Choose the interface that fits your workflow; each supports all 34 documented routes.
|
|
6
|
+
|
|
7
|
+
| Interface | Use it for | Entry point |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| [AI Skill](#ai-skill) | Research with an assistant that supports local skills and scripts | `$linxsci-skills` |
|
|
10
|
+
| [CLI](#cli) | Run commands in a terminal | `linxsci` |
|
|
11
|
+
| [Python SDK](#python-sdk) | Integrate the API into a Python application | `from linxsci import LinxSciClient` |
|
|
12
|
+
|
|
13
|
+
Requires **Python 3.9+** and an existing LinxSci API key for service calls. No third-party Python runtime dependencies are required. The project and Skill are named `linxsci-skills`; the Python distribution is `linxsci`.
|
|
14
|
+
|
|
15
|
+
## AI Skill
|
|
16
|
+
|
|
17
|
+
### Install and configure
|
|
18
|
+
|
|
19
|
+
Download the [Skill installation bundle](https://github.com/LinxSci/linxsci-skills/releases/download/v0.3.1/linxsci-skills-0.3.1.zip), extract it fully, and double-click `Install.command` on macOS or `Install.bat` on Windows. In a terminal opened in the extracted directory, run:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python3 install.py
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
On Windows use `py -3 install.py`. The installer copies the complete Skill to `~/.agents/skills/linxsci-skills` and guides you through hidden-input key setup. Use `--skills-dir <parent-directory>` for another assistant location. Refresh or restart your assistant after installation.
|
|
26
|
+
|
|
27
|
+
With Node.js/npx and a compatible Skill installer, you can also run:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx skills add https://github.com/LinxSci/linxsci-skills --skill linxsci-skills
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If cloning times out, use the ZIP above. After installation, ask your assistant:
|
|
34
|
+
|
|
35
|
+
> Use $linxsci-skills to check configuration and guide me through entering my API key locally if needed. Do not ask me to send the key in chat.
|
|
36
|
+
|
|
37
|
+
### Use the Skill
|
|
38
|
+
|
|
39
|
+
> Use $linxsci-skills to find papers on graph neural networks, read their methods sections, compare the approaches, and cite the returned sources.
|
|
40
|
+
|
|
41
|
+
> Use $linxsci-skills to parse /absolute/path/paper.pdf, record the task ID, and retrieve the result after the task completes.
|
|
42
|
+
|
|
43
|
+
Replace the PDF path with an accessible local file. Parsing uploads it to your configured service. Ask for the number of papers, response length and language you need; the assistant handles retrieval and presentation.
|
|
44
|
+
|
|
45
|
+
### Update and uninstall
|
|
46
|
+
|
|
47
|
+
For copies managed by the bundled installer, extract the new bundle and run from that **new** directory:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python3 install.py --update --no-config
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For a custom destination, repeat the same `--skills-dir` option. Updating preserves settings and backs up the previous managed copy outside the assistant scan directory. Update externally managed copies with their original installer.
|
|
54
|
+
|
|
55
|
+
To uninstall, use the original installer's removal feature or remove the directory created by the bundled installer, then refresh your assistant. If you also want to clear saved settings, ask the assistant to help before removing the Skill.
|
|
56
|
+
|
|
57
|
+
See the [Skill user guide](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/USER_GUIDE.md) for installation options, configuration, examples and troubleshooting.
|
|
58
|
+
|
|
59
|
+
## CLI
|
|
60
|
+
|
|
61
|
+
### Install and configure
|
|
62
|
+
|
|
63
|
+
Install from PyPI in a Python environment:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
python3 -m venv .venv
|
|
67
|
+
source .venv/bin/activate
|
|
68
|
+
python -m pip install linxsci==0.3.1
|
|
69
|
+
linxsci setup
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Alternatively, install from source:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/LinxSci/linxsci-skills.git
|
|
76
|
+
cd linxsci-skills
|
|
77
|
+
python3 -m venv .venv
|
|
78
|
+
source .venv/bin/activate
|
|
79
|
+
python -m pip install .
|
|
80
|
+
linxsci --version
|
|
81
|
+
linxsci setup
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
On Windows create the environment with `py -3 -m venv .venv` and activate it with `.venv\Scripts\activate.bat` in Command Prompt. You can instead install a downloaded wheel with `python -m pip install /path/to/linxsci-0.3.1-py3-none-any.whl`. With uv already installed, `uv tool install /path/to/linxsci-0.3.1-py3-none-any.whl` provides an isolated terminal installation.
|
|
85
|
+
|
|
86
|
+
`linxsci setup` reads your API key using hidden input. The default service root is `https://linxsci.com`, without `/openapi/v2`. `LINXSCI_BASE_URL` and `LINXSCI_OPENAPI_KEY` override saved settings; `LINXSCI_CONFIG_FILE` selects another configuration file. Default settings are stored in `~/.config/linxsci-skills/config.json` on macOS/Linux or `%LOCALAPPDATA%\linxsci-skills\config.json` on Windows.
|
|
87
|
+
|
|
88
|
+
### Search, read and parse
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
linxsci search "graph neural networks"
|
|
92
|
+
linxsci paper "<returned-paper-id>"
|
|
93
|
+
linxsci paper "<returned-paper-id>" --resource toc
|
|
94
|
+
linxsci paper "<returned-paper-id>" --resource sections --item-id "<returned-section-id>"
|
|
95
|
+
linxsci upload /absolute/path/paper.pdf
|
|
96
|
+
linxsci task "<returned-task-id>"
|
|
97
|
+
linxsci task "<returned-task-id>" --result
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Use actual IDs from responses. Fetch task results only after completion. PDF commands accept `LINXSCI_MINERU_API_KEY` when the endpoint requires an additional parsing key.
|
|
101
|
+
|
|
102
|
+
Output and errors default to compact JSON. `--pretty` and `--human-errors` provide readable terminal output. Global `--select`, `--fields`, `--limit` and `--table` shape responses locally. Output over 12000 characters and binary responses are saved to files with JSON references; `read-output` reads saved responses without another API call. See [all CLI commands and parameters](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/CLI_GUIDE.md).
|
|
103
|
+
|
|
104
|
+
`linxsci config` shows settings without exposing the key. `linxsci doctor --json` checks `/meta` and consumes a normal API call. `linxsci config --clear` removes saved settings, but leaves environment variables and server-side keys unchanged.
|
|
105
|
+
|
|
106
|
+
### Update and uninstall
|
|
107
|
+
|
|
108
|
+
For a PyPI installation, run `python -m pip install --upgrade linxsci`; for uv use `uv tool upgrade linxsci`. Update the source checkout and run `python -m pip install --upgrade .`, or install a new wheel with `python -m pip install --upgrade /path/to/linxsci-<version>-py3-none-any.whl`. For an isolated uv installation, use `uv tool install --force /path/to/linxsci-<version>-py3-none-any.whl`. Replace `<version>` with the downloaded version.
|
|
109
|
+
|
|
110
|
+
Uninstall using `python -m pip uninstall linxsci` in the installation environment, or `uv tool uninstall linxsci` for an isolated uv installation.
|
|
111
|
+
|
|
112
|
+
## Python SDK
|
|
113
|
+
|
|
114
|
+
### Install
|
|
115
|
+
|
|
116
|
+
Install from PyPI in the same Python environment that runs your application:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python3 -m venv .venv
|
|
120
|
+
source .venv/bin/activate
|
|
121
|
+
python -m pip install linxsci==0.3.1
|
|
122
|
+
python -c "from linxsci import LinxSciClient; print('SDK import OK')"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
On Windows use `py -3 -m venv .venv` and `.venv\Scripts\activate.bat` in Command Prompt. For a source installation, download or clone this repository and run `python -m pip install .` from its root in your application environment.
|
|
126
|
+
|
|
127
|
+
### Configure and call from Python
|
|
128
|
+
|
|
129
|
+
This example reads the key from the application's environment or prompts without echoing it during local interactive use:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
import os
|
|
133
|
+
from getpass import getpass
|
|
134
|
+
from linxsci import LinxSciClient, LinxSciError
|
|
135
|
+
|
|
136
|
+
client = LinxSciClient(
|
|
137
|
+
base_url=os.environ.get("LINXSCI_BASE_URL", "https://linxsci.com"),
|
|
138
|
+
api_key=os.environ.get("LINXSCI_OPENAPI_KEY") or getpass("LinxSci API key: "),
|
|
139
|
+
timeout=60,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
try:
|
|
143
|
+
response = client.search("graph neural networks")
|
|
144
|
+
print(response.json())
|
|
145
|
+
except LinxSciError as error:
|
|
146
|
+
print(error.status, error.error_code)
|
|
147
|
+
print(error.request_id, error.framework_request_id)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
For non-interactive applications, inject the key through your deployment environment or secret manager. Constructor arguments take precedence over environment variables, existing configuration files and the release URL default. The SDK does not automatically load `.env` files. Supplying both `base_url` and `api_key` bypasses saved configuration; constructing the client does not send a request or save the key.
|
|
151
|
+
|
|
152
|
+
Reuse the configured client to read a paper or upload a PDF:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
paper_id = "<actual-returned-paper-id>"
|
|
156
|
+
print(client.paper(paper_id, "toc").json())
|
|
157
|
+
|
|
158
|
+
response = client.upload_pdf(
|
|
159
|
+
"/absolute/path/paper.pdf",
|
|
160
|
+
mineru_key=os.environ.get("LINXSCI_MINERU_API_KEY"),
|
|
161
|
+
)
|
|
162
|
+
print(response.json())
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The SDK returns a `Response` with HTTP status, headers and raw `body`; use `.json()` for JSON or save `body` for binary data. The optional PDF key must be read and passed explicitly. Record the actual task ID from the response; use `client.pdf_task(task_id)` to check its state and `client.pdf_task(task_id, result=True)` only after completion. See [SDK methods, parameters and errors](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/DEVELOPMENT.md).
|
|
166
|
+
|
|
167
|
+
### Update and uninstall
|
|
168
|
+
|
|
169
|
+
For a PyPI installation, run `python -m pip install --upgrade linxsci` in your application environment. Install a new wheel with `python -m pip install --upgrade /path/to/linxsci-<version>-py3-none-any.whl` in your application's environment, or update the source and run `python -m pip install --upgrade .`. Restart long-running Python processes after upgrading.
|
|
170
|
+
|
|
171
|
+
Check the installed version with `python -c "from importlib.metadata import version; print(version('linxsci'))"`. Uninstall with `python -m pip uninstall linxsci`. Package removal does not delete application secrets or revoke API keys.
|
|
172
|
+
|
|
173
|
+
## API reference
|
|
174
|
+
|
|
175
|
+
POST fields, pagination and PDF task states follow the selected endpoint's contract. Preserve returned IDs and request trace IDs. After an uncertain execution or billing result such as `-3905`, check the operation's status before repeating uploads or task creation.
|
|
176
|
+
|
|
177
|
+
See [HTTP endpoints, authentication and errors](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/API.md). Each linked guide includes its Chinese edition.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# linxsci-skills
|
|
2
|
+
|
|
3
|
+
[English](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/README.md)
|
|
4
|
+
|
|
5
|
+
通过 LinxSci OpenAPI v2 检索学术论文、阅读章节与引用、查询学术实体并解析 PDF。选择适合自己工作方式的入口,每种方式均支持文档中的全部 34 条接口。
|
|
6
|
+
|
|
7
|
+
| 使用方式 | 适用场景 | 入口 |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| [AI Skill](#ai-skill) | 在支持本地 Skill 和脚本执行的助手中研究论文 | `$linxsci-skills` |
|
|
10
|
+
| [CLI](#cli) | 在终端执行命令 | `linxsci` |
|
|
11
|
+
| [Python SDK](#python-sdk) | 在 Python 应用中集成接口 | `from linxsci import LinxSciClient` |
|
|
12
|
+
|
|
13
|
+
需要 **Python 3.9+**;调用服务时需要已有的 LinxSci API Key。Python 运行时无需第三方依赖。项目与 Skill 名为 `linxsci-skills`,Python 安装包名为 `linxsci`。
|
|
14
|
+
|
|
15
|
+
## AI Skill
|
|
16
|
+
|
|
17
|
+
### 安装与配置
|
|
18
|
+
|
|
19
|
+
下载 [Skill 安装包](https://github.com/LinxSci/linxsci-skills/releases/download/v0.3.1/linxsci-skills-0.3.1.zip),完整解压后,在 macOS 双击 `Install.command`,Windows 双击 `Install.bat`。也可以在解压目录打开终端并运行:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python3 install.py
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Windows 使用 `py -3 install.py`。安装器将完整 Skill 复制到 `~/.agents/skills/linxsci-skills`,并引导你在本机隐藏输入 Key。其他助手目录可使用 `--skills-dir <父目录>` 指定。安装后刷新或重启助手。
|
|
26
|
+
|
|
27
|
+
已有 Node.js/npx 和兼容的 Skill 安装器时,也可以运行:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx skills add https://github.com/LinxSci/linxsci-skills --skill linxsci-skills
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
克隆超时时可改用上方 ZIP。安装后向助手提出:
|
|
34
|
+
|
|
35
|
+
> 使用 $linxsci-skills 检查配置;如需配置,请引导我在本机安全输入 API Key,不要让我把 Key 发到聊天中。
|
|
36
|
+
|
|
37
|
+
### 使用 Skill
|
|
38
|
+
|
|
39
|
+
> 使用 $linxsci-skills 检索图神经网络论文,阅读方法章节,对比研究方案,并引用返回的来源。
|
|
40
|
+
|
|
41
|
+
> 使用 $linxsci-skills 解析 /absolute/path/paper.pdf,记录任务 ID,完成后获取结果。
|
|
42
|
+
|
|
43
|
+
将 PDF 路径替换为助手可以访问的实际文件。解析会将文件上传至配置的服务。说明所需论文数量、回答长度和语言,助手负责检索与整理。
|
|
44
|
+
|
|
45
|
+
### 更新与卸载
|
|
46
|
+
|
|
47
|
+
对于自带安装器管理的副本,解压新版安装包,在**新版**目录执行:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python3 install.py --update --no-config
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
自定义安装目录时,补充原来使用的 `--skills-dir`。更新保留配置,并将旧副本备份到助手扫描目录之外。其他安装器管理的副本请使用原安装器更新。
|
|
54
|
+
|
|
55
|
+
卸载时使用原安装器的移除功能,或删除自带安装器创建的目录,然后刷新助手。如需清除保存的配置,请在删除 Skill 前让助手协助处理。
|
|
56
|
+
|
|
57
|
+
安装参数、配置、使用示例和故障排查见 [Skill 使用指南](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/USER_GUIDE.zh-CN.md)。
|
|
58
|
+
|
|
59
|
+
## CLI
|
|
60
|
+
|
|
61
|
+
### 安装与配置
|
|
62
|
+
|
|
63
|
+
在 Python 环境中从 PyPI 安装:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
python3 -m venv .venv
|
|
67
|
+
source .venv/bin/activate
|
|
68
|
+
python -m pip install linxsci==0.3.1
|
|
69
|
+
linxsci setup
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
也可以从源码安装:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/LinxSci/linxsci-skills.git
|
|
76
|
+
cd linxsci-skills
|
|
77
|
+
python3 -m venv .venv
|
|
78
|
+
source .venv/bin/activate
|
|
79
|
+
python -m pip install .
|
|
80
|
+
linxsci --version
|
|
81
|
+
linxsci setup
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Windows 使用 `py -3 -m venv .venv` 创建环境,在命令提示符 CMD 中运行 `.venv\Scripts\activate.bat` 激活。也可通过 `python -m pip install /path/to/linxsci-0.3.1-py3-none-any.whl` 安装已下载的 wheel。已安装 uv 时,可用 `uv tool install /path/to/linxsci-0.3.1-py3-none-any.whl` 创建隔离的终端工具安装。
|
|
85
|
+
|
|
86
|
+
`linxsci setup` 通过隐藏输入读取 API Key。默认服务根地址为 `https://linxsci.com`,不添加 `/openapi/v2`。`LINXSCI_BASE_URL` 和 `LINXSCI_OPENAPI_KEY` 优先于保存的设置;`LINXSCI_CONFIG_FILE` 可指定其他配置文件。默认配置位于 macOS/Linux 的 `~/.config/linxsci-skills/config.json`,或 Windows 的 `%LOCALAPPDATA%\linxsci-skills\config.json`。
|
|
87
|
+
|
|
88
|
+
### 检索、阅读与解析
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
linxsci search "graph neural networks"
|
|
92
|
+
linxsci paper "<returned-paper-id>"
|
|
93
|
+
linxsci paper "<returned-paper-id>" --resource toc
|
|
94
|
+
linxsci paper "<returned-paper-id>" --resource sections --item-id "<returned-section-id>"
|
|
95
|
+
linxsci upload /absolute/path/paper.pdf
|
|
96
|
+
linxsci task "<returned-task-id>"
|
|
97
|
+
linxsci task "<returned-task-id>" --result
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
使用响应返回的实际 ID,确认任务完成后才获取结果。PDF 接口需要额外解析 Key 时,相关命令读取 `LINXSCI_MINERU_API_KEY`。
|
|
101
|
+
|
|
102
|
+
接口输出和错误默认使用紧凑 JSON;`--pretty` 和 `--human-errors` 提供便于人工阅读的终端输出。全局 `--select`、`--fields`、`--limit` 和 `--table` 在本地筛选响应。超过 12000 字符的输出及二进制内容保存到文件并返回 JSON 引用;`read-output` 读取已保存的响应,不再请求接口。详见 [CLI 全部命令与参数](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/CLI_GUIDE.zh-CN.md)。
|
|
103
|
+
|
|
104
|
+
`linxsci config` 查看设置而不展示 Key;`linxsci doctor --json` 请求 `/meta` 检查连接,计入正常接口调用;`linxsci config --clear` 删除保存的设置,不清除环境变量或撤销服务端 Key。
|
|
105
|
+
|
|
106
|
+
### 更新与卸载
|
|
107
|
+
|
|
108
|
+
PyPI 安装使用 `python -m pip install --upgrade linxsci` 更新;通过 uv 从 PyPI 安装的副本使用 `uv tool upgrade linxsci`。更新源码后执行 `python -m pip install --upgrade .`,或运行 `python -m pip install --upgrade /path/to/linxsci-<version>-py3-none-any.whl` 安装新版 wheel。uv 隔离安装使用 `uv tool install --force /path/to/linxsci-<version>-py3-none-any.whl`。将 `<version>` 替换为下载的实际版本号。
|
|
109
|
+
|
|
110
|
+
在安装环境中运行 `python -m pip uninstall linxsci` 卸载;uv 隔离安装使用 `uv tool uninstall linxsci`。
|
|
111
|
+
|
|
112
|
+
## Python SDK
|
|
113
|
+
|
|
114
|
+
### 安装
|
|
115
|
+
|
|
116
|
+
从 PyPI 安装到应用实际使用的 Python 环境:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python3 -m venv .venv
|
|
120
|
+
source .venv/bin/activate
|
|
121
|
+
python -m pip install linxsci==0.3.1
|
|
122
|
+
python -c "from linxsci import LinxSciClient; print('SDK import OK')"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Windows 使用 `py -3 -m venv .venv`,并在命令提示符 CMD 中运行 `.venv\Scripts\activate.bat`。从源码安装时,下载或克隆本仓库,在仓库根目录使用应用的 Python 环境执行 `python -m pip install .`。
|
|
126
|
+
|
|
127
|
+
### 使用 Python 配置与调用
|
|
128
|
+
|
|
129
|
+
下面的示例优先读取应用环境中的 Key,本地交互使用时也可隐藏输入:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
import os
|
|
133
|
+
from getpass import getpass
|
|
134
|
+
from linxsci import LinxSciClient, LinxSciError
|
|
135
|
+
|
|
136
|
+
client = LinxSciClient(
|
|
137
|
+
base_url=os.environ.get("LINXSCI_BASE_URL", "https://linxsci.com"),
|
|
138
|
+
api_key=os.environ.get("LINXSCI_OPENAPI_KEY") or getpass("请输入 LinxSci API Key:"),
|
|
139
|
+
timeout=60,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
try:
|
|
143
|
+
response = client.search("graph neural networks")
|
|
144
|
+
print(response.json())
|
|
145
|
+
except LinxSciError as error:
|
|
146
|
+
print(error.status, error.error_code)
|
|
147
|
+
print(error.request_id, error.framework_request_id)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
非交互应用通过部署环境或秘密管理器注入 Key。构造参数优先于环境变量、已有配置文件和发行默认地址。SDK 不会自动加载 `.env` 文件。同时传入 `base_url` 与 `api_key` 时跳过本地配置文件;构造客户端不会发送请求或保存 Key。
|
|
151
|
+
|
|
152
|
+
复用已配置的客户端读取论文或上传 PDF:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
paper_id = "<actual-returned-paper-id>"
|
|
156
|
+
print(client.paper(paper_id, "toc").json())
|
|
157
|
+
|
|
158
|
+
response = client.upload_pdf(
|
|
159
|
+
"/absolute/path/paper.pdf",
|
|
160
|
+
mineru_key=os.environ.get("LINXSCI_MINERU_API_KEY"),
|
|
161
|
+
)
|
|
162
|
+
print(response.json())
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
SDK 返回包含 HTTP 状态、响应头和原始 `body` 的 `Response`;JSON 使用 `.json()`,二进制内容直接保存 `body`。可选的 PDF Key 需要在 Python 中读取并显式传入。记录响应返回的实际任务 ID,用 `client.pdf_task(task_id)` 查询状态,确认完成后再调用 `client.pdf_task(task_id, result=True)`。详见 [SDK 方法、参数与错误处理](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/DEVELOPMENT.zh-CN.md)。
|
|
166
|
+
|
|
167
|
+
### 更新与卸载
|
|
168
|
+
|
|
169
|
+
PyPI 安装使用 `python -m pip install --upgrade linxsci` 更新。也可在应用环境中运行 `python -m pip install --upgrade /path/to/linxsci-<version>-py3-none-any.whl` 安装新版 wheel,或更新源码后运行 `python -m pip install --upgrade .`。升级后重启长期运行的 Python 进程。
|
|
170
|
+
|
|
171
|
+
使用 `python -c "from importlib.metadata import version; print(version('linxsci'))"` 检查已安装版本。卸载执行 `python -m pip uninstall linxsci`。删除安装包不会删除应用凭据或撤销 API Key。
|
|
172
|
+
|
|
173
|
+
## API 参考
|
|
174
|
+
|
|
175
|
+
POST 字段、分页及 PDF 任务状态应按所选接口的契约使用,保留返回的实际 ID 和请求追踪 ID。遇到 `-3905` 等执行或计费结果未确认的情况,先核查操作状态,再决定是否重复上传或创建任务。
|
|
176
|
+
|
|
177
|
+
详见 [HTTP 接口、认证与错误处理](https://github.com/LinxSci/linxsci-skills/blob/v0.3.1/docs/API.zh-CN.md)。各链接指南均可切换至英文版。
|