AirgapChatOpenAI (Gemma3 Airgap Model)
What it is
- A minimal
langchain_openai.ChatOpenAIsubclass that adapts prompts and streaming to a local Docker Model Runner endpoint (OpenAI-compatible/chat/completions). - The module also exports a preconfigured
ChatModelinstance for Gemma3 running in “airgap” (local) mode.
Public API
- class
AirgapChatOpenAI(ChatOpenAI)- Purpose: Provide basic prompt formatting and robust streaming against a local OpenAI-compatible server.
- Public methods/properties:
bind_tools(tools, **kwargs) -> self: No-op tool binding; returnsself.bind(**kwargs) -> self: No-op binding; returnsself._llm_type -> str: Returns"airgap_chat_openai".
- Module-level constants
MODEL_ID = "ai/gemma3"NAME = "gemma3-airgap"DESCRIPTION,IMAGE,CONTEXT_WINDOW = 8192,PROVIDER = "google"
model: ChatModel- Purpose: Ready-to-use
naas_abi_core.models.Model.ChatModelwrapper configured withAirgapChatOpenAIpointing tohttp://localhost:12434/engines/v1.
- Purpose: Ready-to-use
Configuration/Dependencies
- HTTP endpoint
- Expects an OpenAI-compatible server at:
openai_api_base="http://localhost:12434/engines/v1"
- Streaming uses
POST {openai_api_base}/chat/completionswithstream=True.
- Expects an OpenAI-compatible server at:
- Python dependencies
requestslangchain_core,langchain_openainaas_abi_core(forloggerandChatModel)
Usage
from naas_abi.models.airgap_gemma import model
# Access the underlying LangChain chat model
llm = model.model
# Minimal invoke example (LangChain interface)
response = llm.invoke("Say hello in one sentence.")
print(response.content)