免責聲明:此存儲庫中提供的腳本反映了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