이 가이드는 OCIGenAI chat models 시작하기에 대한 간단한 개요를 제공합니다. 모든 ChatOCIGenAI 기능 및 구성에 대한 자세한 문서는 API reference를 참조하세요. Oracle Cloud Infrastructure (OCI) Generative AI는 다양한 사용 사례를 다루는 최첨단의 맞춤형 대규모 언어 모델(LLM) 세트를 제공하는 완전 관리형 서비스이며, 단일 API를 통해 사용할 수 있습니다. OCI Generative AI 서비스를 사용하면 바로 사용 가능한 사전 학습된 모델에 액세스하거나, 전용 AI 클러스터에서 자체 데이터를 기반으로 미세 조정된 사용자 정의 모델을 생성하고 호스팅할 수 있습니다. 서비스 및 API에 대한 자세한 문서는 __여기__와 __여기__에서 확인할 수 있습니다.

Overview

Integration details

ClassPackageLocalSerializableJS support
ChatOCIGenAIlangchain-community

Model features

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

Setup

OCIGenAI 모델에 액세스하려면 ocilangchain-community 패키지를 설치해야 합니다.

Credentials

이 통합에서 지원되는 자격 증명 및 인증 방법은 다른 OCI 서비스에서 사용되는 방법과 동일하며, 표준 SDK 인증 방법, 특히 API Key, session token, instance principal, resource principal을 따릅니다. API key는 위 예제에서 사용된 기본 인증 방법입니다. 다음 예제는 다른 인증 방법(session token)을 사용하는 방법을 보여줍니다.

Installation

LangChain OCIGenAI 통합은 langchain-community 패키지에 포함되어 있으며 oci 패키지도 설치해야 합니다:
pip install -qU langchain-community oci

Instantiation

이제 model 객체를 인스턴스화하고 chat completion을 생성할 수 있습니다:
from langchain_community.chat_models.oci_generative_ai import ChatOCIGenAI
from langchain.messages import AIMessage, HumanMessage, SystemMessage

chat = ChatOCIGenAI(
    model_id="cohere.command-r-16k",
    service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
    compartment_id="MY_OCID",
    model_kwargs={"temperature": 0.7, "max_tokens": 500},
)

Invocation

messages = [
    SystemMessage(content="your are an AI assistant."),
    AIMessage(content="Hi there human!"),
    HumanMessage(content="tell me a joke."),
]
response = chat.invoke(messages)
print(response.content)

API reference

모든 ChatOCIGenAI 기능 및 구성에 대한 자세한 문서는 API reference를 참조하세요: python.langchain.com/api_reference/community/chat_models/langchain_community.chat_models.oci_generative_ai.ChatOCIGenAI.html
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I