From cfd351335f028f8e16aa30561184a33770585224 Mon Sep 17 00:00:00 2001 From: Yong woo Song Date: Mon, 15 Sep 2025 02:50:14 +0900 Subject: [PATCH 1/4] docs: ko: using_different_models.md --- .../ko/examples/using_different_models.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 docs/source/ko/examples/using_different_models.md diff --git a/docs/source/ko/examples/using_different_models.md b/docs/source/ko/examples/using_different_models.md new file mode 100644 index 000000000..42def6396 --- /dev/null +++ b/docs/source/ko/examples/using_different_models.md @@ -0,0 +1,117 @@ +# 다양한 모델 사용하기 [[using-different-models]] + +[[open-in-colab]] + +`smolagents`는 다양한 프로바이더의 여러 언어 모델을 사용할 수 있는 유연한 프레임워크를 제공합니다. +이 가이드는 에이전트와 함께 다양한 모델 유형을 사용하는 방법을 보여줍니다. + +## 사용 가능한 모델 유형 [[available-model-types]] + +`smolagents`는 기본적으로 여러 모델 유형을 지원합니다: +1. [`InferenceClientModel`]: Hugging Face의 추론 API를 사용하여 모델에 액세스 +2. [`TransformersModel`]: 🤗 Transformers 라이브러리를 사용하여 로컬에서 모델 실행 +3. [`VLLMModel`]: 최적화된 서빙으로 빠른 추론을 위해 vLLM 사용 +4. [`MLXModel`]: MLX를 사용하여 Apple Silicon 디바이스에 최적화 +5. [`LiteLLMModel`]: LiteLLM을 통해 수백 개의 대규모 언어 모델에 액세스 제공 +6. [`LiteLLMRouterModel`]: 여러 모델 간에 요청을 분산 +7. [`OpenAIServerModel`]: OpenAI 호환 API를 구현하는 모든 프로바이더에 액세스 제공 +8. [`AzureOpenAIServerModel`]: Azure의 OpenAI 서비스 사용 +9. [`AmazonBedrockServerModel`]: AWS Bedrock의 API에 연결 + +모든 모델 클래스는 인스턴스화 시점에 추가 키워드 인수들(`temperature`, `max_tokens`, `top_p` 등)을 직접 전달하는 것을 지원합니다. +이러한 매개변수들은 자동으로 기본 모델의 완성 호출로 전달되어, 창의성, 응답 길이, 샘플링 전략과 같은 모델 동작을 구성할 수 있게 해줍니다. + +## Google Gemini 모델 사용하기 [[using-google-gemini-models]] + +Google Gemini API 문서(https://ai.google.dev/gemini-api/docs/openai)에서 설명한 바와 같이, +Google은 Gemini 모델에 대해 OpenAI 호환 API를 제공하므로, 적절한 베이스 URL을 설정하여 +[`OpenAIServerModel`]을 Gemini 모델과 함께 사용할 수 있습니다. + +먼저, 필요한 의존성을 설치합니다: +```bash +pip install 'smolagents[openai]' +``` + +그다음, [Gemini API 키를 얻고](https://ai.google.dev/gemini-api/docs/api-key) 코드에서 설정합니다: +```python +GEMINI_API_KEY = +``` + +이제 `OpenAIServerModel` 클래스를 사용하고 `api_base` 매개변수를 Gemini API 베이스 URL로 설정하여 +Gemini 모델을 초기화할 수 있습니다: +```python +from smolagents import OpenAIServerModel + +model = OpenAIServerModel( + model_id="gemini-2.0-flash", + # Google Gemini OpenAI 호환 API 베이스 URL + api_base="https://generativelanguage.googleapis.com/v1beta/openai/", + api_key=GEMINI_API_KEY, +) +``` + +## OpenRouter 모델 사용하기 [[using-openrouter-models]] + +OpenRouter는 통합된 OpenAI 호환 API를 통해 다양한 언어 모델에 대한 액세스를 제공합니다. +적절한 베이스 URL을 설정하여 [`OpenAIServerModel`]을 사용해 OpenRouter에 연결할 수 있습니다. + +먼저, 필요한 의존성을 설치합니다: +```bash +pip install 'smolagents[openai]' +``` + +그다음, [OpenRouter API 키를 얻고](https://openrouter.ai/keys) 코드에서 설정합니다: +```python +OPENROUTER_API_KEY = +``` + +이제 `OpenAIServerModel` 클래스를 사용하여 OpenRouter에서 사용 가능한 모든 모델을 초기화할 수 있습니다: +```python +from smolagents import OpenAIServerModel + +model = OpenAIServerModel( + # OpenRouter에서 사용 가능한 모든 모델 ID를 사용할 수 있습니다 + model_id="openai/gpt-4o", + # OpenRouter API 베이스 URL + api_base="https://openrouter.ai/api/v1", + api_key=OPENROUTER_API_KEY, +) +``` + +## xAI의 Grok 모델 사용하기 [[using-xais-grok-models]] + +xAI의 Grok 모델은 [`LiteLLMModel`]을 통해 액세스할 수 있습니다. + +일부 모델("grok-4" 및 "grok-3-mini" 등)은 `stop` 매개변수를 지원하지 않으므로, +API 호출에서 이를 제외하기 위해 `REMOVE_PARAMETER`를 사용해야 합니다. + +먼저, 필요한 의존성을 설치합니다: +```bash +pip install smolagents[litellm] +``` + +그다음, [xAI API 키를 얻고](https://console.x.ai/) 코드에서 설정합니다: +```python +XAI_API_KEY = +``` + +이제 `LiteLLMModel` 클래스를 사용하여 Grok 모델을 초기화하고 해당되는 경우 `stop` 매개변수를 제거할 수 있습니다: +```python +from smolagents import LiteLLMModel, REMOVE_PARAMETER + +# Grok-4 사용 +model = LiteLLMModel( + model_id="xai/grok-4", + api_key=XAI_API_KEY, + stop=REMOVE_PARAMETER, # grok-4 모델이 이를 지원하지 않으므로 stop 매개변수 제거 + temperature=0.7 +) + +# 또는 Grok-3-mini 사용 +model_mini = LiteLLMModel( + model_id="xai/grok-3-mini", + api_key=XAI_API_KEY, + stop=REMOVE_PARAMETER, # grok-3-mini 모델이 이를 지원하지 않으므로 stop 매개변수 제거 + max_tokens=1000 +) +``` \ No newline at end of file From 958957930433b1b65f38d01a8458fea65e1c1760 Mon Sep 17 00:00:00 2001 From: Yong woo Song Date: Mon, 15 Sep 2025 02:50:36 +0900 Subject: [PATCH 2/4] docs: update Korean documentation table of contents --- docs/source/ko/_toctree.yml | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/docs/source/ko/_toctree.yml b/docs/source/ko/_toctree.yml index 0bf08ae77..d01fde763 100644 --- a/docs/source/ko/_toctree.yml +++ b/docs/source/ko/_toctree.yml @@ -4,8 +4,6 @@ title: 소개 - local: installation title: 설치 옵션 -# - local: guided_tour -# title: 안내서 - title: 튜토리얼 sections: - title: 좋은 에이전트 구축하기 @@ -16,23 +14,7 @@ title: 스스로 오류를 수정하는 Text-to-SQL - local: examples/multiagents title: 멀티 에이전트 시스템 오케스트레이션 -# - local: in_translation -# title: (번역중) Build a web browser agent using vision models -# - local: in_translation -# title: (번역중) Using different models -# - local: in_translation -# title: "(번역중) Human-in-the-Loop: Customize agent plan interactively" -# - local: in_translation -# title: (번역중) Async Applications with Agents -#- title: Reference -# sections: -# - local: reference/agents -# title: Agent-related objects -# - local: reference/models -# title: Model-related objects -# - title: Tools -# sections: -# - title: Tool-related objects -# local: reference/tools -# - title: Built-in Tools -# local: reference/default_tools + - null + - null + - local: examples/using_different_models + title: 다양한 모델 사용하기 From 7d89560afccf4787fe6d195474f70df67adbecdb Mon Sep 17 00:00:00 2001 From: Yong woo Song Date: Mon, 29 Sep 2025 19:29:50 +0900 Subject: [PATCH 3/4] Update Korean TOC with new tutorial structure --- docs/source/ko/_toctree.yml | 42 +++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/docs/source/ko/_toctree.yml b/docs/source/ko/_toctree.yml index d01fde763..3787837a3 100644 --- a/docs/source/ko/_toctree.yml +++ b/docs/source/ko/_toctree.yml @@ -4,17 +4,51 @@ title: 소개 - local: installation title: 설치 옵션 +# - local: guided_tour +# title: 안내서 - title: 튜토리얼 sections: - - title: 좋은 에이전트 구축하기 - local: tutorials/building_good_agents + - local: tutorials/building_good_agents + title: 좋은 에이전트 구축하기 +# - local: tutorials/inspect_runs +# title: 📊 Inspect your agent runs using telemetry +# - local: tutorials/tools +# title: 🛠️ Tools - in-depth guide +# - local: tutorials/secure_code_execution +# title: 🛡️ Secure code execution +# - local: tutorials/memory +# title: 📚 Manage your agent's memory +- title: Conceptual guides + sections: +# - local: conceptual_guides/intro_agents +# title: 🤖 What are agents? + - local: conceptual_guides/react + title: 🤔 멀티스텝 에이전트는 어떻게 동작하나요? - title: 예제 sections: - local: examples/text_to_sql title: 스스로 오류를 수정하는 Text-to-SQL +# - local: examples/rag +# title: Master your knowledge base with agentic RAG - local: examples/multiagents title: 멀티 에이전트 시스템 오케스트레이션 - - null - - null +# - local: examples/web_browser +# title: (번역중) Build a web browser agent using vision models - local: examples/using_different_models title: 다양한 모델 사용하기 +# - local: examples/plan_customization +# title: "(번역중) Human-in-the-Loop: Customize agent plan interactively" +# - local: examples/async_agent +# title: (번역중) Async Applications with Agents +- title: Reference + sections: +# - local: reference/agents +# title: Agent-related objects + - local: reference/models + title: 모델 관련 클래스 +# - title: Tools +# sections: +# - title: Tool-related objects +# local: reference/tools +# - title: Built-in Tools +# local: reference/default_tools From 0c7894f5907440643a7a4b899eb7a37e6e87de7a Mon Sep 17 00:00:00 2001 From: Yong woo Song Date: Mon, 6 Oct 2025 22:51:13 +0900 Subject: [PATCH 4/4] Fix typos in Korean documentation for model types --- docs/source/ko/examples/using_different_models.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/ko/examples/using_different_models.md b/docs/source/ko/examples/using_different_models.md index 42def6396..b1758658f 100644 --- a/docs/source/ko/examples/using_different_models.md +++ b/docs/source/ko/examples/using_different_models.md @@ -8,13 +8,13 @@ ## 사용 가능한 모델 유형 [[available-model-types]] `smolagents`는 기본적으로 여러 모델 유형을 지원합니다: -1. [`InferenceClientModel`]: Hugging Face의 추론 API를 사용하여 모델에 액세스 +1. [`InferenceClientModel`]: Hugging Face의 추론 API를 사용하여 모델에 접근 2. [`TransformersModel`]: 🤗 Transformers 라이브러리를 사용하여 로컬에서 모델 실행 3. [`VLLMModel`]: 최적화된 서빙으로 빠른 추론을 위해 vLLM 사용 4. [`MLXModel`]: MLX를 사용하여 Apple Silicon 디바이스에 최적화 -5. [`LiteLLMModel`]: LiteLLM을 통해 수백 개의 대규모 언어 모델에 액세스 제공 +5. [`LiteLLMModel`]: LiteLLM을 통해 수백 개의 대규모 언어 모델에 접근 제공 6. [`LiteLLMRouterModel`]: 여러 모델 간에 요청을 분산 -7. [`OpenAIServerModel`]: OpenAI 호환 API를 구현하는 모든 프로바이더에 액세스 제공 +7. [`OpenAIServerModel`]: OpenAI 호환 API를 구현하는 모든 프로바이더에 접근 제공 8. [`AzureOpenAIServerModel`]: Azure의 OpenAI 서비스 사용 9. [`AmazonBedrockServerModel`]: AWS Bedrock의 API에 연결 @@ -52,7 +52,7 @@ model = OpenAIServerModel( ## OpenRouter 모델 사용하기 [[using-openrouter-models]] -OpenRouter는 통합된 OpenAI 호환 API를 통해 다양한 언어 모델에 대한 액세스를 제공합니다. +OpenRouter는 통합된 OpenAI 호환 API를 통해 다양한 언어 모델에 대한 접근을 제공합니다. 적절한 베이스 URL을 설정하여 [`OpenAIServerModel`]을 사용해 OpenRouter에 연결할 수 있습니다. 먼저, 필요한 의존성을 설치합니다: @@ -80,7 +80,7 @@ model = OpenAIServerModel( ## xAI의 Grok 모델 사용하기 [[using-xais-grok-models]] -xAI의 Grok 모델은 [`LiteLLMModel`]을 통해 액세스할 수 있습니다. +xAI의 Grok 모델은 [`LiteLLMModel`]을 통해 접근할 수 있습니다. 일부 모델("grok-4" 및 "grok-3-mini" 등)은 `stop` 매개변수를 지원하지 않으므로, API 호출에서 이를 제외하기 위해 `REMOVE_PARAMETER`를 사용해야 합니다. @@ -114,4 +114,4 @@ model_mini = LiteLLMModel( stop=REMOVE_PARAMETER, # grok-3-mini 모델이 이를 지원하지 않으므로 stop 매개변수 제거 max_tokens=1000 ) -``` \ No newline at end of file +```