Skip to content

Commit e115d5a

Browse files
authored
Add model_settings guide to models document page (#484)
This is a pretty minor improvement to the docs: `model_settings` parameter is only mentioned on the agent doc page, but first-time visitors may want to know it’s also available on the models page.
1 parent 68c725f commit e115d5a

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

docs/ja/models.md

+17-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# モデル
22

3-
エージェント SDK は、次の 2 種類の OpenAI モデルをサポートしています
3+
Agents SDK は、OpenAI モデルを次の 2 つの形式でサポートしています
44

55
- **推奨**: 新しい [Responses API](https://platform.openai.com/docs/api-reference/responses) を使用して OpenAI API を呼び出す [`OpenAIResponsesModel`][agents.models.openai_responses.OpenAIResponsesModel]
66
- [Chat Completions API](https://platform.openai.com/docs/api-reference/chat) を使用して OpenAI API を呼び出す [`OpenAIChatCompletionsModel`][agents.models.openai_chatcompletions.OpenAIChatCompletionsModel]
@@ -51,11 +51,24 @@ async def main():
5151
1. OpenAI モデルの名前を直接設定します。
5252
2. [`Model`][agents.models.interface.Model] 実装を提供します。
5353

54+
エージェントに使用するモデルをさらに設定したい場合は、`temperature` などのオプションのモデル設定パラメーターを提供する [`ModelSettings`][agents.models.interface.ModelSettings] を渡すことができます。
55+
56+
```python
57+
from agents import Agent, ModelSettings
58+
59+
english_agent = Agent(
60+
name="English agent",
61+
instructions="You only speak English",
62+
model="gpt-4o",
63+
model_settings=ModelSettings(temperature=0.1),
64+
)
65+
```
66+
5467
## 他の LLM プロバイダーの使用
5568

5669
他の LLM プロバイダーを 3 つの方法で使用できます(例は[こちら](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/))。
5770

58-
1. [`set_default_openai_client`][agents.set_default_openai_client] は、`AsyncOpenAI` のインスタンスを LLM クライアントとしてグローバルに使用したい場合に便利です。これは、LLM プロバイダーが OpenAI 互換の API エンドポイントを持っている場合で`base_url``api_key` を設定できます。[examples/model_providers/custom_example_global.py](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/custom_example_global.py) に設定可能な例があります。
71+
1. [`set_default_openai_client`][agents.set_default_openai_client] は、`AsyncOpenAI` のインスタンスを LLM クライアントとしてグローバルに使用したい場合に便利です。LLM プロバイダーが OpenAI 互換の API エンドポイントを持っている場合に`base_url``api_key` を設定できます。[examples/model_providers/custom_example_global.py](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/custom_example_global.py) に設定可能な例があります。
5972
2. [`ModelProvider`][agents.models.interface.ModelProvider]`Runner.run` レベルで使用します。これにより、「この実行のすべてのエージェントにカスタムモデルプロバイダーを使用する」と指定できます。[examples/model_providers/custom_example_provider.py](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/custom_example_provider.py) に設定可能な例があります。
6073
3. [`Agent.model`][agents.agent.Agent.model] では、特定のエージェントインスタンスにモデルを指定できます。これにより、異なるエージェントに対して異なるプロバイダーを組み合わせて使用することができます。[examples/model_providers/custom_example_agent.py](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/custom_example_agent.py) に設定可能な例があります。
6174

@@ -84,10 +97,10 @@ SDK はデフォルトで Responses API を使用しますが、ほとんどの
8497

8598
### 適切な形式のデータのサポート
8699

87-
一部のモデルプロバイダーは[適切な形式のデータ](https://platform.openai.com/docs/guides/structured-outputs)をサポートしていません。これにより、次のようなエラーが発生することがあります。
100+
一部のモデルプロバイダーは[適切な形式のデータ](https://platform.openai.com/docs/guides/structured-outputs)をサポートしていません。これにより、次のようなエラーが発生することがあります。
88101

89102
```
90103
BadRequestError: Error code: 400 - {'error': {'message': "'response_format.type' : value is not one of the allowed values ['text','json_object']", 'type': 'invalid_request_error'}}
91104
```
92105

93-
これは一部のモデルプロバイダーの欠点で、JSON 出力をサポートしていますが、出力に使用する `json_schema` を指定することはできません。この問題の修正に取り組んでいますが、JSON スキーマ出力をサポートしているプロバイダーに依存することをお勧めします。さもないと、アプリが不正な JSON のために頻繁に壊れることになります。
106+
これは一部のモデルプロバイダーの欠点であり、JSON 出力をサポートしていますが、出力に使用する `json_schema` を指定することはできません。これに対する修正に取り組んでいますが、JSON スキーマ出力をサポートしているプロバイダーに依存することをお勧めします。さもないと、アプリが不正な JSON のために頻繁に壊れることになります。

docs/models.md

+13
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ async def main():
5151
1. Sets the name of an OpenAI model directly.
5252
2. Provides a [`Model`][agents.models.interface.Model] implementation.
5353

54+
When you want to further configure the model used for an agent, you can pass [`ModelSettings`][agents.models.interface.ModelSettings], which provides optional model configuration parameters such as temperature.
55+
56+
```python
57+
from agents import Agent, ModelSettings
58+
59+
english_agent = Agent(
60+
name="English agent",
61+
instructions="You only speak English",
62+
model="gpt-4o",
63+
model_settings=ModelSettings(temperature=0.1),
64+
)
65+
```
66+
5467
## Using other LLM providers
5568

5669
You can use other LLM providers in 3 ways (examples [here](https://github.com/openai/openai-agents-python/tree/main/examples/model_providers/)):

0 commit comments

Comments
 (0)