

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# SageMaker 筆記本環境中的生成式 AI
<a name="jupyterai"></a>

[Jupyter AI](https://github.com/jupyterlab/jupyter-ai) 是 JupyterLab 的開放原始碼延伸模組，將生成式 AI 功能整合至 Jupyter 筆記本。透過 Jupyter AI 聊天介面和魔術命令，使用者可實驗從自然語言指示產生的程式碼、解釋現有程式碼、詢問有關其本機檔案的問題、產生整個筆記本等。延伸模組會將 Jupyter 筆記本與大型語言模型 (LLM) 連線，使用者可以用來產生文字、程式碼或影像，以及詢問有關其自己資料的問題。Jupyter AI 支援生成式模型提供者，例如 AI21、Anthropic、 AWS (JumpStart 和 Amazon Bedrock)、Cohere 和 OpenAI。

您也可以使用 Amazon Q Developer 做為開箱可用的解決方案。您可以使用 Amazon Q Developer 搭配最少的組態開始，而不必手動設定模型的連線。當您啟用 Amazon Q Developer 時，它會成為 Jupyter AI 內的預設解決方案提供者。如需使用 Amazon Q Developer 的詳細資訊，請參閱 [SageMaker JupyterLab](studio-updated-jl.md)。

延伸模組的套件包含在 [Amazon SageMaker Distribution](https://github.com/aws/sagemaker-distribution) [1.2 版及更新版本](https://github.com/aws/sagemaker-distribution/tree/main/build_artifacts/v1)中。Amazon SageMaker Distribution 是適用於資料科學和科學運算的 Docker 環境，用作 JupyterLab 筆記本執行個體的預設映像。不同 IPython 環境的使用者可以手動安裝 Jupyter AI。

在本節中，我們提供 Jupyter AI 功能的概觀，並示範如何從 [JupyterLab](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-updated-jl.html) 或 [Studio Classic](https://docs.aws.amazon.com/sagemaker/latest/dg/studio.html) 筆記本設定 JumpStart 或 Amazon Bedrock 提供的模型。如需 Jupyter AI 專案的深入資訊，請參閱其[文件](https://jupyter-ai.readthedocs.io/en/latest/)。或者，您可以參考部落格文章 *[Jupyter 中的生成式 AI](https://blog.jupyter.org/generative-ai-in-jupyter-3f7174824862)*，以取得重要 Jupyter AI 功能的概觀和範例。

在使用 Jupyter AI 並與 LLM 互動之前，請確定您滿足下列先決條件：
+ 對於 託管的模型 AWS，您應該擁有 SageMaker AI 端點的 ARN 或可存取 Amazon Bedrock。對於其他模型提供者，您應該具有 API 金鑰，用來驗證和授權對模型的請求。Jupyter AI 支援廣泛的模型提供者和語言模型。請參閱其[支援的模型](https://jupyter-ai.readthedocs.io/en/latest/users/index.html#model-providers)清單，以隨時掌握最新的可用模型。如需有關如何在 JumpStart 中部署模型的資訊，請參閱 JumpStart 文件中的[部署模型](https://docs.aws.amazon.com/sagemaker/latest/dg/jumpstart-deploy.html)。您需要請求存取 [Amazon Bedrock](https://aws.amazon.com/bedrock/)，以將其用作模型提供者。
+ 確定 Jupyter AI 程式庫存在於您的環境中。如果沒有，請遵循 [Jupyter AI 安裝](sagemaker-jupyterai-installation.md)中的指示安裝所需的套件。
+ 在[存取 Jupyter AI 功能](sagemaker-jupyterai-overview.md)中熟悉 Jupyter AI 的功能。
+ 遵循[設定您的模型提供者](sagemaker-jupyterai-model-configuration.md)中的指示，設定您想要使用的目標模型。

完成先決條件步驟後，您可以繼續[在 JupyterLab 或 Studio Classic 中使用 Jupyter AI](sagemaker-jupyterai-use.md)。

**Topics**
+ [Jupyter AI 安裝](sagemaker-jupyterai-installation.md)
+ [存取 Jupyter AI 功能](sagemaker-jupyterai-overview.md)
+ [設定您的模型提供者](sagemaker-jupyterai-model-configuration.md)
+ [在 JupyterLab 或 Studio Classic 中使用 Jupyter AI](sagemaker-jupyterai-use.md)