rig-provider

Implement and audit Rig model providers for LLM API integrations.

8.2k|927|Updated Jun 5, 2024
One-click install
npx skills add https://github.com/0xPlaygrounds/rig --skill rig-provider
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rig-provider
Source: https://github.com/0xPlaygrounds/rig/tree/main/.claude/skills/rig-provider
Command: npx skills add https://github.com/0xPlaygrounds/rig --skill rig-provider

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive checklist and reference implementation for integrating new Large Language Model (LLM) providers into the Rig framework, ensuring compatibility and adherence to best practices.

Core Features & Use Cases

  • Provider Implementation Guide: Detailed steps for creating new Rig model providers, covering essential components like structs, trait implementations, and capability declarations.
  • API Alignment: Emphasizes keeping request/response fields consistent with upstream provider APIs.
  • Error Handling & Telemetry: Guides on implementing robust error mapping and adding telemetry spans.
  • WASM Compatibility: Provides patterns for ensuring Rig works seamlessly in WebAssembly environments.
  • Prompt Hooks: Explains how to use prompt hooks for observing and controlling the agent's execution lifecycle.
  • Quality Gates: Outlines critical requirements for code quality, including trait bounds, error handling, comments, and documentation.
  • Use Case: A developer needs to add support for a new LLM API (e.g., "AwesomeLLM") to Rig. They would use this Skill to follow the established pattern, ensuring the integration is robust, efficient, and maintainable.

Quick Start

Use the rig-provider skill to implement a new Rig model provider following the OpenAI reference implementation pattern.

Frequently Asked Questions about rig-provider

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new LLM provider to the Rig framework?

To add a new LLM provider to the Rig framework, follow the OpenAI reference implementation pattern to build provider structs, declare capabilities, implement trait bounds, and map API responses. This ensures your integration aligns with upstream APIs and framework standards.

What are the requirements for maintaining WebAssembly compatibility in Rig providers?

WebAssembly compatibility in Rig providers requires using specific patterns to ensure the LLM API integration operates seamlessly within WASM environments. The implementation must pass quality gates that verify trait bounds, error types, and avoid non-compatible dependencies.

How should error handling and telemetry be implemented for a custom LLM provider?

Error handling and telemetry for a custom LLM provider require robust error mapping alongside the addition of telemetry spans. These practices ensure that API failures are caught correctly and execution traces are observable during the agent's lifecycle.

Does Rig support observing and controlling the agent execution lifecycle?

Yes, Rig supports observing and controlling the agent execution lifecycle through prompt hooks. This mechanism allows developers to intercept and manage the flow of interactions with the large language model provider during runtime.

What quality gates must pass before submitting a new Rig model provider?

Before submitting a new Rig model provider, your code must pass quality gates checking trait bounds, error types, comments, documentation, and outstanding TODO items. Pre-submission checks also verify architectural alignment and correct message type conversions.

How do I ensure API alignment when integrating an LLM API into Rig?

To ensure API alignment when integrating an LLM API into Rig, keep request and response fields strictly consistent with the upstream provider APIs. The implementation must accurately map message types and adhere to the framework's client type aliases.