按日期分类的 Watson 对话日志
Watson Conversation Logs by Date
我想知道是否有办法使用 Watson Python SDK 提取特定时间段内的 Watson 对话日志?还有没有办法避免在日志末尾添加分页?我想提取给定时间段内的所有日志。下面是我当前使用的代码,它为特定工作区提取日志:
import json
import watson_developer_cloud
conversation = watson_developer_cloud.ConversationV1(
username='xxxxxxxxxx',
password- 'xxxxxxxx',
version='2017-05-26'
)
response = conversation.list_logs(
workspace_id = 'xxxxxxx'
)
js = json.dumps(response,indent=2)
with open('data.txt', 'w') as outfile:
json.dump(response, outfile)
正如您在 Official documentation 上看到的那样,您可以使用 filter
参数来列出日志并有很多选项可供使用。
过滤器:filter/string
一个可缓存的参数,用于将结果限制为与指定过滤器匹配的结果。有关详细信息,请参阅过滤器查询参考。
The timestamp of the response is earlier than
2016-11-01T04:00:00.000Z.
response_timestamp<2016-11-01T04:00:00.000Z
所以你需要用你的response_timestamp
替换:
list_logs(workspace_id, sort=None, filter=paste here, page_limit=None, cursor=None)
- 使用 Logs - Watson Conversation 查看有关过滤器参数的更多信息。
- 参见官方 API 参考 about Logs using Python。
我想知道是否有办法使用 Watson Python SDK 提取特定时间段内的 Watson 对话日志?还有没有办法避免在日志末尾添加分页?我想提取给定时间段内的所有日志。下面是我当前使用的代码,它为特定工作区提取日志:
import json
import watson_developer_cloud
conversation = watson_developer_cloud.ConversationV1(
username='xxxxxxxxxx',
password- 'xxxxxxxx',
version='2017-05-26'
)
response = conversation.list_logs(
workspace_id = 'xxxxxxx'
)
js = json.dumps(response,indent=2)
with open('data.txt', 'w') as outfile:
json.dump(response, outfile)
正如您在 Official documentation 上看到的那样,您可以使用 filter
参数来列出日志并有很多选项可供使用。
过滤器:filter/string
一个可缓存的参数,用于将结果限制为与指定过滤器匹配的结果。有关详细信息,请参阅过滤器查询参考。
The timestamp of the response is earlier than 2016-11-01T04:00:00.000Z.
response_timestamp<2016-11-01T04:00:00.000Z
所以你需要用你的response_timestamp
替换:
list_logs(workspace_id, sort=None, filter=paste here, page_limit=None, cursor=None)
- 使用 Logs - Watson Conversation 查看有关过滤器参数的更多信息。
- 参见官方 API 参考 about Logs using Python。