Method: projects.matchIntents
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ค้นหา Intent ที่ตรงกับคำค้นหาที่ระบุ
คำขอ HTTP
POST https://actions.googleapis.com/v2/{project=projects/*}:matchIntents
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
project |
string
ต้องระบุ โปรเจ็กต์ที่กำลังทดสอบ ซึ่งระบุด้วยรหัสโปรเจ็กต์ รูปแบบ: projects/{project}
|
เนื้อหาของคำขอ
เนื้อหาของคำขอมีข้อมูลที่มีโครงสร้างต่อไปนี้
การแสดง JSON |
{
"query": string,
"locale": string
} |
ช่อง |
query |
string
ต้องระบุ คำค้นหาของผู้ใช้เป็นข้อความธรรมดา
|
locale |
string
ต้องระบุ ภาษาที่จะใช้ในการประเมินคำค้นหา เช่น "en" รูปแบบควรเป็นไปตาม BCP 47: https://tools.ietf.org/html/bcp47 ดูรายการภาษาที่รองรับใน https://developers.google.com/assistant/console/languages-locales
|
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
การตอบสนองสำหรับการค้นหา Intent ที่ตรงกัน
การแสดง JSON |
{
"matchedIntents": [
{
object (Intent )
}
]
} |
ช่อง |
matchedIntents[] |
object (Intent )
การจับคู่ Intent ที่ตรงกัน โดยเรียงลำดับจากมีความเกี่ยวข้องมากที่สุดไปน้อยที่สุด แสดงผลลัพธ์ที่ตรงกัน 50 รายการแรกเท่านั้น
|
ความตั้งใจ
การแสดง JSON |
{
"name": string,
"params": {
string: {
object (IntentParameterValue )
},
...
},
"query": string
} |
ช่อง |
name |
string
ต้องระบุ ชื่อของความตั้งใจที่ตรงกันล่าสุด
|
params |
map (key: string, value: object (IntentParameterValue ))
ต้องระบุ แสดงพารามิเตอร์ที่ระบุว่าเป็นส่วนหนึ่งของการจับคู่ Intent นี่คือการแมปชื่อพารามิเตอร์ที่ระบุกับค่าของพารามิเตอร์ที่ระบุจากข้อมูลจากผู้ใช้ พารามิเตอร์ทั้งหมดที่กำหนดไว้ในความตั้งใจที่ตรงกันซึ่งระบุไว้จะแสดงที่นี่ ออบเจ็กต์ที่มีรายการคู่ "key": value ตัวอย่างเช่น { "name": "wrench", "mass": "1.3kg", "count": "3" }
|
query |
string
ไม่บังคับ ข้อความที่พิมพ์หรือพูดจากผู้ใช้ปลายทางที่ตรงกับความตั้งใจนี้ ระบบจะป้อนข้อมูลนี้เมื่อมีการจับคู่ Intent ตามข้อมูลจากผู้ใช้
|
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eFinds the intents that match a given user query, returning the top 50 matches ranked by relevance.\u003c/p\u003e\n"],["\u003cp\u003eRequires a \u003ccode\u003ePOST\u003c/code\u003e request to the specified endpoint, including the project ID and user query.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must contain the user query as plain text and the locale for evaluation.\u003c/p\u003e\n"],["\u003cp\u003eThe response includes a list of matched intents, each with its name, parameters, and the original query.\u003c/p\u003e\n"],["\u003cp\u003eEach intent object provides details like the intent name, identified parameters, and the portion of the user input that triggered the match.\u003c/p\u003e\n"]]],["This document details the process of matching user queries to intents via a `POST` request to `https://actions.googleapis.com/v2/{project=projects/*}:matchIntents`. The request requires a `project` path parameter, a JSON body with `query` and `locale` strings. The response returns a JSON object with `matchedIntents`, an array of matched intents, each with `name`, `params` (parameter name-value pairs), and `query` fields. Only the first 50 matching intents are returned, ordered from most to least relevant.\n"],null,["# Method: projects.matchIntents\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.MatchIntentsResponse.SCHEMA_REPRESENTATION)\n- [Intent](#Intent)\n - [JSON representation](#Intent.SCHEMA_REPRESENTATION)\n\nFinds the intents that match a given query.\n\n### HTTP request\n\n`POST https://actions.googleapis.com/v2/{project=projects/*}:matchIntents`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------|------------------------------------------------------------------------------------------------------|\n| `project` | `string` Required. The project being tested, indicated by the Project ID. Format: projects/{project} |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation ||\n|-----------------------------------------------|---|\n| ``` { \"query\": string, \"locale\": string } ``` |\n\n| Fields ||\n|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `query` | `string` Required. User query as plain text. |\n| `locale` | `string` Required. Locale to use to evaluate the query, such as \"en\". The format should follow BCP 47: \u003chttps://tools.ietf.org/html/bcp47\u003e See the list of supported languages in \u003chttps://developers.google.com/assistant/console/languages-locales\u003e |\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\nResponse for finding matching intents.\n\n| JSON representation ||\n|----------------------------------------------------------------------------------------------------------------------|---|\n| ``` { \"matchedIntents\": [ { object (/assistant/actions/api/reference/rest/v2/projects/matchIntents#Intent) } ] } ``` |\n\n| Fields ||\n|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `matchedIntents[]` | `object (`[Intent](/assistant/actions/api/reference/rest/v2/projects/matchIntents#Intent)`)` Intents matched, ordered from most to least relevant. Only the first 50 matches are returned. |\n\nIntent\n------\n\nRepresents an intent.\n\n| JSON representation ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` { \"name\": string, \"params\": { string: { object (/assistant/actions/api/reference/rest/v2/IntentParameterValue) }, ... }, \"query\": string } ``` |\n\n| Fields ||\n|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Required. The name of the last matched intent. |\n| `params` | `map (key: string, value: object (`[IntentParameterValue](/assistant/actions/api/reference/rest/v2/IntentParameterValue)`))` Required. Represents parameters identified as part of intent matching. This is a map of the name of the identified parameter to the value of the parameter identified from user input. All parameters defined in the matched intent that are identified will be surfaced here. An object containing a list of `\"key\": value` pairs. Example: `{ \"name\": \"wrench\", \"mass\": \"1.3kg\", \"count\": \"3\" }`. |\n| `query` | `string` Optional. Typed or spoken input from the end user that matched this intent. This will be populated when an intent is matched, based on the user input. |"]]