sciverse 0.5.1 → 0.5.3
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.
- package/README.md +6 -6
- package/dist/client.js +3 -3
- package/dist/tools.d.ts +3 -3
- package/dist/tools.js +3 -3
- package/dist/types.d.ts +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](#english) | [中文](#中文)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Sciverse open-platform TypeScript SDK for academic paper retrieval. Wraps five
|
|
6
6
|
retrieval tools (`searchPapers`, `semanticSearch`, `readContent`, `listCatalog`,
|
|
7
7
|
`getResource`) behind one fetch-based client + ready-to-use `OPENAI_TOOLS` /
|
|
8
8
|
`ANTHROPIC_TOOLS` constants for direct tool-calling.
|
|
@@ -120,13 +120,13 @@ see [`sciverse-mcp-server`](https://www.npmjs.com/package/sciverse-mcp-server).
|
|
|
120
120
|
|
|
121
121
|
### Error handling
|
|
122
122
|
|
|
123
|
-
Non-2xx responses throw `new Error("
|
|
123
|
+
Non-2xx responses throw `new Error("Sciverse API <status>: <body>")`:
|
|
124
124
|
|
|
125
125
|
```ts
|
|
126
126
|
try {
|
|
127
127
|
await c.searchPapers({ query: "x" });
|
|
128
128
|
} catch (e) {
|
|
129
|
-
console.error(e); // "
|
|
129
|
+
console.error(e); // "Sciverse API 401: {...}"
|
|
130
130
|
}
|
|
131
131
|
```
|
|
132
132
|
|
|
@@ -149,7 +149,7 @@ try {
|
|
|
149
149
|
|
|
150
150
|
## 中文
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
Sciverse 开放平台 TypeScript SDK,5 个学术文献检索 tool(结构化元数据、
|
|
153
153
|
语义检索、原文切片、字段 introspection、论文图片)。
|
|
154
154
|
|
|
155
155
|
### 安装
|
|
@@ -256,13 +256,13 @@ Claude Agent SDK / OpenAI Agents SDK 写法更简洁(agent loop 由框架处
|
|
|
256
256
|
|
|
257
257
|
### 错误处理
|
|
258
258
|
|
|
259
|
-
非 2xx 响应抛 `new Error("
|
|
259
|
+
非 2xx 响应抛 `new Error("Sciverse API <status>: <body>")`:
|
|
260
260
|
|
|
261
261
|
```ts
|
|
262
262
|
try {
|
|
263
263
|
await c.searchPapers({ query: "x" });
|
|
264
264
|
} catch (e) {
|
|
265
|
-
console.error(e); // "
|
|
265
|
+
console.error(e); // "Sciverse API 401: {...}"
|
|
266
266
|
}
|
|
267
267
|
```
|
|
268
268
|
|
package/dist/client.js
CHANGED
|
@@ -60,7 +60,7 @@ export class AgentToolsClient {
|
|
|
60
60
|
constructor(opts = {}) {
|
|
61
61
|
const token = resolveToken(opts.token);
|
|
62
62
|
if (!token) {
|
|
63
|
-
throw new Error("未找到
|
|
63
|
+
throw new Error("未找到 Sciverse API Token。请显式传 token、或设 SCIVERSE_API_TOKEN 环境变量、" +
|
|
64
64
|
"或运行 `pip install sciverse && sciverse auth login` 保存凭据到 ~/.sciverse/credentials.json。");
|
|
65
65
|
}
|
|
66
66
|
this.baseUrl = resolveEndpoint(opts.baseUrl).replace(/\/$/, "");
|
|
@@ -78,7 +78,7 @@ export class AgentToolsClient {
|
|
|
78
78
|
});
|
|
79
79
|
if (!res.ok) {
|
|
80
80
|
const body = await res.text();
|
|
81
|
-
throw new Error(`
|
|
81
|
+
throw new Error(`Sciverse API ${res.status}: ${body}`);
|
|
82
82
|
}
|
|
83
83
|
return (await res.json());
|
|
84
84
|
}
|
|
@@ -106,7 +106,7 @@ export class AgentToolsClient {
|
|
|
106
106
|
});
|
|
107
107
|
if (!res.ok) {
|
|
108
108
|
const body = await res.text();
|
|
109
|
-
throw new Error(`
|
|
109
|
+
throw new Error(`Sciverse API ${res.status}: ${body}`);
|
|
110
110
|
}
|
|
111
111
|
const mimeType = (res.headers.get("content-type") || "application/octet-stream").split(";")[0].trim();
|
|
112
112
|
const buf = new Uint8Array(await res.arrayBuffer());
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Auto-generated. Do not edit. Run scripts/build.sh. */
|
|
2
|
-
export declare const TOOLS_VERSION = "0.5.
|
|
2
|
+
export declare const TOOLS_VERSION = "0.5.3";
|
|
3
3
|
export declare const OPENAI_TOOLS: readonly [{
|
|
4
4
|
readonly type: "function";
|
|
5
5
|
readonly function: {
|
|
@@ -128,7 +128,7 @@ export declare const OPENAI_TOOLS: readonly [{
|
|
|
128
128
|
readonly type: "function";
|
|
129
129
|
readonly function: {
|
|
130
130
|
readonly name: "list_catalog";
|
|
131
|
-
readonly description: "返回 search_papers 所有可用字段的 catalog:字段名、类型、能否过滤/排序、\n是否默认返回、字段说明、FilterOperator 清单等。\n适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」\n「`metadata_type` 的合法取值是?」\n不适用:实际查询文献,那是 search_papers / semantic_search 的事。\n典型用法:Agent 第一次接触
|
|
131
|
+
readonly description: "返回 search_papers 所有可用字段的 catalog:字段名、类型、能否过滤/排序、\n是否默认返回、字段说明、FilterOperator 清单等。\n适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」\n「`metadata_type` 的合法取值是?」\n不适用:实际查询文献,那是 search_papers / semantic_search 的事。\n典型用法:Agent 第一次接触 Sciverse 或碰到模糊字段需求时先调一次本接口,\n把 schema 装进 working memory,后续精确构造 search_papers 的 filters。\ninclude_sample_values=true 时返回枚举值样本(OpenSearch terms agg,缓存 24h)。";
|
|
132
132
|
readonly parameters: {
|
|
133
133
|
readonly type: "object";
|
|
134
134
|
readonly properties: {
|
|
@@ -305,7 +305,7 @@ export declare const ANTHROPIC_TOOLS: readonly [{
|
|
|
305
305
|
};
|
|
306
306
|
}, {
|
|
307
307
|
readonly name: "list_catalog";
|
|
308
|
-
readonly description: "返回 search_papers 所有可用字段的 catalog:字段名、类型、能否过滤/排序、\n是否默认返回、字段说明、FilterOperator 清单等。\n适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」\n「`metadata_type` 的合法取值是?」\n不适用:实际查询文献,那是 search_papers / semantic_search 的事。\n典型用法:Agent 第一次接触
|
|
308
|
+
readonly description: "返回 search_papers 所有可用字段的 catalog:字段名、类型、能否过滤/排序、\n是否默认返回、字段说明、FilterOperator 清单等。\n适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」\n「`metadata_type` 的合法取值是?」\n不适用:实际查询文献,那是 search_papers / semantic_search 的事。\n典型用法:Agent 第一次接触 Sciverse 或碰到模糊字段需求时先调一次本接口,\n把 schema 装进 working memory,后续精确构造 search_papers 的 filters。\ninclude_sample_values=true 时返回枚举值样本(OpenSearch terms agg,缓存 24h)。";
|
|
309
309
|
readonly input_schema: {
|
|
310
310
|
readonly type: "object";
|
|
311
311
|
readonly properties: {
|
package/dist/tools.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Auto-generated. Do not edit. Run scripts/build.sh. */
|
|
2
|
-
export const TOOLS_VERSION = '0.5.
|
|
2
|
+
export const TOOLS_VERSION = '0.5.3';
|
|
3
3
|
export const OPENAI_TOOLS = [
|
|
4
4
|
{
|
|
5
5
|
"type": "function",
|
|
@@ -157,7 +157,7 @@ export const OPENAI_TOOLS = [
|
|
|
157
157
|
"type": "function",
|
|
158
158
|
"function": {
|
|
159
159
|
"name": "list_catalog",
|
|
160
|
-
"description": "返回 search_papers 所有可用字段的 catalog:字段名、类型、能否过滤/排序、\n是否默认返回、字段说明、FilterOperator 清单等。\n适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」\n「`metadata_type` 的合法取值是?」\n不适用:实际查询文献,那是 search_papers / semantic_search 的事。\n典型用法:Agent 第一次接触
|
|
160
|
+
"description": "返回 search_papers 所有可用字段的 catalog:字段名、类型、能否过滤/排序、\n是否默认返回、字段说明、FilterOperator 清单等。\n适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」\n「`metadata_type` 的合法取值是?」\n不适用:实际查询文献,那是 search_papers / semantic_search 的事。\n典型用法:Agent 第一次接触 Sciverse 或碰到模糊字段需求时先调一次本接口,\n把 schema 装进 working memory,后续精确构造 search_papers 的 filters。\ninclude_sample_values=true 时返回枚举值样本(OpenSearch terms agg,缓存 24h)。",
|
|
161
161
|
"parameters": {
|
|
162
162
|
"type": "object",
|
|
163
163
|
"properties": {
|
|
@@ -370,7 +370,7 @@ export const ANTHROPIC_TOOLS = [
|
|
|
370
370
|
},
|
|
371
371
|
{
|
|
372
372
|
"name": "list_catalog",
|
|
373
|
-
"description": "返回 search_papers 所有可用字段的 catalog:字段名、类型、能否过滤/排序、\n是否默认返回、字段说明、FilterOperator 清单等。\n适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」\n「`metadata_type` 的合法取值是?」\n不适用:实际查询文献,那是 search_papers / semantic_search 的事。\n典型用法:Agent 第一次接触
|
|
373
|
+
"description": "返回 search_papers 所有可用字段的 catalog:字段名、类型、能否过滤/排序、\n是否默认返回、字段说明、FilterOperator 清单等。\n适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」\n「`metadata_type` 的合法取值是?」\n不适用:实际查询文献,那是 search_papers / semantic_search 的事。\n典型用法:Agent 第一次接触 Sciverse 或碰到模糊字段需求时先调一次本接口,\n把 schema 装进 working memory,后续精确构造 search_papers 的 filters。\ninclude_sample_values=true 时返回枚举值样本(OpenSearch terms agg,缓存 24h)。",
|
|
374
374
|
"input_schema": {
|
|
375
375
|
"type": "object",
|
|
376
376
|
"properties": {
|
package/dist/types.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface paths {
|
|
|
32
32
|
* 适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」
|
|
33
33
|
* 「`metadata_type` 的合法取值是?」
|
|
34
34
|
* 不适用:实际查询文献,那是 search_papers / semantic_search 的事。
|
|
35
|
-
* 典型用法:Agent 第一次接触
|
|
35
|
+
* 典型用法:Agent 第一次接触 Sciverse 或碰到模糊字段需求时先调一次本接口,
|
|
36
36
|
* 把 schema 装进 working memory,后续精确构造 search_papers 的 filters。
|
|
37
37
|
* include_sample_values=true 时返回枚举值样本(OpenSearch terms agg,缓存 24h)。
|
|
38
38
|
*/
|
|
@@ -288,7 +288,7 @@ export interface operations {
|
|
|
288
288
|
* 适用:「我该用哪个字段过滤 DOI?」「access_oa_status 有哪些可能值?」
|
|
289
289
|
* 「`metadata_type` 的合法取值是?」
|
|
290
290
|
* 不适用:实际查询文献,那是 search_papers / semantic_search 的事。
|
|
291
|
-
* 典型用法:Agent 第一次接触
|
|
291
|
+
* 典型用法:Agent 第一次接触 Sciverse 或碰到模糊字段需求时先调一次本接口,
|
|
292
292
|
* 把 schema 装进 working memory,后续精确构造 search_papers 的 filters。
|
|
293
293
|
* include_sample_values=true 时返回枚举值样本(OpenSearch terms agg,缓存 24h)。
|
|
294
294
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sciverse",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.3",
|
|
4
|
+
"description": "Sciverse Agent Tools — OpenAI/Anthropic/LangChain compatible tool schema and async client for Sciverse retrieval APIs",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/opendatalab/Sciverse-Agent-Tools/tree/main/packages/typescript",
|
|
7
7
|
"repository": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/opendatalab/Sciverse-Agent-Tools/issues"
|
|
14
14
|
},
|
|
15
|
-
"author": "
|
|
15
|
+
"author": "Sciverse Platform Team",
|
|
16
16
|
"keywords": [
|
|
17
17
|
"sciverse",
|
|
18
18
|
"agent",
|