프로젝트가 어시스턴트와 상호작용하는 방식을 맞춤설정합니다. 예를 들어 오디오를 재생할 때 버튼을 눌러 어시스턴트를 트리거하거나 LED를 깜박입니다. 어시스턴트의 음성 인식 스크립트를 디스플레이에 표시할 수도 있습니다.
커스텀 명령어로 프로젝트를 제어합니다.
예를 들어 어시스턴트 지원 mocktail Maker에 좋아하는 음료를 만들어 달라고 요청합니다.
프로젝트가 어시스턴트와 상호작용하는 방식 맞춤설정
어시스턴트 트리거
Google Assistant Service API를 사용하면 어시스턴트 요청을 트리거할 시기를 제어할 수 있습니다. 샘플 코드를 수정하여 이를 제어합니다 (예: 버튼을 누름). 어시스턴트 요청은 EmbeddedAssistant.Assist에 요청을 전송하여 트리거됩니다.
사용자 요청의 스크립트 가져오기
Google 어시스턴트 SDK는 사용자 요청의 텍스트 스크립트를 제공합니다. 이 기능을 사용하면 텍스트를 디스플레이에 렌더링하거나 기기에서 로컬 작업을 실행하는 등 좀 더 창의적인 작업을 통해 사용자에게 피드백을 제공할 수 있습니다.
Google 어시스턴트 SDK는 특정 쿼리에 대한 시각적 응답인 경우 어시스턴트 응답을 디스플레이에 렌더링하도록 지원합니다. 예를 들어 마운틴뷰의 날씨는 무엇인가요?라는 쿼리는 현재 온도, 날씨를 그림으로 표현한 다음 관련 쿼리에 대한 제안을 렌더링합니다. 이 기능이 사용 설정된 경우 이 HTML5 데이터 (있는 경우)는
ScreenOut.data 필드에 있습니다.
--display 명령줄 플래그를 사용하여 pushtotalk.py 및 textinput.py샘플에서 사용 설정할 수 있습니다. 데이터가 브라우저 창에 렌더링됩니다.
텍스트 입력을 통한 쿼리 제출
기기에 텍스트 인터페이스 (예: 키보드)가 연결되어 있는 경우 config 필드에서 text_query 필드를 설정합니다 (AssistConfig 참고). audio_in_config 필드는 설정하지 마세요.
샘플 코드에는 textinput.py 파일이 포함되어 있습니다. 이 파일을 실행하면 텍스트 입력을 통해 쿼리를 제출할 수 있습니다.
오디오 파일 입력을 통한 쿼리 제출
샘플 코드에는 audiofileinput.py 파일이 포함되어 있습니다. 이 파일을 실행하면 오디오 파일을 통해 쿼리를 제출할 수 있습니다. 샘플은 어시스턴트의 응답이 포함된 오디오 파일을 출력합니다.
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eCustomize interactions with the Google Assistant, such as triggering it with a button or displaying speech recognition transcripts.\u003c/p\u003e\n"],["\u003cp\u003eControl your projects using custom commands through Device Actions or IFTTT recipes.\u003c/p\u003e\n"],["\u003cp\u003eAccess the Assistant's response in various formats like text, HTML for visual responses, and audio.\u003c/p\u003e\n"],["\u003cp\u003eSubmit queries to the Assistant using either text input (like a keyboard) or audio files.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the provided sample code and documentation to integrate these features into your projects.\u003c/p\u003e\n"]]],[],null,["# Next Steps\n\nOnce you have the Google Assistant running on your project, give these a try:\n\n1. [Customize](#custom-interaction) how your project interacts with the\n Assistant. For example, trigger the Assistant with the push of a button or\n blink an LED when playing back audio. You can even show a speech recognition\n transcript from the Assistant on a display.\n\n2. [Control](#device-control) your project with custom commands.\n For example, ask your Assistant-enabled [mocktail maker](http://deeplocal.com/mocktailsmixer/)\n to make your favorite drink.\n\nCustomize how your project interacts with the Assistant\n-------------------------------------------------------\n\n### Trigger the Assistant\n\nWith the Google Assistant Service API, you control when to trigger an Assistant\nrequest. Modify the [sample code](https://github.com/googlesamples/assistant-sdk-python/tree/master/google-assistant-sdk/googlesamples/assistant/grpc)\nto control this (for example, at the push of a button). Triggering\nan Assistant request is done by sending a request to [`EmbeddedAssistant.Assist`](/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#google.assistant.embedded.v1alpha2.EmbeddedAssistant.Assist).\n\n### Get the transcript of the user request\n\nThe Google Assistant SDK gives you a text transcript of the user request. Use\nthis to provide feedback to the user by rendering the text to a display, or even\nfor something more creative such as performing some local actions on the device.\n\nThis transcript is located in the [`SpeechRecognitionResult.transcript`](/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#speechrecognitionresult) field.\n\n### Get the text of the Assistant's response\n\nThe Google Assistant SDK gives you the plain text of the Assistant response. Use this\nto provide feedback to the user by rendering the text to a display.\n\nThis text is located in the [`DialogStateOut.supplemental_display_text`](/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#dialogstateout)\nfield.\n\n### Get the Assistant's visual response\n\nThe Google Assistant SDK supports rendering the Assistant response to a\ndisplay in the case of visual responses to certain queries. For example,\nthe query *What is the weather in Mountain View?* will render the current\ntemperature, a pictorial representation of the weather, and suggestions for\nrelated queries. This HTML5 data (if present) is located in the\n[`ScreenOut.data`](/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#screenout) field if this feature is [enabled](/assistant/sdk/guides/service/integrate#text-response).\n\nThis can be enabled in the `pushtotalk.py` and `textinput.py` [samples](https://github.com/googlesamples/assistant-sdk-python/tree/master/google-assistant-sdk/googlesamples/assistant/grpc)\nwith the `--display` command line flag. The data is rendered in a browser window.\n| **Note:** If you are sending commands over SSH to a Raspberry Pi with a connected display, make sure you run `export DISPLAY=:0` before running the sample with the `--display` command line flag.\n\n### Submitting queries via text input\n\nIf you have a text interface (for example, a keyboard) attached to the device,\nset the `text_query` field in the `config` field (see [`AssistConfig`](/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#assistconfig)).\nDo not set the `audio_in_config` field.\n\nThe [sample code](https://github.com/googlesamples/assistant-sdk-python/tree/master/google-assistant-sdk/googlesamples/assistant/grpc)\nincludes the file `textinput.py`. You can run this file to submit queries via\ntext input.\n\n### Submitting queries via audio file input\n\nThe [sample code](https://github.com/googlesamples/assistant-sdk-python/tree/master/google-assistant-sdk/googlesamples/assistant/grpc)\nincludes the file `audiofileinput.py`. You can run this file to submit a query\nvia an audio file. The sample outputs an audio file with the Assistant's response.\n\nControl your project with custom commands\n-----------------------------------------\n\nYou can add custom commands to the Assistant that allow you to control your\nproject via voice.\n\nHere are two ways to do this:\n\n- Extend the Google Assistant Service sample to include [Device Actions](/assistant/sdk/guides/service/python/extend/install-hardware).\n\n- Create an [IFTTT recipe](https://support.google.com/googlehome/answer/7194656)\n for the Assistant. Then configure IFTTT to make a custom HTTP request to an\n endpoint you choose in response to an Assistant command. To do so, use\n [Maker IFTTT actions](http://maker.ifttt.com)."]]