从 AWS Lex 调用内部系统(在防火墙后面)
Calling internal systems (behind firewall) from AWS Lex
我创建了一个 AWS Lex 聊天机器人,现在我必须查询一个内部 JIRA 来回答某些问题。我可以在 AWS Lex 中执行此操作吗?我尝试使用 AWS Lambda,但无法与内部系统通信。
或者是否有其他聊天机器人引擎允许我执行此操作,例如将配置的机器人称为每个话语 API。
找到替代方案。看起来 AWS Lex 不允许与内部系统交互,除非我们明确打开端口。我决定使用 Microsoft LUIS。这允许从内部系统调用 Intent 标识作为 API.
以下 Python 代码允许我从我的本地系统连接到已配置的 LUIS 服务。
########### Python 3.6 #############
import requests
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': 'xxxxxxxxxxxxxxx',
}
params ={
# Query parameter
'q': 'Can I book a travel ticket from LA to Chicago',
# Optional request parameters, set to default values
'timezoneOffset': '0',
'verbose': 'true',
'spellCheck': 'false',
'staging': 'true',
}
try:
r = requests.get('https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/XXX-XXX-XXX-XXX',headers=headers, params=params)
print(r.json())
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
我创建了一个 AWS Lex 聊天机器人,现在我必须查询一个内部 JIRA 来回答某些问题。我可以在 AWS Lex 中执行此操作吗?我尝试使用 AWS Lambda,但无法与内部系统通信。
或者是否有其他聊天机器人引擎允许我执行此操作,例如将配置的机器人称为每个话语 API。
找到替代方案。看起来 AWS Lex 不允许与内部系统交互,除非我们明确打开端口。我决定使用 Microsoft LUIS。这允许从内部系统调用 Intent 标识作为 API.
以下 Python 代码允许我从我的本地系统连接到已配置的 LUIS 服务。
########### Python 3.6 #############
import requests
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': 'xxxxxxxxxxxxxxx',
}
params ={
# Query parameter
'q': 'Can I book a travel ticket from LA to Chicago',
# Optional request parameters, set to default values
'timezoneOffset': '0',
'verbose': 'true',
'spellCheck': 'false',
'staging': 'true',
}
try:
r = requests.get('https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/XXX-XXX-XXX-XXX',headers=headers, params=params)
print(r.json())
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))