sciverse 0.3.0
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 +282 -0
- package/dist/client.d.ts +37 -0
- package/dist/client.js +124 -0
- package/dist/credentials.d.ts +10 -0
- package/dist/credentials.js +53 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/tools.d.ts +357 -0
- package/dist/tools.js +429 -0
- package/dist/types.d.ts +370 -0
- package/dist/types.js +5 -0
- package/package.json +52 -0
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/** Auto-generated. Do not edit. Run scripts/build.sh. */
|
|
2
|
+
export declare const TOOLS_VERSION = "0.3.0";
|
|
3
|
+
export declare const OPENAI_TOOLS: readonly [{
|
|
4
|
+
readonly type: "function";
|
|
5
|
+
readonly function: {
|
|
6
|
+
readonly name: "search_papers";
|
|
7
|
+
readonly description: "按结构化条件检索学术文献元数据(标题、作者、期刊、年份、摘要等)。\n适用:「查找 Hinton 在 2020-2023 年发表的论文」「找 Nature 上关于 CRISPR 的近期文献」。\n不适用:自然语言问答检索 → 用 semantic_search;查全文片段 → 用 read_content。\n返回:论文元数据列表,每条含 doc_id、title、author、abstract、publication_venue_name、publication_published_year 等。";
|
|
8
|
+
readonly parameters: {
|
|
9
|
+
readonly type: "object";
|
|
10
|
+
readonly properties: {
|
|
11
|
+
readonly query: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "BM25 全文关键词,匹配标题/摘要/期刊名/关键词字段。留空则纯靠结构化过滤。";
|
|
14
|
+
};
|
|
15
|
+
readonly title_contains: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly description: "标题中必须包含的词(仅匹配 title 字段)。";
|
|
18
|
+
};
|
|
19
|
+
readonly abstract_contains: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly description: "摘要中必须包含的词(仅匹配 abstract 字段)。";
|
|
22
|
+
};
|
|
23
|
+
readonly authors: {
|
|
24
|
+
readonly type: "array";
|
|
25
|
+
readonly items: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
};
|
|
28
|
+
readonly description: "作者名(任一命中即可)。SDK 内部映射到后端 `author` 字段(FILTER_OP_IN)。";
|
|
29
|
+
};
|
|
30
|
+
readonly year_from: {
|
|
31
|
+
readonly type: "integer";
|
|
32
|
+
readonly description: "起始发表年(含)。";
|
|
33
|
+
};
|
|
34
|
+
readonly year_to: {
|
|
35
|
+
readonly type: "integer";
|
|
36
|
+
readonly description: "结束发表年(含)。";
|
|
37
|
+
};
|
|
38
|
+
readonly journals: {
|
|
39
|
+
readonly type: "array";
|
|
40
|
+
readonly items: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
};
|
|
43
|
+
readonly description: "期刊名(任一命中即可)。SDK 内部映射到后端 `publication_venue_name` 字段(FILTER_OP_IN)。";
|
|
44
|
+
};
|
|
45
|
+
readonly subjects: {
|
|
46
|
+
readonly type: "array";
|
|
47
|
+
readonly items: {
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
};
|
|
50
|
+
readonly description: "学科分类,如 \"computer science\"、\"biology\"。";
|
|
51
|
+
};
|
|
52
|
+
readonly filters_advanced: {
|
|
53
|
+
readonly type: "array";
|
|
54
|
+
readonly description: "高级过滤逃生舱(仅当上述字段不够用时使用)。";
|
|
55
|
+
readonly items: {
|
|
56
|
+
readonly type: "object";
|
|
57
|
+
readonly required: readonly ["field", "value"];
|
|
58
|
+
readonly properties: {
|
|
59
|
+
readonly field: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
};
|
|
62
|
+
readonly operator: {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly enum: readonly ["FILTER_OP_EQ", "FILTER_OP_NE", "FILTER_OP_GT", "FILTER_OP_GTE", "FILTER_OP_LT", "FILTER_OP_LTE", "FILTER_OP_IN", "FILTER_OP_NIN", "FILTER_OP_CONTAINS"];
|
|
65
|
+
readonly default: "FILTER_OP_EQ";
|
|
66
|
+
};
|
|
67
|
+
readonly value: {};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
readonly sort_by_year: {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
readonly enum: readonly ["desc", "asc", "none"];
|
|
74
|
+
readonly default: "desc";
|
|
75
|
+
};
|
|
76
|
+
readonly page: {
|
|
77
|
+
readonly type: "integer";
|
|
78
|
+
readonly default: 1;
|
|
79
|
+
readonly minimum: 1;
|
|
80
|
+
};
|
|
81
|
+
readonly page_size: {
|
|
82
|
+
readonly type: "integer";
|
|
83
|
+
readonly default: 10;
|
|
84
|
+
readonly minimum: 1;
|
|
85
|
+
readonly maximum: 50;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
readonly type: "function";
|
|
92
|
+
readonly function: {
|
|
93
|
+
readonly name: "semantic_search";
|
|
94
|
+
readonly description: "自然语言语义检索,返回相关文献片段(chunk)用于 RAG 回答。\n适用:「Transformer 注意力机制如何工作?」「最新的蛋白质折叠预测方法有哪些?」\n不适用:精确字段过滤 → search_papers;取完整原文 → read_content。\n返回:相关 chunk 列表,每条含 chunk_id/doc_id/abstract/chunk/score/title/offset。\n典型链路:semantic_search → 选取 chunk → read_content(doc_id, offset)。";
|
|
95
|
+
readonly parameters: {
|
|
96
|
+
readonly type: "object";
|
|
97
|
+
readonly required: readonly ["query"];
|
|
98
|
+
readonly properties: {
|
|
99
|
+
readonly query: {
|
|
100
|
+
readonly type: "string";
|
|
101
|
+
readonly minLength: 1;
|
|
102
|
+
readonly maxLength: 4096;
|
|
103
|
+
readonly description: "自然语言查询,1-200 字最佳。";
|
|
104
|
+
};
|
|
105
|
+
readonly top_k: {
|
|
106
|
+
readonly type: "integer";
|
|
107
|
+
readonly default: 10;
|
|
108
|
+
readonly minimum: 1;
|
|
109
|
+
readonly maximum: 30;
|
|
110
|
+
};
|
|
111
|
+
readonly source_types: {
|
|
112
|
+
readonly type: "array";
|
|
113
|
+
readonly items: {
|
|
114
|
+
readonly type: "string";
|
|
115
|
+
readonly enum: readonly ["web", "pdf"];
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly mode: {
|
|
119
|
+
readonly type: "string";
|
|
120
|
+
readonly enum: readonly ["fast", "balanced", "quality"];
|
|
121
|
+
readonly default: "balanced";
|
|
122
|
+
readonly description: "fast = 仅关键词召回 (~200ms);balanced = 混合检索 (~600ms);quality = LLM 改写 + 混合 (~2-4s)。\n";
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
}, {
|
|
128
|
+
readonly type: "function";
|
|
129
|
+
readonly function: {
|
|
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 第一次接触 SciVerse 或碰到模糊字段需求时先调一次本接口,\n把 schema 装进 working memory,后续精确构造 search_papers 的 filters。\ninclude_sample_values=true 时返回枚举值样本(OpenSearch terms agg,缓存 24h)。";
|
|
132
|
+
readonly parameters: {
|
|
133
|
+
readonly type: "object";
|
|
134
|
+
readonly properties: {
|
|
135
|
+
readonly include_sample_values: {
|
|
136
|
+
readonly type: "boolean";
|
|
137
|
+
readonly default: false;
|
|
138
|
+
readonly description: "是否拉取 enum-like 字段的取值样本。false 仅返回静态 schema(毫秒级);true 触发 OpenSearch terms agg(首次几百毫秒,之后 24h 走缓存)。";
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
readonly required: readonly [];
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
}, {
|
|
145
|
+
readonly type: "function";
|
|
146
|
+
readonly function: {
|
|
147
|
+
readonly name: "read_content";
|
|
148
|
+
readonly description: "按字节区间读取文献原文片段。通常配合 semantic_search 返回的 doc_id/offset 使用,\n用于扩展上下文(往前/往后读更多字节)。\n返回:UTF-8 文本片段、bytes_returned、next_offset、是否还有后续。";
|
|
149
|
+
readonly parameters: {
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly properties: {
|
|
152
|
+
readonly doc_id: {
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
readonly description: "文献 ID(来自 search_papers / semantic_search)。";
|
|
155
|
+
};
|
|
156
|
+
readonly offset: {
|
|
157
|
+
readonly type: "integer";
|
|
158
|
+
readonly format: "int64";
|
|
159
|
+
readonly default: 0;
|
|
160
|
+
};
|
|
161
|
+
readonly limit: {
|
|
162
|
+
readonly type: "integer";
|
|
163
|
+
readonly format: "int64";
|
|
164
|
+
readonly default: 4096;
|
|
165
|
+
readonly maximum: 16384;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
readonly required: readonly ["doc_id"];
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
}, {
|
|
172
|
+
readonly type: "function";
|
|
173
|
+
readonly function: {
|
|
174
|
+
readonly name: "get_resource";
|
|
175
|
+
readonly description: "按文件名取文献中嵌入的图片字节流(PNG / JPG 等)。\n触发场景:read_content 返回的 Markdown 中含 `` 形式的图片占位,\nagent 需要把图给用户看时调本接口。\n入参 file_name 来自 markdown 内的 url 段(相对路径,禁止 `\\\\` 或 `..`)。\n返回:HTTP 二进制流 + image/* Content-Type。\nSDK / MCP server 包装层会做 base64 + mime 转换以便 agent 多模态使用。";
|
|
176
|
+
readonly parameters: {
|
|
177
|
+
readonly type: "object";
|
|
178
|
+
readonly properties: {
|
|
179
|
+
readonly file_name: {
|
|
180
|
+
readonly type: "string";
|
|
181
|
+
readonly description: "图片相对路径,来自 read_content Markdown 中的 `` 占位。禁止 `\\\\` 与 `..`,不能以 `/` 开头。";
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
readonly required: readonly ["file_name"];
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
}];
|
|
188
|
+
export declare const ANTHROPIC_TOOLS: readonly [{
|
|
189
|
+
readonly name: "search_papers";
|
|
190
|
+
readonly description: "按结构化条件检索学术文献元数据(标题、作者、期刊、年份、摘要等)。\n适用:「查找 Hinton 在 2020-2023 年发表的论文」「找 Nature 上关于 CRISPR 的近期文献」。\n不适用:自然语言问答检索 → 用 semantic_search;查全文片段 → 用 read_content。\n返回:论文元数据列表,每条含 doc_id、title、author、abstract、publication_venue_name、publication_published_year 等。";
|
|
191
|
+
readonly input_schema: {
|
|
192
|
+
readonly type: "object";
|
|
193
|
+
readonly properties: {
|
|
194
|
+
readonly query: {
|
|
195
|
+
readonly type: "string";
|
|
196
|
+
readonly description: "BM25 全文关键词,匹配标题/摘要/期刊名/关键词字段。留空则纯靠结构化过滤。";
|
|
197
|
+
};
|
|
198
|
+
readonly title_contains: {
|
|
199
|
+
readonly type: "string";
|
|
200
|
+
readonly description: "标题中必须包含的词(仅匹配 title 字段)。";
|
|
201
|
+
};
|
|
202
|
+
readonly abstract_contains: {
|
|
203
|
+
readonly type: "string";
|
|
204
|
+
readonly description: "摘要中必须包含的词(仅匹配 abstract 字段)。";
|
|
205
|
+
};
|
|
206
|
+
readonly authors: {
|
|
207
|
+
readonly type: "array";
|
|
208
|
+
readonly items: {
|
|
209
|
+
readonly type: "string";
|
|
210
|
+
};
|
|
211
|
+
readonly description: "作者名(任一命中即可)。SDK 内部映射到后端 `author` 字段(FILTER_OP_IN)。";
|
|
212
|
+
};
|
|
213
|
+
readonly year_from: {
|
|
214
|
+
readonly type: "integer";
|
|
215
|
+
readonly description: "起始发表年(含)。";
|
|
216
|
+
};
|
|
217
|
+
readonly year_to: {
|
|
218
|
+
readonly type: "integer";
|
|
219
|
+
readonly description: "结束发表年(含)。";
|
|
220
|
+
};
|
|
221
|
+
readonly journals: {
|
|
222
|
+
readonly type: "array";
|
|
223
|
+
readonly items: {
|
|
224
|
+
readonly type: "string";
|
|
225
|
+
};
|
|
226
|
+
readonly description: "期刊名(任一命中即可)。SDK 内部映射到后端 `publication_venue_name` 字段(FILTER_OP_IN)。";
|
|
227
|
+
};
|
|
228
|
+
readonly subjects: {
|
|
229
|
+
readonly type: "array";
|
|
230
|
+
readonly items: {
|
|
231
|
+
readonly type: "string";
|
|
232
|
+
};
|
|
233
|
+
readonly description: "学科分类,如 \"computer science\"、\"biology\"。";
|
|
234
|
+
};
|
|
235
|
+
readonly filters_advanced: {
|
|
236
|
+
readonly type: "array";
|
|
237
|
+
readonly description: "高级过滤逃生舱(仅当上述字段不够用时使用)。";
|
|
238
|
+
readonly items: {
|
|
239
|
+
readonly type: "object";
|
|
240
|
+
readonly required: readonly ["field", "value"];
|
|
241
|
+
readonly properties: {
|
|
242
|
+
readonly field: {
|
|
243
|
+
readonly type: "string";
|
|
244
|
+
};
|
|
245
|
+
readonly operator: {
|
|
246
|
+
readonly type: "string";
|
|
247
|
+
readonly enum: readonly ["FILTER_OP_EQ", "FILTER_OP_NE", "FILTER_OP_GT", "FILTER_OP_GTE", "FILTER_OP_LT", "FILTER_OP_LTE", "FILTER_OP_IN", "FILTER_OP_NIN", "FILTER_OP_CONTAINS"];
|
|
248
|
+
readonly default: "FILTER_OP_EQ";
|
|
249
|
+
};
|
|
250
|
+
readonly value: {};
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
readonly sort_by_year: {
|
|
255
|
+
readonly type: "string";
|
|
256
|
+
readonly enum: readonly ["desc", "asc", "none"];
|
|
257
|
+
readonly default: "desc";
|
|
258
|
+
};
|
|
259
|
+
readonly page: {
|
|
260
|
+
readonly type: "integer";
|
|
261
|
+
readonly default: 1;
|
|
262
|
+
readonly minimum: 1;
|
|
263
|
+
};
|
|
264
|
+
readonly page_size: {
|
|
265
|
+
readonly type: "integer";
|
|
266
|
+
readonly default: 10;
|
|
267
|
+
readonly minimum: 1;
|
|
268
|
+
readonly maximum: 50;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
}, {
|
|
273
|
+
readonly name: "semantic_search";
|
|
274
|
+
readonly description: "自然语言语义检索,返回相关文献片段(chunk)用于 RAG 回答。\n适用:「Transformer 注意力机制如何工作?」「最新的蛋白质折叠预测方法有哪些?」\n不适用:精确字段过滤 → search_papers;取完整原文 → read_content。\n返回:相关 chunk 列表,每条含 chunk_id/doc_id/abstract/chunk/score/title/offset。\n典型链路:semantic_search → 选取 chunk → read_content(doc_id, offset)。";
|
|
275
|
+
readonly input_schema: {
|
|
276
|
+
readonly type: "object";
|
|
277
|
+
readonly required: readonly ["query"];
|
|
278
|
+
readonly properties: {
|
|
279
|
+
readonly query: {
|
|
280
|
+
readonly type: "string";
|
|
281
|
+
readonly minLength: 1;
|
|
282
|
+
readonly maxLength: 4096;
|
|
283
|
+
readonly description: "自然语言查询,1-200 字最佳。";
|
|
284
|
+
};
|
|
285
|
+
readonly top_k: {
|
|
286
|
+
readonly type: "integer";
|
|
287
|
+
readonly default: 10;
|
|
288
|
+
readonly minimum: 1;
|
|
289
|
+
readonly maximum: 30;
|
|
290
|
+
};
|
|
291
|
+
readonly source_types: {
|
|
292
|
+
readonly type: "array";
|
|
293
|
+
readonly items: {
|
|
294
|
+
readonly type: "string";
|
|
295
|
+
readonly enum: readonly ["web", "pdf"];
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
readonly mode: {
|
|
299
|
+
readonly type: "string";
|
|
300
|
+
readonly enum: readonly ["fast", "balanced", "quality"];
|
|
301
|
+
readonly default: "balanced";
|
|
302
|
+
readonly description: "fast = 仅关键词召回 (~200ms);balanced = 混合检索 (~600ms);quality = LLM 改写 + 混合 (~2-4s)。\n";
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
}, {
|
|
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 第一次接触 SciVerse 或碰到模糊字段需求时先调一次本接口,\n把 schema 装进 working memory,后续精确构造 search_papers 的 filters。\ninclude_sample_values=true 时返回枚举值样本(OpenSearch terms agg,缓存 24h)。";
|
|
309
|
+
readonly input_schema: {
|
|
310
|
+
readonly type: "object";
|
|
311
|
+
readonly properties: {
|
|
312
|
+
readonly include_sample_values: {
|
|
313
|
+
readonly type: "boolean";
|
|
314
|
+
readonly default: false;
|
|
315
|
+
readonly description: "是否拉取 enum-like 字段的取值样本。false 仅返回静态 schema(毫秒级);true 触发 OpenSearch terms agg(首次几百毫秒,之后 24h 走缓存)。";
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
readonly required: readonly [];
|
|
319
|
+
};
|
|
320
|
+
}, {
|
|
321
|
+
readonly name: "read_content";
|
|
322
|
+
readonly description: "按字节区间读取文献原文片段。通常配合 semantic_search 返回的 doc_id/offset 使用,\n用于扩展上下文(往前/往后读更多字节)。\n返回:UTF-8 文本片段、bytes_returned、next_offset、是否还有后续。";
|
|
323
|
+
readonly input_schema: {
|
|
324
|
+
readonly type: "object";
|
|
325
|
+
readonly properties: {
|
|
326
|
+
readonly doc_id: {
|
|
327
|
+
readonly type: "string";
|
|
328
|
+
readonly description: "文献 ID(来自 search_papers / semantic_search)。";
|
|
329
|
+
};
|
|
330
|
+
readonly offset: {
|
|
331
|
+
readonly type: "integer";
|
|
332
|
+
readonly format: "int64";
|
|
333
|
+
readonly default: 0;
|
|
334
|
+
};
|
|
335
|
+
readonly limit: {
|
|
336
|
+
readonly type: "integer";
|
|
337
|
+
readonly format: "int64";
|
|
338
|
+
readonly default: 4096;
|
|
339
|
+
readonly maximum: 16384;
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
readonly required: readonly ["doc_id"];
|
|
343
|
+
};
|
|
344
|
+
}, {
|
|
345
|
+
readonly name: "get_resource";
|
|
346
|
+
readonly description: "按文件名取文献中嵌入的图片字节流(PNG / JPG 等)。\n触发场景:read_content 返回的 Markdown 中含 `` 形式的图片占位,\nagent 需要把图给用户看时调本接口。\n入参 file_name 来自 markdown 内的 url 段(相对路径,禁止 `\\\\` 或 `..`)。\n返回:HTTP 二进制流 + image/* Content-Type。\nSDK / MCP server 包装层会做 base64 + mime 转换以便 agent 多模态使用。";
|
|
347
|
+
readonly input_schema: {
|
|
348
|
+
readonly type: "object";
|
|
349
|
+
readonly properties: {
|
|
350
|
+
readonly file_name: {
|
|
351
|
+
readonly type: "string";
|
|
352
|
+
readonly description: "图片相对路径,来自 read_content Markdown 中的 `` 占位。禁止 `\\\\` 与 `..`,不能以 `/` 开头。";
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
readonly required: readonly ["file_name"];
|
|
356
|
+
};
|
|
357
|
+
}];
|