使用長上下文視窗
Amazon Nova Premier 支援的上下文長度為 100 萬個詞元,相當於 100 萬個文字詞元、500 張影像或 90 分鐘的影片。Amazon Nova Premier 擅長理解程式碼,並根據長文件回答問題。其效能可能會隨著上下文大小增加而略微下降,因此為獲得最佳結果,應考慮下列指導方針:
-
將長格式資料放在開頭:將長文件和輸入放在提示詞的開頭附近。它們應該放在您的查詢、指示和範例之前。
-
將指示放在末尾:將指示放在提示詞的末尾。當先提供上下文,並在末尾提供指示時,模型會發揮最佳效能。
-
結構化文件內容的開始和結束標記:使用開始和結束標記,例如
[Document Start]和[Document End],表示長文件的開始和結束。以下是一個範例範本:
// Provide your long inputs at the top of your prompt [Document Start] {{ Your document}} [Document End] // Then specify your query and instructions {{ User query}} {{ Instructions}} -
使用引文標記建立回應基礎:對於長文件任務,我們建議您指示 Amazon Nova 模型在繼續任務之前,使用文件相關區段的引文來建立回應基礎。這種方法有助於模型專注於最相關的資訊,避免因不必要的內容而分心。當您要求模型為其回應提供依據時,可以引用的區段應該編號。例如,Passage %[1]%、Passage %[2]% 等,或只是 <C1>、<C2> 等。如需如何在提示詞中包含引文的詳細資訊,請參閱建置您自己的 RAG。
以下為範例提示詞:
""" You are an AI financial assistant. Your task is to find patterns and insights from multi-year financial documents Passage %[1]% {{ Your document}} Passage %[2]% {{ Your document}} Passage %[3]% {{ Your document}} Passage %[4]% {{ Your document}} ## Task: Analyze Amazon's financial reports across multiple years to identify significant performance trends, segment growth patterns, and strategic shifts. ## Context information: - You have access to Amazon's annual financial reports (10-K) for multiple fiscal years in PDF format - These reports contain comprehensive financial data including income statements, balance sheets, cash flow statements, and management discussions - The analysis should focus on year-over-year comparisons to identify meaningful trends - Amazon operates multiple business segments including North America retail, International retail, Amazon Web Services (AWS), advertising, and subscription services Based on the provided Context, extract key financial metrics from each year's reports phrases from the documents, citing them using %[1]%, %[2]%, %[3]%, and for the corresponding passage that supports the response. ## Response Schema: %[1]% (Extracted Financial Metrics) %[2]% (Extracted Financial Metrics) %[3]% (Extracted Financial Metrics) ... """根據使用者的任務擷取關鍵資訊之後,您可以使用擷取的財務指標來回答相關問題,如下所示:
""" ## Task Analyze Amazon's financial reports across multiple years to identify significant performance trends, segment growth patterns, and strategic shifts. {{ extracted financial metrics }} ## Model Instructions: - Organize data chronologically to identify meaningful trends - DO compare segment performance across the five-year period - DO identify significant strategic shifts or investments mentioned in management discussions - DO NOT make speculative predictions beyond what is supported by the data - ALWAYS note any changes in accounting practices or reporting methodologies that might affect year-over-year comparisons ## Response style and format requirements: - Respond in markdown - Structure the analysis with clear headings and subheadings - Present key financial metrics in tabular format showing all five years side-by-side - Include percentage changes year-over-year for all major metrics - Create a section dedicated to visualizing the most significant trends (with descriptions of what would be shown in charts) - Limit the executive summary to 250 words maximum - Format segment analysis as separate sections with consistent metrics across all segments - MUST include a Key Insights bullet-pointed list at the end of each major section