---
title: YandexGPT
---

이 노트북은 LangChain을 [YandexGPT](https://cloud.yandex.com/en/services/yandexgpt)와 함께 사용하는 방법을 다룹니다.

사용하려면 `yandexcloud` python 패키지가 설치되어 있어야 합니다.

```python
pip install -qU  yandexcloud
먼저, ai.languageModels.user 역할을 가진 서비스 계정을 생성해야 합니다. 다음으로, 두 가지 인증 옵션이 있습니다:
  • IAM token. 생성자 매개변수 iam_token 또는 환경 변수 YC_IAM_TOKEN에 토큰을 지정할 수 있습니다.
  • API key 생성자 매개변수 api_key 또는 환경 변수 YC_API_KEY에 키를 지정할 수 있습니다.
모델을 지정하려면 model_uri 매개변수를 사용할 수 있습니다. 자세한 내용은 문서를 참조하세요. 기본적으로 folder_id 매개변수 또는 YC_FOLDER_ID 환경 변수에 지정된 폴더의 최신 버전 yandexgpt-lite가 사용됩니다.
from langchain.chains import LLMChain
from langchain_community.llms import YandexGPT
from langchain_core.prompts import PromptTemplate
template = "What is the capital of {country}?"
prompt = PromptTemplate.from_template(template)
llm = YandexGPT()
llm_chain = LLMChain(prompt=prompt, llm=llm)
country = "Russia"

llm_chain.invoke(country)
'The capital of Russia is Moscow.'

---

<Callout icon="pen-to-square" iconType="regular">
    [Edit the source of this page on GitHub.](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/llms/yandex.mdx)
</Callout>
<Tip icon="terminal" iconType="regular">
    [Connect these docs programmatically](/use-these-docs) to Claude, VSCode, and more via MCP for    real-time answers.
</Tip>
I