General
PromptBeginner5 minmarkdown
Untitled Skill
193
Rules for working with LLM provider adapters in selectools
Loading actions...
Main instructions and any bundled files for this skill.
Every provider must implement all methods from providers/base.py:
complete(), acomplete() — sync/async completionstream(), astream() — sync/async streaming_format_messages() — convert Message to provider formatALL methods (complete, acomplete, stream, astream) MUST:
tools: list[Tool] | None = None parameter_map_tool_to_<provider>(t) helperstream() returns Iterable[str]astream() returns AsyncIterable[Union[str, ToolCall]]astream() must parse tool call chunks and yield ToolCall objectsToolCall objects_uses_max_completion_tokens(model) to decide parameter namemax_completion_tokensmax_tokensastream() must include try/except with _is_retriable + circuit breaker_record_failure() / _record_success() consistentlyon_fallback callback when falling backRole.TOOL messages need provider-specific formatting:
{"role": "tool", "content": ..., "tool_call_id": ...}{"role": "user", "content": [{"type": "tool_result", ...}]}{"role": "user", "parts": [{"function_response": ...}]}{"role": "tool", "content": ..., "tool_call_id": ...}RecordingProvider to capture and assert exact args_format_messages for TOOL role, ASSISTANT with tool_calls, imagesastream() yields ToolCall objects (not just strings)TypeScript and ESLint rules that MUST be followed when creating, modifying, or reviewing any file under apps/frontend/, including .ts, .tsx, .js, and .jsx files. Also apply when discussing frontend li...
risks