Skip to content

Self-improving AI Employees for everyone

1.6 KB
Raw Blame
from typing import Literal, Optional

from pydantic import Field

from .._base import ChatModelBase, ChatModelParams

from .._credentials import GeminiCredential


class GeminiChatModelParams(ChatModelParams):
    top_k: Optional[int] = Field(default=40, ge=1, le=100)
    safety_settings: Literal["default", "strict", "permissive"] = Field(default="default")
    thinking_enabled: bool = Field(default=False)
    thinking_budget: Optional[int] = Field(
        default=2048,
        ge=1024,
        le=16000,
        json_schema_extra={"displayOptions": {"show": {"thinking_enabled": [True]}}},
    )


class GeminiChatModelNode(ChatModelBase):
    type = "geminiChatModel"
    display_name = "Gemini"
    subtitle = "Chat Model"
    group = ("model", "tool")
    description = "Google Gemini models for multimodal AI capabilities"

    usable_as_tool = True
    tool_name = "gemini_chat_model"
    tool_description = (
        "Consult Google Gemini as an advisor — a stronger model the operator wired in to guide "
        "your reasoning. Call AT THE START of any complex task to plan your approach, WHEN "
        "STUCK (errors recurring, approach not converging), and BEFORE DECLARING DONE to "
        "sanity-check completeness. Pose ONE focused question in `prompt` — include the context "
        "the advisor needs (the advisor cannot see your conversation). Do NOT set `model`, "
        "`api_key`, `temperature`, or other fields; the operator configured them. Returns brief "
        "tactical guidance — you do the work."
    )

    credentials = (GeminiCredential,)
    Params = GeminiChatModelParams