pubmed-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePubMed Search
PubMed文献搜索
Search the complete PubMed database of biomedical literature using natural language queries powered by Valyu's semantic search API.
借助Valyu的语义搜索API,使用自然语言查询搜索完整的PubMed生物医学文献数据库。
Why This Skill is Powerful
该搜索功能的强大特性
- No API Parameter Parsing: Just pass natural language queries directly - no need to construct complex search parameters
- Semantic Search: Understands the meaning of your query, not just keyword matching
- Full-Text Access: Returns complete article content, not just abstracts
- Image Links: Includes figures and images from papers
- Comprehensive Coverage: Access to all of PubMed's biomedical literature
- 无需解析API参数:直接传入自然语言查询即可,无需构建复杂的搜索参数
- 语义搜索:理解查询的含义,而非仅进行关键词匹配
- 全文访问:返回完整的文章内容,而非仅摘要
- 图片链接:包含论文中的图表和图片
- 全面覆盖:可访问PubMed的所有生物医学文献
Requirements
环境要求
- Node.js 18+ (uses built-in fetch)
- Valyu API key from https://platform.valyu.ai ($10 free credits)
- Node.js 18+(使用内置的fetch功能)
- 从https://platform.valyu.ai获取Valyu API密钥(赠送10美元免费额度)
CRITICAL: Script Path Resolution
重要提示:脚本路径解析
The commands in this documentation are relative to this skill's installation directory.
scripts/searchBefore running any command, locate the script using:
bash
PUBMED_SCRIPT=$(find ~/.claude/plugins/cache -name "search" -path "*/pubmed-search/*/scripts/*" -type f 2>/dev/null | head -1)Then use the full path for all commands:
bash
$PUBMED_SCRIPT "CRISPR gene editing" 15本文档中的命令是相对于该功能的安装目录的。
scripts/search运行任何命令前,请使用以下命令定位脚本:
bash
PUBMED_SCRIPT=$(find ~/.claude/plugins/cache -name "search" -path "*/pubmed-search/*/scripts/*" -type f 2>/dev/null | head -1)然后使用完整路径执行所有命令:
bash
$PUBMED_SCRIPT "CRISPR基因编辑" 15API Key Setup Flow
API密钥设置流程
When you run a search and receive , follow this flow:
"setup_required": true-
Ask the user for their API key: "To search PubMed, I need your Valyu API key. Get one free ($10 credits) at https://platform.valyu.ai"
-
Once the user provides the key, run:bash
scripts/search setup <api-key> -
Retry the original search.
当你执行搜索并收到的响应时,请按照以下步骤操作:
"setup_required": true-
向用户索要API密钥: "要搜索PubMed,我需要你的Valyu API密钥。可前往https://platform.valyu.ai免费获取(赠送10美元额度)"
-
用户提供密钥后,执行以下命令:bash
scripts/search setup <api-key> -
重新执行最初的搜索。
Example Flow:
示例流程:
User: Search PubMed for CAR-T cell therapy advances
→ Response: {"success": false, "setup_required": true, ...}
→ Claude asks: "Please provide your Valyu API key from https://platform.valyu.ai"
→ User: "val_abc123..."
→ Claude runs: scripts/search setup val_abc123...
→ Response: {"success": true, "type": "setup", ...}
→ Claude retries: scripts/search "CAR-T cell therapy advances" 10
→ Success!用户:搜索PubMed中关于CAR-T细胞疗法进展的内容
→ 响应:{"success": false, "setup_required": true, ...}
→ Claude询问:"请提供你从https://platform.valyu.ai获取的Valyu API密钥"
→ 用户:"val_abc123..."
→ Claude执行:scripts/search setup val_abc123...
→ 响应:{"success": true, "type": "setup", ...}
→ Claude重新执行:scripts/search "CAR-T细胞疗法进展" 10
→ 成功!Usage
使用方法
Basic Search
基础搜索
bash
scripts/search "your natural language query" [maxResults]bash
scripts/search "你的自然语言查询" [最大结果数]Examples
示例
bash
undefinedbash
undefinedSearch for recent COVID-19 research
搜索最新的COVID-19研究
scripts/search "COVID-19 vaccine efficacy studies" 15
scripts/search "COVID-19疫苗有效性研究" 15
Find papers on a specific gene
查找关于特定基因的论文
scripts/search "BRCA1 mutations and breast cancer risk" 20
scripts/search "BRCA1突变与乳腺癌风险" 20
Search for treatment approaches
搜索治疗方法
scripts/search "immunotherapy for melanoma clinical trials" 10
scripts/search "黑色素瘤免疫疗法临床试验" 10
Drug mechanism research
药物机制研究
scripts/search "mechanism of action of metformin in type 2 diabetes" 12
undefinedscripts/search "二甲双胍治疗2型糖尿病的作用机制" 12
undefinedSetup Command
设置命令
bash
scripts/search setup <api-key>bash
scripts/search setup <api-key>Output Format
输出格式
json
{
"success": true,
"type": "pubmed_search",
"query": "CRISPR gene editing",
"result_count": 10,
"results": [
{
"title": "Article Title",
"url": "https://pubmed.ncbi.nlm.nih.gov/...",
"content": "Full article text with figures...",
"source": "pubmed",
"relevance_score": 0.95,
"images": ["https://example.com/figure1.jpg"]
}
],
"cost": 0.025
}json
{
"success": true,
"type": "pubmed_search",
"query": "CRISPR基因编辑",
"result_count": 10,
"results": [
{
"title": "文章标题",
"url": "https://pubmed.ncbi.nlm.nih.gov/...",
"content": "包含图表的完整文章文本...",
"source": "pubmed",
"relevance_score": 0.95,
"images": ["https://example.com/figure1.jpg"]
}
],
"cost": 0.025
}Processing Results
结果处理
With jq
使用jq工具
bash
undefinedbash
undefinedGet article titles
获取文章标题
scripts/search "query" 10 | jq -r '.results[].title'
scripts/search "查询内容" 10 | jq -r '.results[].title'
Get URLs
获取链接地址
scripts/search "query" 10 | jq -r '.results[].url'
scripts/search "查询内容" 10 | jq -r '.results[].url'
Extract full content
提取全文内容
scripts/search "query" 10 | jq -r '.results[].content'
undefinedscripts/search "查询内容" 10 | jq -r '.results[].content'
undefinedCommon Use Cases
常见使用场景
Literature Review
文献综述
bash
undefinedbash
undefinedFind all papers on a topic
查找某一主题的所有论文
scripts/search "mechanisms of aging in humans" 50
undefinedscripts/search "人类衰老机制" 50
undefinedDrug Discovery
药物研发
bash
undefinedbash
undefinedSearch for drug targets
搜索药物靶点
scripts/search "novel targets for Alzheimer's disease treatment" 20
undefinedscripts/search "阿尔茨海默病治疗的新靶点" 20
undefinedClinical Research
临床研究
bash
undefinedbash
undefinedFind clinical trial results
查找临床试验结果
scripts/search "phase 3 trials for rheumatoid arthritis biologics" 15
undefinedscripts/search "类风湿关节炎生物制剂的3期临床试验" 15
undefinedGene Function
基因功能研究
bash
undefinedbash
undefinedResearch gene function
研究基因功能
scripts/search "role of TP53 in cancer development" 25
undefinedscripts/search "TP53在癌症发展中的作用" 25
undefinedError Handling
错误处理
All commands return JSON with field:
successjson
{
"success": false,
"error": "Error message"
}Exit codes:
- - Success
0 - - Error (check JSON for details)
1
所有命令都会返回包含字段的JSON:
successjson
{
"success": false,
"error": "错误信息"
}退出码:
- - 成功
0 - - 错误(查看JSON获取详细信息)
1
API Endpoint
API端点
- Base URL:
https://api.valyu.ai/v1 - Endpoint:
/search - Authentication: X-API-Key header
- 基础URL:
https://api.valyu.ai/v1 - 端点:
/search - 认证方式: X-API-Key请求头
Architecture
架构
scripts/
├── search # Bash wrapper
└── search.mjs # Node.js CLIDirect API calls using Node.js built-in , zero external dependencies.
fetch()scripts/
├── search # Bash包装器
└── search.mjs # Node.js命令行工具使用Node.js内置的直接调用API,无外部依赖。
fetch()Adding to Your Project
集成到你的项目中
If you're building an AI project and want to integrate PubMed search directly into your application, use the Valyu SDK:
如果你正在构建AI项目,并希望将PubMed搜索直接集成到你的应用中,可以使用Valyu SDK:
Python Integration
Python集成
python
from valyu import Valyu
client = Valyu(api_key="your-api-key")
response = client.search(
query="immunotherapy for melanoma",
included_sources=["valyu/valyu-pubmed"],
max_results=20
)
for result in response["results"]:
print(f"Title: {result['title']}")
print(f"URL: {result['url']}")
print(f"Content: {result['content'][:500]}...")python
from valyu import Valyu
client = Valyu(api_key="你的API密钥")
response = client.search(
query="黑色素瘤免疫疗法",
included_sources=["valyu/valyu-pubmed"],
max_results=20
)
for result in response["results"]:
print(f"标题: {result['title']}")
print(f"链接: {result['url']}")
print(f"内容: {result['content'][:500]}...")TypeScript Integration
TypeScript集成
typescript
import { Valyu } from "valyu-js";
const client = new Valyu("your-api-key");
const response = await client.search({
query: "immunotherapy for melanoma",
includedSources: ["valyu/valyu-pubmed"],
maxResults: 20
});
response.results.forEach((result) => {
console.log(`Title: ${result.title}`);
console.log(`URL: ${result.url}`);
console.log(`Content: ${result.content.substring(0, 500)}...`);
});See the Valyu docs for full integration examples and SDK reference.
typescript
import { Valyu } from "valyu-js";
const client = new Valyu("你的API密钥");
const response = await client.search({
query: "黑色素瘤免疫疗法",
includedSources: ["valyu/valyu-pubmed"],
maxResults: 20
});
response.results.forEach((result) => {
console.log(`标题: ${result.title}`);
console.log(`链接: ${result.url}`);
console.log(`内容: ${result.content.substring(0, 500)}...`);
});如需完整的集成示例和SDK参考文档,请查看Valyu文档。