Sure, here's the HTML structure with the text translated into simplified Chinese: ```html 使用Azure构建具有图像理解和分层文档结构分析的智能RAG

使用Azure构建具有图像理解和分层文档结构分析的智能RAG

``` In simplified Chinese: ```html 使用Azure构建具有图像理解和分层文档结构分析的智能RAG

使用Azure构建具有图像理解和分层文档结构分析的智能RAG

``` This HTML structure retains the original English text translated into simplified Chinese and can be displayed correctly in a web browser supporting Chinese characters.

Certainly! Here's the HTML structure with the translated text in simplified Chinese: ```html

Retrieval-Augmented Generation Models

检索增强生成(RAG)模型的出现

在自然语言处理(NLP)领域,检索增强生成(RAG)模型的出现是一个重要的里程碑。这些模型将信息检索的能力与生成式语言模型结合,产生不仅准确而且在语境上丰富的答案。

然而,随着数字宇宙扩展至超出文本数据范围,将图像理解和分层文档结构分析纳入RAG系统变得日益关键。本文探讨了这两个元素如何显著增强RAG模型的能力。

``` In this HTML structure: - `

` is used for the main heading. - `

` tags are used for paragraphs of text. The simplified Chinese translation of the text is embedded within the `

` tags.

Sure, here is the translation of "Understanding RAG Models" into simplified Chinese, while maintaining the HTML structure: ```html 理解 RAG 模型 ``` In this HTML snippet, the text "理解 RAG 模型" translates to "Understanding RAG Models" in simplified Chinese.

```html

在深入讨论图像理解和文档分析的细微差别之前,让我们简要地谈谈RAG模型的本质。这些系统首先通过从庞大语料库中检索相关文档,然后利用生成模型将信息合成为连贯的响应。检索组件确保模型能够获取准确和最新的信息,而生成组件则允许生成类似人类的文本。

```

Sure, here's the text translated into simplified Chinese while maintaining HTML structure: ```html
图像理解与结构分析
```

Sure, here's how you can write "The Challenge" in simplified Chinese within an HTML structure: ```html 挑战 ``` This HTML snippet uses the `` tag with the `lang` attribute set to `"zh-CN"` for simplified Chinese. The text "挑战" translates to "The Challenge" in English.

```html

传统的RAG模型最显著的限制之一是它们无法理解和解释视觉数据。在图像普遍伴随文本信息的世界中,这代表了模型理解能力中的重大差距。文档不仅仅是文本字符串;它们具有结构 —— 章节、子章节、段落和列表 —— 所有这些传达了语义重要性。传统的RAG模型常常忽视这种层次结构,可能会错过理解文档完整含义的机会。

```

Sure, here's the translation of "The Solution" into simplified Chinese, keeping the HTML structure intact: ```html 解决方案 ``` In this HTML snippet: - `` specifies that the enclosed text is in simplified Chinese. - `解决方案` is the simplified Chinese translation for "The Solution".

Sure, here's the translation in simplified Chinese while keeping the HTML structure intact: ```html

为了弥合这一差距,可以通过增加计算机视觉(CV)功能来扩展RAG模型。这涉及集成图像识别和理解模块,这些模块能够分析视觉数据,提取相关信息,并将其转换为RAG模型可以处理的文本格式。包括层次化文档结构分析在内,涉及教授RAG模型识别和解释文档的基本结构。

``` This HTML snippet contains the translated text in simplified Chinese.

Sure, here is the translation of "Implementation" into simplified Chinese, while keeping the HTML structure: ```html 实施 ``` In this HTML snippet: - `` is used to denote a small section of text that is set off from the rest of the content. - `lang="zh-CN"` specifies the language of the text as simplified Chinese. - `实施` is the translation of "Implementation" in simplified Chinese.

  • Sure, here's the translation of the text into simplified Chinese, while keeping the HTML structure intact: ```html Visual Feature Extraction: 使用预训练的神经网络识别图像中的对象、场景和活动。 ``` This HTML snippet maintains the structure while providing the translated text.
  • Certainly! Here's the HTML structure with the translated text in simplified Chinese: ```html

    视觉语义:开发能理解视觉内容背景和语义的算法。

    ```
  • Certainly! Here's how you can structure the HTML while translating the text to simplified Chinese: ```html

    多模态数据融合:将提取的视觉信息与文本数据结合,为RAG系统创建多模态上下文。

    ``` In this HTML snippet: - `

    ` tags are used to enclose the translated Chinese text to maintain proper structure. - The text "Multimodal Data Fusion" is translated to "多模态数据融合". - The rest of the sentence is translated as requested. This way, the structure of your HTML document remains intact while incorporating the translated text in simplified Chinese.

  • Sure, here is the HTML structure with the translated text in simplified Chinese: ```html 结构识别

    结构识别:

    实现算法来识别文档中不同层次的结构,比如标题、段落和项目符号。

    ``` Translated text in simplified Chinese: ```html 结构识别

    结构识别:

    实现算法来识别文档中不同层次的结构,比如标题、段落和项目符号。

    ```
  • Certainly! Here's the HTML structure with the translated text in simplified Chinese: ```html

    Semantic Role Labeling: Assign semantic roles to different parts of the document, understanding the purpose of each section.

    ``` Translated text in simplified Chinese: ```html

    语义角色标注:为文档的不同部分分配语义角色,理解每个部分的目的。

    ```
  • Certainly! Here's the translated text in simplified Chinese, while keeping the HTML structure intact: ```html

    结构感知检索:通过考虑文档的层次结构来增强检索过程,确保生成过程中使用最相关的部分。

    ``` In this HTML snippet: - `

    ` denotes a paragraph tag, which is commonly used for text content in HTML. - The Chinese text inside the `

    ` tags is the translation of "Structure-Aware Retrieval: Enhance the retrieval process by considering the hierarchical structure of documents, ensuring that the most relevant sections are used for generation."

在本博客中,我们将探讨如何使用Azure文档智能、LangChain和Azure OpenAI来实现这一点。

Certainly! Here's the translation of "Prerequisites" into simplified Chinese, while keeping the HTML structure intact: ```html

先决条件

``` In this HTML snippet: - `

` is the HTML tag for a top-level heading. - `先决条件` is the translation of "Prerequisites" into simplified Chinese.

Sure, here is the translated text in simplified Chinese, while keeping the HTML structure intact: ```html

在我们实施之前,我们将需要一些先决条件。

```
  • Sure, here's how you would write "GPT-4-Vision-Preview model deployed" in simplified Chinese within an HTML structure: ```html

    GPT-4-Vision-Preview 模型部署完成

    ``` This HTML snippet includes the translated text "GPT-4-Vision-Preview 模型部署完成" where "模型部署完成" means "model deployed".
  • Sure, here's the text "GPT-4–1106-Preview model deployed" translated into simplified Chinese while maintaining the HTML structure: ```html GPT-4–1106-预览模型部署完成 ``` In this translation: - "GPT-4–1106-预览模型部署完成" corresponds to "GPT-4–1106-Preview model deployed" in simplified Chinese. - `` tags are used to ensure the text is displayed inline, typically used for small sections of text within a paragraph or sentence in HTML.
  • Certainly! Here's the translation of "text-ada-embedding model deployed" in simplified Chinese while keeping the HTML structure: ```html 文本-ADA嵌入模型部署 ```
  • Sure, here's the translated text in simplified Chinese, keeping the HTML structure intact: ```html Azure 文档智能已部署 ``` This translates "Azure Document Intelligence deployed" into "Azure 文档智能已部署" in simplified Chinese.

Sure, here's the translated text in simplified Chinese within an HTML structure: ```html

一旦我们获得了以上信息,让我们开始吧!!

```

Certainly! Here's how you can write "Let’s import the required libraries." in simplified Chinese while keeping the HTML structure intact: ```html

让我们导入所需的库。

```
import os
from dotenv import load_dotenv
load_dotenv('azure.env')

from langchain import hub
from langchain_openai import AzureChatOpenAI
#from langchain_community.document_loaders import AzureAIDocumentIntelligenceLoader
from doc_intelligence import AzureAIDocumentIntelligenceLoader
from langchain_openai import AzureOpenAIEmbeddings
from langchain.schema import StrOutputParser
from langchain.schema.runnable import RunnablePassthrough
from langchain.text_splitter import MarkdownHeaderTextSplitter
from langchain.vectorstores.azuresearch import AzureSearch
from azure.ai.documentintelligence.models import DocumentAnalysisFeature

Sure, here is the HTML structure with the translated text in simplified Chinese: ```html

现在我们将在LangChain文档加载器之上编写一些自定义函数,帮助我们加载PDF文档。首先,我们使用Azure文档智能功能,这个功能可以将图像转换为Markdown格式。让我们使用同样的方法。

``` Translated text in simplified Chinese: "现在我们将在LangChain文档加载器之上编写一些自定义函数,帮助我们加载PDF文档。首先,我们使用Azure文档智能功能,这个功能可以将图像转换为Markdown格式。让我们使用同样的方法。"
import logging
from typing import Any, Iterator, List, Optional
import os
from langchain_core.documents import Document
from langchain_community.document_loaders.base import BaseLoader
from langchain_community.document_loaders.base import BaseBlobParser
from langchain_community.document_loaders.blob_loaders import Blob

logger = logging.getLogger(__name__)

class AzureAIDocumentIntelligenceLoader(BaseLoader):
"""Loads a PDF with Azure Document Intelligence"""

def __init__(
self,
api_endpoint: str,
api_key: str,
file_path: Optional[str] = None,
url_path: Optional[str] = None,
api_version: Optional[str] = None,
api_model: str = "prebuilt-layout",
mode: str = "markdown",
*,
analysis_features: Optional[List[str]] = None,
) -> None:
"""
Initialize the object for file processing with Azure Document Intelligence
(formerly Form Recognizer).

This constructor initializes a AzureAIDocumentIntelligenceParser object to be
used for parsing files using the Azure Document Intelligence API. The load
method generates Documents whose content representations are determined by the
mode parameter.

Parameters:
-----------
api_endpoint: str
The API endpoint to use for DocumentIntelligenceClient construction.
api_key: str
The API key to use for DocumentIntelligenceClient construction.
file_path : Optional[str]
The path to the file that needs to be loaded.
Either file_path or url_path must be specified.
url_path : Optional[str]
The URL to the file that needs to be loaded.
Either file_path or url_path must be specified.
api_version: Optional[str]
The API version for DocumentIntelligenceClient. Setting None to use
the default value from `azure-ai-documentintelligence` package.
api_model: str
Unique document model name. Default value is "prebuilt-layout".
Note that overriding this default value may result in unsupported
behavior.
mode: Optional[str]
The type of content representation of the generated Documents.
Use either "single", "page", or "markdown". Default value is "markdown".
analysis_features: Optional[List[str]]
List of optional analysis features, each feature should be passed
as a str that conforms to the enum `DocumentAnalysisFeature` in
`azure-ai-documentintelligence` package. Default value is None.

Examples:
---------
>>> obj = AzureAIDocumentIntelligenceLoader(
... file_path="path/to/file",
... api_endpoint="https://endpoint.azure.com",
... api_key="APIKEY",
... api_version="2023-10-31-preview",
... api_model="prebuilt-layout",
... mode="markdown"
... )
"""

assert (
file_path is not None or url_path is not None
), "file_path or url_path must be provided"
self.file_path = file_path
self.url_path = url_path

self.parser = AzureAIDocumentIntelligenceParser(
api_endpoint=api_endpoint,
api_key=api_key,
api_version=api_version,
api_model=api_model,
mode=mode,
analysis_features=analysis_features,
)

def lazy_load(
self,
) -> Iterator[Document]:
"""Lazy load given path as pages."""
if self.file_path is not None:
yield from self.parser.parse(self.file_path)
else:
yield from self.parser.parse_url(self.url_path)

请现在定义同样的文档解析器。




class AzureAIDocumentIntelligenceParser(BaseBlobParser):
"""Loads a PDF with Azure Document Intelligence
(formerly Forms Recognizer)."""

def __init__(
self,
api_endpoint: str,
api_key: str,
api_version: Optional[str] = None,
api_model: str = "prebuilt-layout",
mode: str = "markdown",
analysis_features: Optional[List[str]] = None,
):
from azure.ai.documentintelligence import DocumentIntelligenceClient
from azure.ai.documentintelligence.models import DocumentAnalysisFeature
from azure.core.credentials import AzureKeyCredential

kwargs = {}
if api_version is not None:
kwargs["api_version"] = api_version

if analysis_features is not None:
_SUPPORTED_FEATURES = [
DocumentAnalysisFeature.OCR_HIGH_RESOLUTION,
]

analysis_features = [
DocumentAnalysisFeature(feature) for feature in analysis_features
]
if any(
[feature not in _SUPPORTED_FEATURES for feature in analysis_features]
):
logger.warning(
f"The current supported features are: "
f"{[f.value for f in _SUPPORTED_FEATURES]}. "
"Using other features may result in unexpected behavior."
)

self.client = DocumentIntelligenceClient(
endpoint=api_endpoint,
credential=AzureKeyCredential(api_key),
headers={"x-ms-useragent": "langchain-parser/1.0.0"},
features=analysis_features,
**kwargs,
)
self.api_model = api_model
self.mode = mode
assert self.mode in ["single", "page", "markdown"]

def _generate_docs_page(self, result: Any) -> Iterator[Document]:
for p in result.pages:
content = " ".join([line.content for line in p.lines])

d = Document(
page_content=content,
metadata={
"page": p.page_number,
},
)
yield d

def _generate_docs_single(self, file_path: str, result: Any) -> Iterator[Document]:
md_content = include_figure_in_md(file_path, result)
yield Document(page_content=md_content, metadata={})

def lazy_parse(self, file_path: str) -> Iterator[Document]:
"""Lazily parse the blob."""
blob = Blob.from_path(file_path)
with blob.as_bytes_io() as file_obj:
poller = self.client.begin_analyze_document(
self.api_model,
file_obj,
content_type="application/octet-stream",
output_content_format="markdown" if self.mode == "markdown" else "text",
)
result = poller.result()

if self.mode in ["single", "markdown"]:
yield from self._generate_docs_single(file_path, result)
elif self.mode in ["page"]:
yield from self._generate_docs_page(result)
else:
raise ValueError(f"Invalid mode: {self.mode}")

def parse_url(self, url: str) -> Iterator[Document]:
from azure.ai.documentintelligence.models import AnalyzeDocumentRequest

poller = self.client.begin_analyze_document(
self.api_model,
AnalyzeDocumentRequest(url_source=url),
# content_type="application/octet-stream",
output_content_format="markdown" if self.mode == "markdown" else "text",
)
result = poller.result()

if self.mode in ["single", "markdown"]:
yield from self._generate_docs_single(result)
elif self.mode in ["page"]:
yield from self._generate_docs_page(result)
else:
raise ValueError(f"Invalid mode: {self.mode}")

Sure, here's the HTML structure with the translated text in simplified Chinese: ```html

如果你查看这个 LangChain 文档解析器,我已经包含了一个名为 include_figure_in_md 的方法。这个方法会遍历 Markdown 内容,查找所有的图像,并用相同图像的描述替换每一个图像。

``` In the translated text: - "LangChain document parser" is translated as "LangChain 文档解析器". - "include_figure_in_md" remains the same since it's a method name. - "Markdown content" is translated as "Markdown 内容". - "figures" (referring to images) is translated as "图像". - "description" is translated as "描述". This maintains the HTML structure while providing the Chinese translation for the given English text.

在开始之前,请让我们编写一些实用的方法,可以帮助您从文档 PDF/Image 中裁剪图像。

from PIL import Image
import fitz # PyMuPDF
import mimetypes

import base64
from mimetypes import guess_type

# Function to encode a local image into data URL
def local_image_to_data_url(image_path):
# Guess the MIME type of the image based on the file extension
mime_type, _ = guess_type(image_path)
if mime_type is None:
mime_type = 'application/octet-stream' # Default MIME type if none is found

# Read and encode the image file
with open(image_path, "rb") as image_file:
base64_encoded_data = base64.b64encode(image_file.read()).decode('utf-8')

# Construct the data URL
return f"data:{mime_type};base64,{base64_encoded_data}"

def crop_image_from_image(image_path, page_number, bounding_box):
"""
Crops an image based on a bounding box.

:param image_path: Path to the image file.
:param page_number: The page number of the image to crop (for TIFF format).
:param bounding_box: A tuple of (left, upper, right, lower) coordinates for the bounding box.
:return: A cropped image.
:rtype: PIL.Image.Image
"""
with Image.open(image_path) as img:
if img.format == "TIFF":
# Open the TIFF image
img.seek(page_number)
img = img.copy()

# The bounding box is expected to be in the format (left, upper, right, lower).
cropped_image = img.crop(bounding_box)
return cropped_image

def crop_image_from_pdf_page(pdf_path, page_number, bounding_box):
"""
Crops a region from a given page in a PDF and returns it as an image.

:param pdf_path: Path to the PDF file.
:param page_number: The page number to crop from (0-indexed).
:param bounding_box: A tuple of (x0, y0, x1, y1) coordinates for the bounding box.
:return: A PIL Image of the cropped area.
"""
doc = fitz.open(pdf_path)
page = doc.load_page(page_number)

# Cropping the page. The rect requires the coordinates in the format (x0, y0, x1, y1).
bbx = [x * 72 for x in bounding_box]
rect = fitz.Rect(bbx)
pix = page.get_pixmap(matrix=fitz.Matrix(300/72, 300/72), clip=rect)

img = Image.frombytes("RGB", [pix.width, pix.height], pix.samples)

doc.close()

return img

def crop_image_from_file(file_path, page_number, bounding_box):
"""
Crop an image from a file.

Args:
file_path (str): The path to the file.
page_number (int): The page number (for PDF and TIFF files, 0-indexed).
bounding_box (tuple): The bounding box coordinates in the format (x0, y0, x1, y1).

Returns:
A PIL Image of the cropped area.
"""
mime_type = mimetypes.guess_type(file_path)[0]

if mime_type == "application/pdf":
return crop_image_from_pdf_page(file_path, page_number, bounding_box)
else:
return crop_image_from_image(file_path, page_number, bounding_box)

Sure, here is the HTML structure with the translated text in simplified Chinese: ```html

接下来我们编写一个方法,可以将图像传递给GPT-4-Vision模型,并获取该图像的描述。

``` In simplified Chinese: "接下来我们编写一个方法,可以将图像传递给GPT-4-Vision模型,并获取该图像的描述。" This translates to: "Next, we write a method where images can be passed to the GPT-4-Vision model to obtain the description of the image."

from openai import AzureOpenAI
aoai_api_base = os.getenv("AZURE_OPENAI_ENDPOINT")
aoai_api_key= os.getenv("AZURE_OPENAI_API_KEY")
aoai_deployment_name = 'gpt-4-vision' # your model deployment name for GPT-4V
aoai_api_version = '2024-02-15-preview' # this might change in the future

MAX_TOKENS = 2000

def understand_image_with_gptv(image_path, caption):
"""
Generates a description for an image using the GPT-4V model.

Parameters:
- api_base (str): The base URL of the API.
- api_key (str): The API key for authentication.
- deployment_name (str): The name of the deployment.
- api_version (str): The version of the API.
- image_path (str): The path to the image file.
- caption (str): The caption for the image.

Returns:
- img_description (str): The generated description for the image.
"""
client = AzureOpenAI(
api_key=aoai_api_key,
api_version=aoai_api_version,
base_url=f"{aoai_api_base}/openai/deployments/{aoai_deployment_name}"
)

data_url = local_image_to_data_url(image_path)
response = client.chat.completions.create(
model=aoai_deployment_name,
messages=[
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": [
{
"type": "text",
"text": f"Describe this image (note: it has image caption: {caption}):" if caption else "Describe this image:"
},
{
"type": "image_url",
"image_url": {
"url": data_url
}
}
] }
],
max_tokens=2000
)
img_description = response.choices[0].message.content
return img_description

Sure, here's the translated text in simplified Chinese, maintaining the HTML structure: ```html 现在一旦我们设置好了实用工具方法,我们就可以导入文档智能加载器并加载文档。 ```

from langchain_community.document_loaders import AzureAIDocumentIntelligenceLoader
loader = AzureAIDocumentIntelligenceLoader(file_path='sample.pdf',
api_key = os.getenv("AZURE_DOCUMENT_INTELLIGENCE_KEY"),
api_endpoint = os.getenv("AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT"),
api_model="prebuilt-layout",
api_version="2024-02-29-preview",
mode='markdown',
analysis_features = [DocumentAnalysisFeature.OCR_HIGH_RESOLUTION])
docs = loader.load()

```html

语义分块是自然语言处理中使用的一种强大技术,其涉及将大段文本分解为较小的、主题一致的段落或“块”,这些块在语义上是连贯的。语义分块的主要目标是捕获和保留文本中固有的意义,使每个块尽可能包含独立的语义信息。这一过程对于各种语言模型应用至关重要,例如嵌入模型和检索增强生成(RAG),因为它有助于克服处理长文本序列时的限制。通过确保输入语言模型(LLM)的数据在主题和语境上的连贯性,语义分块增强了模型解释和生成相关和准确响应的能力。

``` This HTML structure contains the translated text in simplified Chinese while maintaining the basic HTML paragraph structure.

Sure, here's the translated text in simplified Chinese while maintaining the HTML structure: ```html 此外,它通过使得从向量数据库中检索高度相关的信息成为可能,从而提高了信息检索的效率,这些信息与用户意图密切相关,因此减少了噪音并保持语义完整性。实质上,语义块分析作为大量文本数据与先进语言模型有效处理能力之间的桥梁,是有效和有意义的自然语言理解和生成的基石。 ``` This translation preserves the HTML structure for integration into a webpage.

Certainly! Here is the translated text in simplified Chinese, keeping the HTML structure: ```html

让我们来看看 Markdown 标题分隔器,根据标题来分割文档。

```
# Split the document into chunks base on markdown headers.
headers_to_split_on = [
("#", "Header 1"),
("##", "Header 2"),
("###", "Header 3"),
("####", "Header 4"),
("#####", "Header 5"),
("######", "Header 6"),
("#######", "Header 7"),
("########", "Header 8")
]
text_splitter = MarkdownHeaderTextSplitter(headers_to_split_on=headers_to_split_on)

docs_string = docs[0].page_content
docs_result = text_splitter.split_text(docs_string)

print("Length of splits: " + str(len(docs_result)))

To translate "Let's initialize the model of both Azure OpenAI GPT and Azure OpenAI Embedding" into simplified Chinese, while keeping the HTML structure intact, you would use the following: ```html 让我们初始化 Azure OpenAI GPT 和 Azure OpenAI Embedding 的模型。 ``` This HTML snippet ensures that the translation is clear and properly embedded in an HTML context.

from langchain_openai import AzureOpenAIEmbeddings
from langchain_community.vectorstores import FAISS
from langchain_openai import AzureChatOpenAI
from langchain import hub
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnablePassthrough

llm = AzureChatOpenAI(api_key = os.environ["AZURE_OPENAI_API_KEY"],
api_version = "2023-12-01-preview",
azure_endpoint = os.environ["AZURE_OPENAI_ENDPOINT"],
model= "gpt-4-1106-preview",
streaming=True)

aoai_embeddings = AzureOpenAIEmbeddings(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
azure_deployment="text-embedding-ada-002",
openai_api_version="2023-12-01-preview",
azure_endpoint =os.environ["AZURE_OPENAI_ENDPOINT"]
)

Certainly! Here's how you can structure your HTML while incorporating the translated text in simplified Chinese: ```html

现在让我们创建一个索引,并将嵌入向量存储到 FAISS 中。

``` This HTML snippet maintains the structure while embedding the translated Chinese text within a paragraph (`

`) element.

# Return the retrieved documents or certain source metadata from the documents

from operator import itemgetter
prompt = hub.pull("rlm/rag-prompt")
from langchain.schema.runnable import RunnableMap

index = await FAISS.afrom_documents(documents=docs_result,
embedding=aoai_embeddings)

Sure, here's the HTML structure with the translated text in simplified Chinese: ```html

现在让我们开始创建 RAG 链。

``` In this structure: - `

` denotes a paragraph in HTML, suitable for the translated text. - "现在让我们开始创建 RAG 链。" is the translation of "Now lets work on creating RAG Chain."

def format_docs(docs):
return "\n\n".join(doc.page_content for doc in docs)

retriever_base = index.as_retriever(search_type="similarity",search_kwargs = {"k" : 5})

rag_chain_from_docs = (
{
"context": lambda input: format_docs(input["documents"]),
"question": itemgetter("question"),
}
| prompt
| llm
| StrOutputParser()
)
rag_chain_with_source = RunnableMap(
{"documents": retriever_base, "question": RunnablePassthrough()}
) | {
"documents": lambda input: [doc.metadata for doc in input["documents"]],
"answer": rag_chain_from_docs,
}

Sure, here's the translated text in simplified Chinese, while keeping the HTML structure intact: ```html 现在让我们付诸行动,让我们以下面的PDF示例为基础,从图表中提出问题。 ``` This HTML snippet includes the translated text in simplified Chinese.

Certainly! Here's how you can structure your HTML while translating the text to simplified Chinese: ```html

Translate to Chinese

这里我将从这个页面的情节中提出一个问题。正如您所看到的,我得到了正确的回答,还有相应的引用。

``` In this HTML: - `` specifies the document's language as simplified Chinese. - `` ensures proper character encoding for displaying Chinese characters. - The text "Here I will ask a question from the Plot from this page. As you see i get the correct response along with citations too." is translated into simplified Chinese and placed within the `

` (paragraph) tag. This structure maintains the integrity of HTML while accommodating the translation into Chinese.

Sure, here's the translated text in simplified Chinese, while keeping the HTML structure intact: ```html 希望你喜欢这篇博客。如果你想阅读更多类似的博客,请鼓掌并关注我。 ``` This translates to: ```html 希望你喜欢这篇博客。如果你想阅读更多类似的博客,请鼓掌并关注我。 ```

2024-08-01 05:25:13 AI中文站翻译自原文