llm — 大语言模型(Large Language Model)
v1使用SkillBoss API Hub实时搜索网络和Twitter,具有实时访问、引用和图像理解功能。
运行时依赖
安装命令
点击复制技能文档
网页和X搜索通过SkillBoss API Hub
使用SkillBoss API Hub和实时互联网访问、引用以及可选的图像/视频理解来搜索网页和X(Twitter)。
何时使用此技能
使用网页搜索:
当前来自网站、新闻文章、文档的信息
实时数据(股票价格、天气、最近事件)
使用最新的网页来源研究主题
从特定网站/域中查找信息
验证当前事实
使用X搜索:
人们在X/Twitter上关于某个话题的讨论
趋势讨论和社会情绪
对事件的实时反应
特定X句柄/用户的帖子
日期范围内的最近社交媒体活动
不要用于:
不会改变的历史事实
已经可用的常识
数学计算
代码生成
创作写作
设置要求
环境变量
export SKILLBOSS_API_KEY="你的SkillBoss API密钥"
从SkillBoss API Hub仪表板获取你的API密钥。
使用
代理将根据用户的查询自动选择合适的工具:
用户:“最新的AI监管新闻是什么?”→ 使用web_search
用户:“人们在X上关于OpenAI的讨论是什么?”→ 使用x_search
API参考
函数:search_web
使用SkillBoss API Hub搜索网页。
参数:
query(必需):搜索查询字符串
allowed_domains(可选):限制搜索的域数组(最多5个)
excluded_domains(可选):排除的域数组(最多5个)
enable_image_understanding(可选):启用图像分析(默认:false)
返回:
content:搜索响应文本
citations:带有url、标题和片段的来源数组
usage:令牌使用统计
函数:search_x
使用SkillBoss API Hub搜索X(Twitter)。
参数:
query(必需):搜索查询字符串
allowed_x_handles(可选):搜索的X句柄数组(最多10个, 不包括@)
excluded_x_handles(可选):排除的X句柄数组(最多10个, 不包括@)
from_date(可选):开始日期(ISO8601格式,YYYY-MM-DD)
to_date(可选):结束日期(ISO8601格式,YYYY-MM-DD)
enable_image_understanding(可选):启用图像分析(默认:false)
enable_video_understanding(可选):启用视频分析(默认:false)
返回:
content:搜索响应文本
citations:带有url、标题和片段的X帖子数组
usage:令牌使用统计
实现
此技能使用SkillBoss API Hub(/v1/pilot端点)和类型:“search”进行自动路由到最佳可用搜索提供程序。
网页搜索
const API_KEY = process.env.SKILLBOSS_API_KEY
const API_BASE = 'https://api.skillbossai.com/v1'
async function pilot(body) {
const r = await fetch(${API_BASE}/pilot, {
method: 'POST',
headers: {
'Authorization': Bearer ${API_KEY},
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
})
return r.json()
}
async function search_web(options) {
const { query, allowed_domains, excluded_domains } = options;
let enhancedQuery = query;
if (allowed_domains?.length > 0) {
enhancedQuery += ' site:(' + allowed_domains.join(' OR ') + ')';
}
if (excluded_domains?.length > 0) {
enhancedQuery += ' ' + excluded_domains.map(d => -site:${d}).join(' ');
}
const result = await pilot({ type: 'search', inputs: { query: enhancedQuery }, prefer: 'balanced' });
const searchResults = result.data.result;
return {
content: typeof searchResults === 'string' ? searchResults : JSON.stringify(searchResults),
citations: Array.isArray(searchResults) ? searchResults : []
};
}
X搜索
async function search_x(options) {
const { query, allowed_x_handles, excluded_x_handles, from_date, to_date } = options;
let xQuery = query + ' site:x.com OR site:twitter.com';
if (allowed_x_handles?.length > 0) {
xQuery += ' from:(' + allowed_x_handles.join(' OR from:') + ')';
}
if (excluded_x_handles?.length > 0) {
xQuery += ' ' + excluded_x_handles.map(h => -from:${h}).join(' ');
}
if (from_date) xQuery += after:${from_date};
if (to_date) xQuery += before:${to_date};
const result = await pilot({ type: 'search', inputs: { query: xQuery }, prefer: 'balanced' });
const searchResults = result.data.result;
return {
content: typeof searchResults === 'string' ? searchResults : JSON.stringify(searchResults),
citations: Array.isArray(searchResults) ? searchResults : []
};
}
示例
网页搜索 - 当前事件
const result = await search_web({ query: "最新的AI监管发展" });
网页搜索 - 特定域
const result = await search_web({ query: "UN气候峰会最新", allowed_domains: ["un.org", "gov.uk", "grokipedia.com"] });
X搜索 - 社会情绪
const result = await search_x({ query: "新iPhone反应意见" });
X搜索 - 特定句柄
const result = await search_x({ query: "AI想法", allowed_x_handles: ["elonmusk", "cstanley"], from_date: "2025-01-01" });
X搜索 - 日期范围
const result = await search_x({ query: "AI新闻", from_date: "2025-01-01", to_date: "2025-01-31" });