Skip to content

Commit c994c2a

Browse files
committed
docs: update code snippets
1 parent a251b42 commit c994c2a

6 files changed

Lines changed: 18 additions & 12 deletions

File tree

docs/ja/running_agents.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ result = Runner.run_sync(
305305
[`RunResultBase.to_input_list()`][agents.result.RunResultBase.to_input_list] メソッドを使用して次のターンの入力を取得し、会話履歴を手動で管理できます。
306306

307307
```python
308+
from agents import Agent, Runner, trace
309+
308310
async def main():
309311
agent = Agent(name="Assistant", instructions="Reply very concisely.")
310312

@@ -327,7 +329,7 @@ async def main():
327329
より簡単な方法として、[Sessions](sessions/index.md) を使用すると、`.to_input_list()` を手動で呼び出すことなく、会話履歴を自動的に処理できます。
328330

329331
```python
330-
from agents import Agent, Runner, SQLiteSession
332+
from agents import Agent, Runner, SQLiteSession, trace
331333

332334
async def main():
333335
agent = Agent(name="Assistant", instructions="Reply very concisely.")
@@ -593,4 +595,4 @@ SDK は特定の状況で例外を発生させます。完全な一覧は [`agen
593595
- 予期しないツール関連の失敗:モデルが想定された方法でツールを使用できなかった場合です。
594596
- [`ToolTimeoutError`][agents.exceptions.ToolTimeoutError]:関数ツール呼び出しが設定されたタイムアウトを超え、そのツールが `timeout_behavior="raise_exception"` を使用している場合に発生する例外です。
595597
- [`UserError`][agents.exceptions.UserError]:SDK を使用するコードを作成しているユーザーが、SDK の使用時に誤りを犯した場合に発生する例外です。通常は、不適切なコード実装、無効な設定、SDK API の誤用によって発生します。
596-
- [`InputGuardrailTripwireTriggered`][agents.exceptions.InputGuardrailTripwireTriggered][`OutputGuardrailTripwireTriggered`][agents.exceptions.OutputGuardrailTripwireTriggered]:それぞれ、入力ガードレールまたは出力ガードレールの条件が満たされた場合に発生する例外です。入力ガードレールは処理前に受信メッセージをチェックし、出力ガードレールは配信前にエージェントの最終レスポンスをチェックします。
598+
- [`InputGuardrailTripwireTriggered`][agents.exceptions.InputGuardrailTripwireTriggered][`OutputGuardrailTripwireTriggered`][agents.exceptions.OutputGuardrailTripwireTriggered]:それぞれ、入力ガードレールまたは出力ガードレールの条件が満たされた場合に発生する例外です。入力ガードレールは処理前に受信メッセージをチェックし、出力ガードレールは配信前にエージェントの最終レスポンスをチェックします。

docs/ja/tracing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ OpenAI 以外のモデルで OpenAI API キーを使用すると、トレーシ
168168

169169
```python
170170
import os
171-
from agents import set_tracing_export_api_key, Agent, Runner
171+
from agents import set_tracing_export_api_key, Agent
172172
from agents.extensions.models.any_llm_model import AnyLLMModel
173173

174174
tracing_api_key = os.environ["OPENAI_API_KEY"]
@@ -234,4 +234,4 @@ await Runner.run(
234234
- [Asqav](https://www.asqav.com/docs/integrations#openai-agents)
235235
- [Datadog](https://docs.datadoghq.com/llm_observability/instrumentation/auto_instrumentation/?tab=python#openai-agents)
236236
- [Latitude](https://docs.latitude.so/telemetry/frameworks/openai-agents)
237-
- [DProvenanceKit](https://dprovenance.dev/openai-agents/)
237+
- [DProvenanceKit](https://dprovenance.dev/openai-agents/)

docs/ko/running_agents.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ SDK가 이전 출력에서 후속 입력을 구성하는 다중 턴 에이전트
305305
[`RunResultBase.to_input_list()`][agents.result.RunResultBase.to_input_list] 메서드를 사용해 다음 턴의 입력을 가져오는 방식으로 대화 기록을 수동으로 관리할 수 있습니다.
306306

307307
```python
308+
from agents import Agent, Runner, trace
309+
308310
async def main():
309311
agent = Agent(name="Assistant", instructions="Reply very concisely.")
310312

@@ -327,7 +329,7 @@ async def main():
327329
더 간단한 방법으로 [Sessions](sessions/index.md)를 사용하면 `.to_input_list()`를 직접 호출하지 않고도 대화 기록을 자동으로 처리할 수 있습니다.
328330

329331
```python
330-
from agents import Agent, Runner, SQLiteSession
332+
from agents import Agent, Runner, SQLiteSession, trace
331333

332334
async def main():
333335
agent = Agent(name="Assistant", instructions="Reply very concisely.")
@@ -593,4 +595,4 @@ SDK는 특정 상황에서 예외를 발생시킵니다. 전체 목록은 [`agen
593595
- 예상하지 못한 도구 관련 실패: 모델이 예상된 방식으로 도구를 사용하지 못하는 경우
594596
- [`ToolTimeoutError`][agents.exceptions.ToolTimeoutError]: 함수 도구 호출이 구성된 제한 시간을 초과하고 도구에서 `timeout_behavior="raise_exception"`을 사용하는 경우 이 예외가 발생합니다.
595597
- [`UserError`][agents.exceptions.UserError]: SDK를 사용하는 코드를 작성한 사람이 SDK를 사용하는 중 오류를 범하면 이 예외가 발생합니다. 일반적으로 잘못된 코드 구현, 유효하지 않은 구성 또는 SDK API의 잘못된 사용으로 인해 발생합니다.
596-
- [`InputGuardrailTripwireTriggered`][agents.exceptions.InputGuardrailTripwireTriggered], [`OutputGuardrailTripwireTriggered`][agents.exceptions.OutputGuardrailTripwireTriggered]: 각각 입력 가드레일 또는 출력 가드레일의 조건이 충족되면 이 예외가 발생합니다. 입력 가드레일은 처리 전에 수신 메시지를 검사하고, 출력 가드레일은 전달 전에 에이전트의 최종 응답을 검사합니다.
598+
- [`InputGuardrailTripwireTriggered`][agents.exceptions.InputGuardrailTripwireTriggered], [`OutputGuardrailTripwireTriggered`][agents.exceptions.OutputGuardrailTripwireTriggered]: 각각 입력 가드레일 또는 출력 가드레일의 조건이 충족되면 이 예외가 발생합니다. 입력 가드레일은 처리 전에 수신 메시지를 검사하고, 출력 가드레일은 전달 전에 에이전트의 최종 응답을 검사합니다.

docs/ko/tracing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ OpenAI 이외 모델에서 OpenAI API 키를 사용하면 트레이싱을 비활
168168

169169
```python
170170
import os
171-
from agents import set_tracing_export_api_key, Agent, Runner
171+
from agents import set_tracing_export_api_key, Agent
172172
from agents.extensions.models.any_llm_model import AnyLLMModel
173173

174174
tracing_api_key = os.environ["OPENAI_API_KEY"]
@@ -234,4 +234,4 @@ await Runner.run(
234234
- [Asqav](https://www.asqav.com/docs/integrations#openai-agents)
235235
- [Datadog](https://docs.datadoghq.com/llm_observability/instrumentation/auto_instrumentation/?tab=python#openai-agents)
236236
- [Latitude](https://docs.latitude.so/telemetry/frameworks/openai-agents)
237-
- [DProvenanceKit](https://dprovenance.dev/openai-agents/)
237+
- [DProvenanceKit](https://dprovenance.dev/openai-agents/)

docs/zh/running_agents.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ result = Runner.run_sync(
305305
你可以使用 [`RunResultBase.to_input_list()`][agents.result.RunResultBase.to_input_list] 方法获取下一轮输入,从而手动管理对话历史记录:
306306

307307
```python
308+
from agents import Agent, Runner, trace
309+
308310
async def main():
309311
agent = Agent(name="Assistant", instructions="Reply very concisely.")
310312

@@ -327,7 +329,7 @@ async def main():
327329
若要采用更简单的方式,可以使用 [Sessions](sessions/index.md) 自动处理对话历史记录,而无需手动调用 `.to_input_list()`
328330

329331
```python
330-
from agents import Agent, Runner, SQLiteSession
332+
from agents import Agent, Runner, SQLiteSession, trace
331333

332334
async def main():
333335
agent = Agent(name="Assistant", instructions="Reply very concisely.")
@@ -593,4 +595,4 @@ SDK 会在某些情况下引发异常。完整列表请参阅 [`agents.exception
593595
- 意外的工具相关故障:模型未能按预期方式使用工具。
594596
- [`ToolTimeoutError`][agents.exceptions.ToolTimeoutError]:当工具调用超过其配置的超时时间,并且该工具使用 `timeout_behavior="raise_exception"` 时,会引发此异常。
595597
- [`UserError`][agents.exceptions.UserError]:当你(使用 SDK 编写代码的人)在使用 SDK 时出错,会引发此异常。这通常是由代码实现不正确、配置无效或误用 SDK API 导致的。
596-
- [`InputGuardrailTripwireTriggered`][agents.exceptions.InputGuardrailTripwireTriggered][`OutputGuardrailTripwireTriggered`][agents.exceptions.OutputGuardrailTripwireTriggered]:分别在满足输入安全防护措施或输出安全防护措施的触发条件时引发。输入安全防护措施会在处理前检查传入消息,而输出安全防护措施会在交付前检查智能体的最终响应。
598+
- [`InputGuardrailTripwireTriggered`][agents.exceptions.InputGuardrailTripwireTriggered][`OutputGuardrailTripwireTriggered`][agents.exceptions.OutputGuardrailTripwireTriggered]:分别在满足输入安全防护措施或输出安全防护措施的触发条件时引发。输入安全防护措施会在处理前检查传入消息,而输出安全防护措施会在交付前检查智能体的最终响应。

docs/zh/tracing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async def main():
168168

169169
```python
170170
import os
171-
from agents import set_tracing_export_api_key, Agent, Runner
171+
from agents import set_tracing_export_api_key, Agent
172172
from agents.extensions.models.any_llm_model import AnyLLMModel
173173

174174
tracing_api_key = os.environ["OPENAI_API_KEY"]
@@ -234,4 +234,4 @@ await Runner.run(
234234
- [Asqav](https://www.asqav.com/docs/integrations#openai-agents)
235235
- [Datadog](https://docs.datadoghq.com/llm_observability/instrumentation/auto_instrumentation/?tab=python#openai-agents)
236236
- [Latitude](https://docs.latitude.so/telemetry/frameworks/openai-agents)
237-
- [DProvenanceKit](https://dprovenance.dev/openai-agents/)
237+
- [DProvenanceKit](https://dprovenance.dev/openai-agents/)

0 commit comments

Comments
 (0)