Custom Interface
SimpleLLMFunc ships withOpenAICompatible and OpenAIResponsesCompatible. For providers that don’t follow either protocol, implement LLM_Interface directly.
The Abstract Base
Minimal Implementation
Response Shape Requirements
The framework expects responses compatible with OpenAI’s types:Non-streaming (chat)
Must return an object with:
.choices[0].message.content— text response.choices[0].message.tool_calls— list of tool calls (optional).usage.prompt_tokens,.usage.completion_tokens— token counts
Streaming (chat_stream)
Must yield objects with:
.choices[0].delta.content— text delta (may be None).choices[0].delta.tool_calls— tool call deltas (optional).choices[0].finish_reason— “stop”, “tool_calls”, etc. (on final chunk)
Tool Call Format
If your provider supports tool calling, tool calls must be in this shape:Using Your Interface
OpenAIResponsesCompatible
For providers implementing OpenAI’s Responses API (not the standard Chat Completions API):- Maps system prompts to Responses
instructions - Handles Responses-specific streaming format
- Supports
reasoning={...}kwargs for reasoning effort control - Keeps all wire-format differences in the adapter — your decorator code stays the same