google-cloud-platform - 找不到 EntityType - SessionEntityType 名称由 Session 名称和 EntityType.display_name 组成
问题描述
即使我在 中提供了正确的信息,我仍然SessionEntityTypes
收到以下错误。尝试了 REST 和 Python 选项,如果集成中缺少任何内容,请告诉我。
请求 HTTP 方法:POST
{
"name": "projects/{projectId}/locations/asia-northeast1/agent/environments/draft/users/-/sessions/c973fe-e44-9b5-34e-b404439b7/entityTypes/speciality_types",
"entities": [
{
"value": "APPLE_KEY",
"synonyms": [
"apple",
"green apple",
"crabapple"
]
},
{
"value": "ORANGE_KEY",
"synonyms": [
"orange"
]
}
],
"entityOverrideMode": "ENTITY_OVERRIDE_MODE_SUPPLEMENT"
}
回复
{
"error": {
"code": 400,
"message": "com.google.apps.framework.request.BadRequestException: Cannot find the EntityType of SessionEntityType 'projects/{projectId}/locations/asia-northeast1/agent/environments/draft/users/-/sessions/c973fe-e44-9b5-34e-b404439b7/entityTypes/speciality_types'. Please note that the SessionEntityType name is composed of Session name and EntityType.display_name.",
"status": "INVALID_ARGUMENT"
}
}
谷歌试试这个 API
解决方案
我将在这里解释这个问题,以确保我不会遗漏任何细节:您正在尝试使用“Try this API”工具创建一个 sessionEntity ,它是 Create (POST) 版本 2。
问题是您在请求正文中传递的“名称”没有API v2的有效格式。
您使用的名称格式是:
projects/<ProjectID>/locations/<LocationID>/agent/environments/<EnvironmentID>/users/<UserID>/sessions/<SessionID>/entityTypes/<EntityTypeDisplayName>
下面我列出了 v2 的两种有效名称格式,您可以看到不需要位置/<Location ID> :
projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>
和
projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display Name>
以下请求正文按预期工作,我在同一个“试用此 API”工具中对其进行了测试:
{
"name":"projects/{projectId}/agent/environments/draft/users/-/sessions/c973fe-e44-9b5-34e-b404439b7/entityTypes/speciality_types",
"entities":[
{
"value":"APPLE_KEY",
"synonyms":[
"apple",
"green apple",
"crabapple"
]
},
{
"value":"ORANGE_KEY",
"synonyms":[
"orange"
]
}
],
"entityOverrideMode":"ENTITY_OVERRIDE_MODE_SUPPLEMENT"
}
推荐阅读
- laravel - 无法从用户那里获取更多项目
- batch-file - 重命名子文件夹中的文件并通过批处理覆盖
- spring - 使用Testng编写spring boot的单元测试
- visual-studio - 无法安装 appcenter-cli(找不到命令)
- java - 是否可以在 CardLayout 上有一个 CardLayout
- javascript - 在动态创建的 UL 上使用 Sortable
- javascript - 如何处理 Redux 商店中的单个值?
- google-chrome - 使用 source map 调试 openlayers 5 应用程序
- ios - 订阅 UITextfield(控制事件,编辑更改)
- azure-sql-database - ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE 不删除缓存?