0xPlaygrounds / 0xPlaygrounds/rig
feat: reduce create Provider boilerplate by using declarative macro
- 主要語言
- Rust
- 星號
- 8.6k
- 分支
- 959
- 平均合併
- 4 小時 32 分鐘
- 30 天內合併 PR
- 117
描述
- [x] I have looked for existing issues (including closed) about this
## Feature Request
Currently all provider integrations manually implement exact same boilerplate (`Ext`, `Builder`, `Capabilities`, etc.). This results in hundreds of lines of code (~15 providers * ~50 lines each) and will keep increasing as new models are added.
### Motivation
Significant reduction in code duplication, easier to add new models
### Proposal
Create a `define_provider!` or `setup_provider` declarative macro to generate this boilerplate in a single line, example:
```rust
define_provider!(MoonshotExt, MoonshotBuilder, "MOONSHOT_API_KEY", "https://api.moonshot.cn/v1", "/models");
```
### Alternatives
貢獻指南
研究方向
Look at existing provider implementations (e.g., MoonshotExt, MoonshotBuilder) to understand the boilerplate pattern. The macro should generate Ext, Builder, Capabilities, etc. Start by exploring the provider module structure and Rust's declarative macro system. Test the macro by applying it to a new or existing provider to ensure it generates correct code.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust
- 領域
- backend-api-design, tooling
- Issue 類型
- 重構
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100