10-of-my-most-popular-text-to-image-series-prompts-78b0897e
generate a bunch of images, then you curate the results to handpick the best ones
Auto retry & fix LLM tool calls with exponential backoff, format validation, error correction, boost tool call success rate by 90%
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
SkillHub CLI
skillhub install ayalili/tool-call-retryInspect the source and compatibility requirements, then follow its installation steps.
Give your agent the source link and ask it to inspect instructions and dependencies before explaining the installation steps.
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| toolFn | Function | 是 | - | 要执行的工具函数,返回Promise |
| args | any | 否 | {} | 调用工具的参数 |
| maxRetries | number | 否 | 3 | 最大重试次数,1-10 |
| initialDelayMs | number | 否 | 1000 | 初始重试延迟,100-10000ms |
| validatorFn | Function | 否 | ()=>true | 结果校验函数,返回true表示结果合法 |
| errorHandlerFn | Function | 否 | undefined | 错误处理函数,可返回修复后的参数或中止重试 |
| idempotencyKey | string | 否 | undefined | 幂等性键,相同键的调用只会执行一次 |
const fetchWeather = async (params: { city: string }) => {
const res = await fetch(`https://api.weather.com/${params.city}`);
return res.json();
};
const result = await skills.toolCallRetry({
toolFn: fetchWeather,
args: { city: "Beijing" }
});
const result = await skills.toolCallRetry({
toolFn: callLLM,
args: { prompt: "Generate JSON output" },
validatorFn: (res) => typeof res === "object" && res !== null && res.code === 0,
maxRetries: 5
});
const result = await skills.toolCallRetry({
toolFn: callDatabase,
args: { sql: "SELECT * FROM users" },
errorHandlerFn: async (error, attempt) => {
if (error.message.includes("SQL syntax error")) {
// 自动修复SQL语法
const fixedSql = await fixSqlWithLLM(error.message);
return { args: { sql: fi...
These signals come from indexed source analysis and may lag behind changes. Check the current source files.
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| toolFn | Function | 是 | - | 要执行的工具函数,返回Promise |
| args | any | 否 | {} | 调用工具的参数 |
| maxRetries | number | 否 | 3 | 最大重试次数,1-10 |
| initialDelayMs | number | 否 | 1000 | 初始重试延迟,100-10000ms |
| validatorFn | Function | 否 | ()=>true | 结果校验函数,返回true表示结果合法 |
| errorHandlerFn | Function | 否 | undefined | 错误处理函数,可返回修复后的参数或中止重试 |
| idempotencyKey | string | 否 | undefined | 幂等性键,相同键的调用只会执行一次 |
const fetchWeather = async (params: { city: string }) => {
const res = await fetch(`https://api.weather.com/${params.city}`);
return res.json();
};
const result = await skills.toolCallRetry({
toolFn: fetchWeather,
args: { city: "Beijing" }
});
const result = await skills.toolCallRetry({
toolFn: callLLM,
args: { prompt: "Generate JSON output" },
validatorFn: (res) => typeof res === "object" && res !== null && res.code === 0,
maxRetries: 5
});
const result = await skills.toolCallRetry({
toolFn: callDatabase,
args: { sql: "SELECT * FROM users" },
errorHandlerFn: async (error, attempt) => {
if (error.message.includes("SQL syntax error")) {
// 自动修复SQL语法
const fixedSql = await fixSqlWithLLM(error.message);
return { args: { sql: fi...
# 🔥 工具调用自动重试器
## 核心亮点
1. ✅ **成功率提升90%+**:内置指数退避重试、格式校验、错误自动修复,解决Agent工具调用不稳定的核心痛点
2. 🛡️ **全链路异常兜底**:自定义错误处理、参数修复逻辑,支持复杂场景下的错误自愈
3. ⚡ **零侵入增强**:无需修改原有工具代码,一行封装即可获得重试能力,性能开销<1ms
4. 🔑 **幂等性保证**:支持幂等性键,避免重复调用导致的副作用
## 🎯 适用场景
- 所有调用外部API/工具的Agent场景
- 不稳定的第三方服务调用
- 大模型工具调用格式错误自动修复
- 高可靠性要求的Agent执行链路
## 📝 参数说明
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|------|------|------|--------|------|
| toolFn | Function | 是 | - | 要执行的工具函数,返回Promise |
| args | any | 否 | {} | 调用工具的参数 |
| maxRetries | number | 否 | 3 | 最大重试次数,1-10 |
| initialDelayMs | number | 否 | 1000 | 初始重试延迟,100-10000ms |
| validatorFn | Function | 否 | ()=>true | 结果校验函数,返回true表示结果合法 |
| errorHandlerFn | Function | 否 | undefined | 错误处理函数,可返回修复后的参数或中止重试 |
| idempotencyKey | string | 否 | undefined | 幂等性键,相同键的调用只会执行一次 |
## 💡 开箱即用示例
### 基础用法(零配置)
```typescript
const fetchWeather = async (params: { city: string }) => {
const res = await fetch(`https://api.weather.com/${params.city}`);
return res.json();
};
const result = await skills.toolCallRetry({
toolFn: fetchWeather,
args: { city: "Beijing" }
});
```
### 带结果校验
```typescript
const result = await skills.toolCallRetry({
toolFn: callLLM,
args: { prompt: "Generate JSON output" },
validatorFn: (res) => typeof res === "object" && res !== null && res.code === 0,
maxRetries: 5
});
```
### 高级用法(错误自动修复)
```typescript
const result = await skills.toolCallRetry({
toolFn: callDatabase,
args: { sql: "SELECT * FROM users" },
errorHandlerFn: async (error, attempt) => {
if (error.message.includes("SQL syntax error")) {
// 自动修复SQL语法
const fixedSql = await fixSqlWithLLM(error.message);
return { args: { sql: fi...# 🔥 工具调用自动重试器
## 核心亮点
1. ✅ **成功率提升90%+**:内置指数退避重试、格式校验、错误自动修复,解决Agent工具调用不稳定的核心痛点
2. 🛡️ **全链路异常兜底**:自定义错误处理、参数修复逻辑,支持复杂场景下的错误自愈
3. ⚡ **零侵入增强**:无需修改原有工具代码,一行封装即可获得重试能力,性能开销<1ms
4. 🔑 **幂等性保证**:支持幂等性键,避免重复调用导致的副作用
## 🎯 适用场景
- 所有调用外部API/工具的Agent场景
- 不稳定的第三方服务调用
- 大模型工具调用格式错误自动修复
- 高可靠性要求的Agent执行链路
## 📝 参数说明
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|------|------|------|--------|------|
| toolFn | Function | 是 | - | 要执行的工具函数,返回Promise |
| args | any | 否 | {} | 调用工具的参数 |
| maxRetries | number | 否 | 3 | 最大重试次数,1-10 |
| initialDelayMs | number | 否 | 1000 | 初始重试延迟,100-10000ms |
| validatorFn | Function | 否 | ()=>true | 结果校验函数,返回true表示结果合法 |
| errorHandlerFn | Function | 否 | undefined | 错误处理函数,可返回修复后的参数或中止重试 |
| idempotencyKey | string | 否 | undefined | 幂等性键,相同键的调用只会执行一次 |
## 💡 开箱即用示例
### 基础用法(零配置)
```typescript
const fetchWeather = async (params: { city: string }) => {
const res = await fetch(`https://api.weather.com/${params.city}`);
return res.json();
};
const result = await skills.toolCallRetry({
toolFn: fetchWeather,
args: { city: "Beijing" }
});
```
### 带结果校验
```typescript
const result = await skills.toolCallRetry({
toolFn: callLLM,
args: { prompt: "Generate JSON output" },
validatorFn: (res) => typeof res === "object" && res !== null && res.code === 0,
maxRetries: 5
});
```
### 高级用法(错误自动修复)
```typescript
const result = await skills.toolCallRetry({
toolFn: callDatabase,
args: { sql: "SELECT * FROM users" },
errorHandlerFn: async (error, attempt) => {
if (error.message.includes("SQL syntax error")) {
// 自动修复SQL语法
const fixedSql = await fixSqlWithLLM(error.message);
return { args: { sql: fi...generate a bunch of images, then you curate the results to handpick the best ones
generate a bunch of images, then you curate the results to handpick the best ones
Productivity system based on Maya calendar with 13 natural tones for project management and personal development
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.