Kể từ ngày 13 tháng 6 năm 2023, Hành động trò chuyện không còn được dùng nữa. Để biết thêm thông tin, hãy xem phần Hành động trò chuyện ngừng hoạt động.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Sau khi chạy Trợ lý Google trên dự án của bạn, hãy thử các cách sau:
Tuỳ chỉnh cách dự án của bạn tương tác với Trợ lý. Ví dụ: kích hoạt Trợ lý bằng cách nhấn một nút hoặc nhấp nháy đèn LED khi phát lại âm thanh. Thậm chí, bạn có thể hiển thị bản chép lời nhận dạng lời nói từ Trợ lý trên màn hình.
Kiểm soát dự án của bạn bằng Thao tác trên thiết bị.
Ví dụ: yêu cầu đèn của bạn (có Trợ lý tích hợp) bật và thay đổi độ sáng.
Tuỳ chỉnh cách dự án của bạn tương tác với Trợ lý
Kích hoạt Trợ lý
Với Thư viện Trợ lý Google, bạn sẽ kích hoạt một yêu cầu dành cho Trợ lý bằng cách nói một cụm từ kích hoạt như Ok Google. Bạn có thể tắt micrô để ngăn Trợ lý nghe cụm từ kích hoạt. Hãy sử dụng set_mic_mute() để kiểm soát việc này. Kích hoạt phương thức start_conversation()
dựa trên sự kiện tuỳ chỉnh của riêng bạn.
Nhận bản chép lời yêu cầu của người dùng
SDK Trợ lý Google cung cấp cho bạn một bản chép lời của yêu cầu của người dùng. Hãy sử dụng tính năng này để đưa ra ý kiến phản hồi cho người dùng bằng cách hiển thị văn bản lên màn hình hoặc thậm chí là cho một hành động sáng tạo hơn như thực hiện một số thao tác cục bộ trên thiết bị.
Bạn có thể thêm Hành động trên thiết bị vào Trợ lý để điều khiển thiết bị của mình qua giọng nói. Mở rộng mẫu Thư viện Trợ lý Google để đưa Hành động trên thiết bị vào.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eThe Google Assistant Library for Python is deprecated and developers should utilize the Google Assistant Service instead.\u003c/p\u003e\n"],["\u003cp\u003eCustomize Assistant interaction by triggering requests with custom events (e.g., button press) and displaying speech transcripts.\u003c/p\u003e\n"],["\u003cp\u003eControl your project using Device Actions, enabling voice control for functionalities like adjusting brightness.\u003c/p\u003e\n"],["\u003cp\u003eThe library provides methods for microphone control (\u003ccode\u003eset_mic_mute\u003c/code\u003e) and initiating conversations (\u003ccode\u003estart_conversation\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eAccess user request transcripts via the \u003ccode\u003eON_RECOGNIZING_SPEECH_FINISHED\u003c/code\u003e event for feedback or custom actions.\u003c/p\u003e\n"]]],[],null,["# Next Steps\n\n| **Warning:** The Google Assistant Library for Python is deprecated as of June 28th, 2019. Use the [Google Assistant Service](/assistant/sdk/guides/service/python) instead.\n\n\u003cbr /\u003e\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 Device Actions.\n For example, ask your lamp, with the Assistant built-in, to turn on and\n change its brightness.\n\nCustomize how your project interacts with the Assistant\n-------------------------------------------------------\n\n### Trigger the Assistant\n\nWith the Google Assistant Library, you trigger an Assistant request by speaking\na hotword like *Ok Google* . You can mute the microphone to stop the Assistant\nfrom listening for the hotword. Use the [`set_mic_mute()`](/assistant/sdk/reference/library/python#google.assistant.library.Assistant.set_mic_mute)\nto control this. Trigger the [`start_conversation()`](/assistant/sdk/reference/library/python#google.assistant.library.Assistant.start_conversation)\nmethod based on your own custom event.\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\nThe transcript is located in a Python string object in the [`ON_RECOGNIZING_SPEECH_FINISHED`](/assistant/sdk/reference/library/python#google.assistant.library.event.EventType.ON_RECOGNIZING_SPEECH_FINISHED)\nevent.\n\nControl your project with Device Actions\n----------------------------------------\n\nYou can add Device Actions to the Assistant that allow you to control your\ndevice via voice. [Extend](/assistant/sdk/guides/library/python/extend/install-hardware)\nthe Google Assistant Library sample to include [Device Actions](/assistant/sdk/device-actions-overview)."]]