

# 도구 사용
<a name="speech-tools-use"></a>

**참고**  
이 설명서는 Amazon Nova 버전 1용입니다. Amazon Nova 2 Sonic 가이드는 [도구 구성](https://docs.aws.amazon.com/nova/latest/nova2-userguide/sonic-tool-configuration.html)을 참조하세요.

도구를 사용하려면 세션 구성에서 해당 도구를 `promptStart` 이벤트의 일부로 정의해야 합니다. 다음 코드에서 이를 확인할 수 있습니다.

```
{
  "event": {
    "promptStart": {
      "promptName": "string",
      "textOutputConfiguration": {
        "mediaType": "text/plain"
      },
      "audioOutputConfiguration": {
        "mediaType": "audio/lpcm",
        "sampleRateHertz": 8000 | 16000 | 24000,
        "sampleSizeBits": 16,
        "channelCount": 1,
        "voiceId": "matthew" | "tiffany" | "amy",
        "encoding": "base64",
        "audioType": "SPEECH"
      },
      "toolUseOutputConfiguration": {
        "mediaType": "application/json"
      },
      "toolConfiguration": {
        "tools": [
          {
            "toolSpec": {
              "name": "string",
              "description": "string",
              "inputSchema": {
                "json": "{}"
              }
            }
          }
        ]
      }
    }
  }
}
```

## 도구 정의 구성 요소
<a name="speech-tools-definition"></a>

각 도구 사양에는 다음 요소가 필요합니다.
+ **이름** - 도구의 고유 식별자입니다.
+ **설명** - 도구가 수행하는 작업과 언제 사용해야 하는지에 대한 설명입니다.
+ **입력 스키마** - 필수 파라미터를 정의하는 JSON 스키마입니다.

## 기본 도구 예제
<a name="speech-tools-example"></a>

다음은 현재 날짜에 대한 정보를 검색하는 간단한 도구의 예제입니다. 도구를 정의하는 방법에 대한 자세한 내용은 [도구 정의](https://docs.aws.amazon.com/nova/latest/userguide/tool-use-definition.html)를 참조하세요.

```
// A simple tool with no required parameters
const dateTool = {
  toolSpec: {
    name: "getDateTool",
    description: "Get information about the current date",
    inputSchema: {
      json: JSON.stringify({
        type: "object",
        properties: {},
        required: []
      })
    }
  }
};
```

`promptStart` 이벤트는 다음과 같습니다.

```
{
  event: {
    promptStart: {
      promptName: "string",
      textOutputConfiguration: {
        mediaType: "text/plain"
      },
      audioOutputConfiguration: {
        mediaType: "audio/lpcm",
        sampleRateHertz: 24000,
        sampleSizeBits: 16,
        channelCount: 1,
        voiceId: "tiffany",
        encoding: "base64",
        audioType: "SPEECH"
      },
      toolUseOutputConfiguration: {
        mediaType: "application/json"
      },
      toolConfiguration: {
        tools: [
          {
            toolSpec: {
              name: "getDateTool",
              description: "get information about the current date",
              inputSchema: {
                json: JSON.stringify({
                  type: "object",
                  properties: {},
                  required: []
                })
              }
            }
          }
        ]
      }
    }
  }
}
```