با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
در این مرحله، شما آماده هستید تا نمونه را اجرا کنید و یک پرس و جو کنید.
در دستور زیر:
شناسه پروژه Google Cloud Platform را برای پروژه Action Console که ایجاد کردید my-dev-project جایگزین کنید. برای پیدا کردن شناسه پروژه در کنسول اقدامات ، پروژه را انتخاب کنید، روی نماد چرخ دنده کلیک کنید و تنظیمات پروژه را انتخاب کنید.
نام مدلی که در مرحله قبل ایجاد کردید را جایگزین my-model کنید.
(اختیاری) device-nickname با یک نام مستعار برای دستگاه جایگزین کنید. text-query با عبارتی جایگزین کنید که میخواهید دستیار پس از شروع به کار به طور خودکار به آن پاسخ دهد.
برای تغییر زبان Google Assistant یا فعال کردن نتایج شخصی، از برنامه Google Assistant استفاده کنید.
اگر دستگاهی با قابلیت Cast در همان شبکه دارید و با همان حساب کاربری پیکربندی شدهاید، میتوانید آن را از راه دور کنترل کنید:
Ok Google، Spotify را روی بلندگوی آشپزخانه بازی کنید .
برای پخش یک پیام صوتی، مطمئن شوید که ابتدا مکان دستگاه را در برنامه دستیار Google تنظیم کنید. سپس موارد زیر را امتحان کنید:
Ok Google، پخش بیا برای شام .
شناسه نمونه دستگاه را پیدا کنید
هنگامی که نمونه را برای اولین بار اجرا می کنید، یک نمونه دستگاه برای دستگاه خاص شما ایجاد می کند. این نمونه دستگاه با مدل دستگاهی که برای اجرای نمونه مشخص کردهاید مرتبط میشود. شما همچنین می توانید نمونه را خودتان با استفاده از ابزار ثبت نام ایجاد کنید.
نمونه شناسه نمونه دستگاه را ذخیره می کند. اگر نمونه را با همان شناسه مدل اجرا کنید، به طور پیش فرض از شناسه نمونه دستگاه ذخیره شده استفاده می کند.
شناسه نمونه دستگاه را در کنسول برای نمونه پیدا کنید.
اکنون که دستیار Google روی دستگاه شما کار می کند، زمان آن رسیده است که آن را گسترش دهید. میتوانید در اینجا به برخی از مراحل بعدی احتمالی نگاهی بیندازید یا به ایجاد Device Actions ادامه دهید.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe Google Assistant Library for Python is deprecated; use the Google Assistant Service instead.\u003c/p\u003e\n"],["\u003cp\u003eTo run the sample, replace placeholders with your project ID, model name, and optional nickname/query.\u003c/p\u003e\n"],["\u003cp\u003eYou can interact with the Assistant using voice commands for tasks like playing music, broadcasting messages, and getting information.\u003c/p\u003e\n"],["\u003cp\u003eThe sample generates a device instance ID, which can be found in the console output.\u003c/p\u003e\n"],["\u003cp\u003eAfter setup, you can explore next steps like extending functionality and creating Device Actions.\u003c/p\u003e\n"]]],["The Google Assistant sample can be run using the command `googlesamples-assistant-hotword` with specified project ID and device model. The Assistant can be activated by saying \"Ok Google\" or \"Hey Google\" and posing a query. The sample generates a unique device instance ID, saved for future use with the same model ID. The Assistant can interact with Cast-enabled devices and broadcast messages, after setup in the Google Assistant app. Further customization, and Device Actions, can be implemented.\n"],null,["# Run the Sample Code\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\nAt this point, you are ready to run the sample and make a query.\n\nIn the following command:\n\n- Replace \u003cvar translate=\"no\"\u003emy-dev-project\u003c/var\u003e with\n the Google Cloud Platform project ID for the Actions Console project you\n created. To find the project ID in the [Actions Console](https://console.actions.google.com/),\n select the project, click the gear icon, and select **Project settings**.\n\n- Replace \u003cvar translate=\"no\"\u003emy-model\u003c/var\u003e with the name of the model you\n created in the previous [step](/assistant/sdk/guides/library/python/embed/register-device).\n\n- (Optional) Replace \u003cvar translate=\"no\"\u003edevice-nickname\u003c/var\u003e with a nickname\n for the device. Replace \u003cvar translate=\"no\"\u003etext-query\u003c/var\u003e with a query you want\n the Assistant to automatically answer once it has started.\n\n```\ngooglesamples-assistant-hotword --project-id my-dev-project --device-model-id my-model [--nickname device-nickname] [--query text-query]\n```\n\nSay *Ok Google* or *Hey Google*, followed by your query. You can try some of the\nfollowing:\n\n- *Who am I?*\n- *Listen to This American Life podcast.*\n- *What is the weather in San Francisco?*\n\nIf the Assistant does not respond, follow the [troubleshooting instructions](/assistant/sdk/guides/library/troubleshooting#hotword).\n\nTo change the language for the Google Assistant or to enable personal results,\nuse the Google Assistant [app](/assistant/sdk/reference/assistant-app/assistant-settings).\n\nIf you have a [Cast-enabled](/cast) device on the same network and configured\nwith the same user account, you can control it remotely:\n\n- *Ok Google, play Spotify on the Kitchen Speaker*.\n\nTo broadcast a voice message, make sure to first set the device location in the\nGoogle Assistant [app](/assistant/sdk/reference/assistant-app/assistant-settings).\nThen try the following:\n\n- *Ok Google, broadcast Come to dinner*.\n\nFind the device instance ID\n---------------------------\n\nWhen you run the sample the first time, it will generate a device instance for\nyour particular device. This device instance will be associated with the device\nmodel that you specified to run the sample. You can also create the instance\nyourself using the [registration tool](/assistant/sdk/reference/device-registration/device-tool#register-device).\n\nThe sample saves the device instance ID. If you run the sample with the same\nmodel ID, it defaults to using the saved device instance ID.\n\nFind the device instance ID in the console for the sample. \n\n device_model_id: my-model\n device_id: 1C3E1558B0023E49F71CA0D241DA03CF # Device instance ID\n\n Registering...Done.\n\n ON_MUTED_CHANGED:\n {'is_muted': False}\n ON_START_FINISHED\n ...\n\nNext step\n---------\n\nNow that you have the Google Assistant working on your device, it is time to\nextend it. You can take a look at some possible next steps [here](/assistant/sdk/guides/library/python/embed/next-steps)\nor continue on to creating [Device Actions](/assistant/sdk/guides/library/python/extend/install-hardware)."]]