Minimal interface every LLM backend must satisfy.
| 28 | |
| 29 | |
| 30 | class LLMProvider(Protocol): |
| 31 | """Minimal interface every LLM backend must satisfy.""" |
| 32 | |
| 33 | name: str |
| 34 | model: str |
| 35 | |
| 36 | def generate( |
| 37 | self, |
| 38 | prompt: str, |
| 39 | *, |
| 40 | system: Optional[str] = None, |
| 41 | temperature: float = 0.0, |
| 42 | max_tokens: int = 1024, |
| 43 | ) -> LLMResponse: ... |
| 44 | |
| 45 | def stream_generate( |
| 46 | self, |
| 47 | prompt: str, |
| 48 | *, |
| 49 | system: Optional[str] = None, |
| 50 | temperature: float = 0.0, |
| 51 | max_tokens: int = 1024, |
| 52 | ) -> Iterator[str]: ... |
| 53 | |
| 54 | |
| 55 | def _chunk_text(text: str, size: int = 24) -> Iterator[str]: |
nothing calls this directly
no outgoing calls
no test coverage detected