免责声明:此存储库中提供的脚本反映了Amazon Q的业务状态,因为它于2023年12月由AWS在Preview Mode启动。由于此预览模式,Amazon Q及其实现的功能可以在预览期间的任何时间发生变化,并且可以进行一般可用性。这样的更改可能需要对此存储库的更新。
该项目收集了各种工具和实用脚本,以探索和操作Amazon Q for Business。我们将根据您的需求添加新脚本:如果您有需要或想法,请随时在此处裁定票!
我们目前提供以下公用事业:
所有这些脚本都会返回可以在壳管道中进一步处理的JSON结构,这些结构具有JQ,SED,AWK等各种公用事业。
这些脚本依靠Python AWS SDK。 SDK BOTO3公共文档中详细描述了与业务Q相关的所有API。
Amazon Q是一家完全管理的,生成的动力助手,可以配置为回答问题,提供摘要,生成内容和基于企业中数据的完整任务。 Amazon Q向其用户提供了即时和相关的信息,并帮助简化任务并加速解决问题。
Amazon Q应用程序依靠文档来构建其特定的Q索引。该文档语料库存储在一个或多个文档存储库中(S3,Jira,Quip等),称为Q数据源。助手对用户问题的答案将通过抹布技术的杠杆作用。
检索增强发电(RAG)是一种自然语言处理(NLP)技术。它由基于语言模型的系统(通常是大型语言模型(LLM))组成,该系统访问外部知识源以完成任务。这可以使更多的上下文性,事实一致性,提高生成的响应的可靠性,并有助于减轻“幻觉”的问题。
该项目的脚本假设AWS用户被称为AWS_ACCESS_KEY_ID和AWS_SECRET_ACCESS_KEY的环境变量反射的AWS用户具有适当的IAM凭据,以访问AWS帐户中Amazon Q的API。有关所有详细信息,请参见Q文档安全部分中的IAM策略示例。
从该项目的 /src目录中,可以使用以下命令获取所有命令选项
对于List_applications.py
%python3 q_list_applications.py -h
usage: q_list_applications.py [-h] [-v]
list applications, indexes, retrievers, web experiences, plugins, etc. running in Amazon Q for business
options:
-h, --help show this help message and exit
-v, --verbose verbose mode
q_list_data_source_sync_jobs
% python3 q_list_data_source_sync_jobs.py -h
usage: q_list_data_source_sync_jobs.py [-h] [-a APP_ID] [-i IDX_ID] [-d DS_ID] [-v]
list synchronization jobs executed for a given data source of an Amazon Q application
options:
-h, --help show this help message and exit
-a APP_ID, --app_id APP_ID
Q application id
-i IDX_ID, --idx_id IDX_ID
Q data source id
-d DS_ID, --ds_id DS_ID
Q data source id
-v, --verbose verbose mode
对于q_list_documents.py
% python3 q_list_documents.py -h
usage: q_list_documents.py [-h] [-a APP_ID] [-i IDX_ID] [-incl INCLUDE] [-excl EXCLUDE] [-inv] [-v]
list documents indexed by Amazon Q
options:
-h, --help show this help message and exit
-a APP_ID, --app_id APP_ID
Q application id
-i IDX_ID, --idx_id IDX_ID
Q index id
-incl INCLUDE, --include INCLUDE
comma-separated list of status to include
-excl EXCLUDE, --exclude EXCLUDE
comma-separated list of status to exclude
-inv, --inventory with document inventory
-v, --verbose verbose mode
对于q_list_conversations.py
% python3 q_list_conversations.py -h
usage: q_list_conversations.py [-h] [-a APP_ID] [-u USR_ID] [-v]
list documents indexed by Amazon Q
options:
-h, --help show this help message and exit
-a APP_ID, --app_id APP_ID
Q application id
-u USR_ID, --usr_id USR_ID
Q user id
-v, --verbose verbose mode
对于q_chat.py
% python3 q_chat.py -h
usage: q_chat.py [-h] [-a APP_ID] [-u USR_ID] [-p PROMPT] [-f FILE] [-c CNV_ID] [-m MSG_ID] [-d] [-v]
ask a question to a Q application and get answer
options:
-h, --help show this help message and exit
-a APP_ID, --app_id APP_ID
Q application id
-u USR_ID, --usr_id USR_ID
Q index id
-p PROMPT, --prompt PROMPT
question prompt or path to file with list of prompts
-f FILE, --file FILE path to attachment file
-c CNV_ID, --cnv_id CNV_ID
Q conversation id (only to continue an existing conversation)
-m MSG_ID, --msg_id MSG_ID
Q parent message id (only to continue an existing conversation)
-d, --details full conversation details
-v, --verbose verbose mode