File size: 784 Bytes
570f7bd
105e019
570f7bd
c1bc4eb
570f7bd
 
 
c1bc4eb
 
 
570f7bd
 
c1bc4eb
 
 
 
 
 
 
 
570f7bd
 
c1bc4eb
 
 
570f7bd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from __future__ import annotations
from typing import Tuple, Dict, Any, Protocol


class LLMProvider(Protocol):
    provider_id: str

    def plan(
        self, *, user_query: str, schema_preview: str
    ) -> Tuple[str, int, int, float]:
        """Return (plan_text, token_in, token_out, cost_usd)."""

    def generate_sql(
        self,
        *,
        user_query: str,
        schema_preview: str,
        plan_text: str,
        clarify_answers: Dict[str, Any] | None = None,
    ) -> Tuple[str, str, int, int, float]:
        """Return (sql, rationale, token_in, token_out, cost_usd)."""

    def repair(
        self, *, sql: str, error_msg: str, schema_preview: str
    ) -> Tuple[str, int, int, float]:
        """Return (patched_sql, token_in, token_out, cost_usd)."""