
    5Qj                     *    d dl mZmZ  G d de      Zy)    )ABCabstractmethodc                   4    e Zd ZdZededee   defd       Zy)LLMProvidera  Provider-agnostic interface every LLM backend must implement.

    Every service (itinerary generation, reply drafting, ...) is written against this
    interface only - never against a vendor SDK directly. Swapping OpenAI for Anthropic,
    or cloud for a local Ollama model, is a one-line change in providers/factory.py and
    an env var; nothing in app/services/ or app/prompts.py has to change.
    system_promptmessagesreturnc                     t         )aD  Run one completion and return the parsed JSON object the model produced.

        `messages` is a list of {"role": "user"|"assistant", "content": str} - the
        system prompt is passed separately since not every provider's wire format
        allows a "system" entry inside the messages list (Anthropic doesn't).

        Raises whatever the underlying SDK raises on a transport/API error, and
        json.JSONDecodeError if the model's output can't be parsed as JSON even after
        the implementation's own cleanup - callers are expected to catch and wrap both.
        )NotImplementedError)selfr   r   s      8/var/www/html/meridian/meridian-ai/app/providers/base.pycomplete_jsonzLLMProvider.complete_json   s
     "!    N)	__name__
__module____qualname____doc__r   strlistdictr    r   r   r   r      s4     "3 "$t* " " "r   r   N)abcr   r   r   r   r   r   <module>r      s    #"# "r   