이 페이지는 VertexAI chat models 시작하기에 대한 간단한 개요를 제공합니다. 모든 ChatVertexAI 기능 및 구성에 대한 자세한 문서는 API reference를 참조하세요. ChatVertexAI는 gemini-2.5-pro, gemini-2.5-flash 등과 같이 Google Cloud에서 사용 가능한 모든 기본 모델을 제공합니다. 사용 가능한 모델의 전체 및 최신 목록은 VertexAI documentation을 참조하세요.
Google Cloud VertexAI vs Google PaLMGoogle Cloud VertexAI 통합은 Google PaLM integration과 별개입니다. Google은 GCP를 통해 PaLM의 엔터프라이즈 버전을 제공하기로 선택했으며, 이를 통해 제공되는 모델을 지원합니다.

Overview

Integration details

ClassPackageLocalSerializableJS supportDownloadsVersion
ChatVertexAIlangchain-google-vertexaibetaPyPI - DownloadsPyPI - Version

Model features

Tool callingStructured outputJSON modeImage inputAudio inputVideo inputToken-level streamingNative asyncToken usageLogprobs

Setup

VertexAI 모델에 액세스하려면 Google Cloud Platform 계정을 생성하고, 자격 증명을 설정하고, langchain-google-vertexai 통합 패키지를 설치해야 합니다.

Credentials

통합을 사용하려면 다음 중 하나를 수행해야 합니다:
  • 환경에 대해 구성된 자격 증명이 있어야 합니다 (gcloud, workload identity 등…)
  • 서비스 계정 JSON 파일의 경로를 GOOGLE_APPLICATION_CREDENTIALS 환경 변수로 저장해야 합니다
이 코드베이스는 google.auth 라이브러리를 사용하며, 먼저 위에서 언급한 애플리케이션 자격 증명 변수를 찾은 다음 시스템 수준 인증을 찾습니다. 자세한 내용은 다음을 참조하세요: 모델 호출의 자동 추적을 활성화하려면 LangSmith API 키를 설정하세요:
os.environ["LANGSMITH_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ")
os.environ["LANGSMITH_TRACING"] = "true"

Installation

LangChain VertexAI 통합은 langchain-google-vertexai 패키지에 있습니다:
pip install -qU langchain-google-vertexai
Note: you may need to restart the kernel to use updated packages.

Instantiation

이제 모델 객체를 인스턴스화하고 chat completion을 생성할 수 있습니다:
from langchain_google_vertexai import ChatVertexAI

llm = ChatVertexAI(
    model="gemini-2.5-flash",
    temperature=0,
    max_tokens=None,
    max_retries=6,
    stop=None,
    # other params...
)

Invocation

messages = [
    (
        "system",
        "You are a helpful assistant that translates English to French. Translate the user sentence.",
    ),
    ("human", "I love programming."),
]
ai_msg = llm.invoke(messages)
ai_msg
AIMessage(content="J'adore programmer. \n", response_metadata={'is_blocked': False, 'safety_ratings': [{'category': 'HARM_CATEGORY_HATE_SPEECH', 'probability_label': 'NEGLIGIBLE', 'blocked': False}, {'category': 'HARM_CATEGORY_DANGEROUS_CONTENT', 'probability_label': 'NEGLIGIBLE', 'blocked': False}, {'category': 'HARM_CATEGORY_HARASSMENT', 'probability_label': 'NEGLIGIBLE', 'blocked': False}, {'category': 'HARM_CATEGORY_SEXUALLY_EXPLICIT', 'probability_label': 'NEGLIGIBLE', 'blocked': False}], 'usage_metadata': {'prompt_token_count': 20, 'candidates_token_count': 7, 'total_token_count': 27}}, id='run-7032733c-d05c-4f0c-a17a-6c575fdd1ae0-0', usage_metadata={'input_tokens': 20, 'output_tokens': 7, 'total_tokens': 27})
print(ai_msg.content)
J'adore programmer.

Built-in tools

Gemini는 서버 측에서 실행되는 다양한 도구를 지원합니다.
langchain-google-vertexai>=2.0.11 필요
Gemini는 Google 검색을 실행하고 결과를 사용하여 응답을 근거화할 수 있습니다:
from langchain_google_vertexai import ChatVertexAI

llm = ChatVertexAI(model="gemini-2.5-flash").bind_tools([{"google_search": {}}])

response = llm.invoke("What is today's news?")

Code execution

langchain-google-vertexai>=2.0.25 필요
Gemini는 Python 코드를 생성하고 실행할 수 있습니다:
from langchain_google_vertexai import ChatVertexAI

llm = ChatVertexAI(model="gemini-2.5-flash").bind_tools([{"code_execution": {}}])

response = llm.invoke("What is 3^3?")

API reference

멀티모달 입력 전송 및 안전 설정 구성 방법과 같은 모든 ChatVertexAI 기능 및 구성에 대한 자세한 문서는 API reference를 참조하세요: python.langchain.com/api_reference/google_vertexai/chat_models/langchain_google_vertexai.chat_models.ChatVertexAI.html
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I