Browse Source

Modify params for bedrock retrieve generate (#13182)

Warren Chen 2 months ago
parent
commit
03243cb422

+ 0 - 114
api/core/tools/provider/builtin/aws/tools/bedrock_config.py

@@ -1,114 +0,0 @@
-"""
-Configuration classes for AWS Bedrock retrieve and generate API
-"""
-
-from dataclasses import dataclass
-from typing import Any, Literal, Optional
-
-
-@dataclass
-class TextInferenceConfig:
-    """Text inference configuration"""
-
-    maxTokens: Optional[int] = None
-    stopSequences: Optional[list[str]] = None
-    temperature: Optional[float] = None
-    topP: Optional[float] = None
-
-
-@dataclass
-class PerformanceConfig:
-    """Performance configuration"""
-
-    latency: Literal["standard", "optimized"]
-
-
-@dataclass
-class PromptTemplate:
-    """Prompt template configuration"""
-
-    textPromptTemplate: str
-
-
-@dataclass
-class GuardrailConfig:
-    """Guardrail configuration"""
-
-    guardrailId: str
-    guardrailVersion: str
-
-
-@dataclass
-class GenerationConfig:
-    """Generation configuration"""
-
-    additionalModelRequestFields: Optional[dict[str, Any]] = None
-    guardrailConfiguration: Optional[GuardrailConfig] = None
-    inferenceConfig: Optional[dict[str, TextInferenceConfig]] = None
-    performanceConfig: Optional[PerformanceConfig] = None
-    promptTemplate: Optional[PromptTemplate] = None
-
-
-@dataclass
-class VectorSearchConfig:
-    """Vector search configuration"""
-
-    filter: Optional[dict[str, Any]] = None
-    numberOfResults: Optional[int] = None
-    overrideSearchType: Optional[Literal["HYBRID", "SEMANTIC"]] = None
-
-
-@dataclass
-class RetrievalConfig:
-    """Retrieval configuration"""
-
-    vectorSearchConfiguration: VectorSearchConfig
-
-
-@dataclass
-class OrchestrationConfig:
-    """Orchestration configuration"""
-
-    additionalModelRequestFields: Optional[dict[str, Any]] = None
-    inferenceConfig: Optional[dict[str, TextInferenceConfig]] = None
-    performanceConfig: Optional[PerformanceConfig] = None
-    promptTemplate: Optional[PromptTemplate] = None
-
-
-@dataclass
-class KnowledgeBaseConfig:
-    """Knowledge base configuration"""
-
-    generationConfiguration: GenerationConfig
-    knowledgeBaseId: str
-    modelArn: str
-    orchestrationConfiguration: Optional[OrchestrationConfig] = None
-    retrievalConfiguration: Optional[RetrievalConfig] = None
-
-
-@dataclass
-class SessionConfig:
-    """Session configuration"""
-
-    kmsKeyArn: Optional[str] = None
-    sessionId: Optional[str] = None
-
-
-@dataclass
-class RetrieveAndGenerateConfiguration:
-    """Retrieve and generate configuration
-    The use of knowledgeBaseConfiguration or externalSourcesConfiguration depends on the type value
-    """
-
-    type: str = "KNOWLEDGE_BASE"
-    knowledgeBaseConfiguration: Optional[KnowledgeBaseConfig] = None
-
-
-@dataclass
-class RetrieveAndGenerateConfig:
-    """Retrieve and generate main configuration"""
-
-    input: dict[str, str]
-    retrieveAndGenerateConfiguration: RetrieveAndGenerateConfiguration
-    sessionConfiguration: Optional[SessionConfig] = None
-    sessionId: Optional[str] = None

+ 25 - 7
api/core/tools/provider/builtin/aws/tools/bedrock_retrieve.py

@@ -77,15 +77,27 @@ class BedrockRetrieveTool(BuiltinTool):
         """
         invoke tools
         """
-        line = 0
         try:
+            line = 0
+            # Initialize Bedrock client if not already initialized
             if not self.bedrock_client:
                 aws_region = tool_parameters.get("aws_region")
-                if aws_region:
-                    self.bedrock_client = boto3.client("bedrock-agent-runtime", region_name=aws_region)
-                else:
-                    self.bedrock_client = boto3.client("bedrock-agent-runtime")
+                aws_access_key_id = tool_parameters.get("aws_access_key_id")
+                aws_secret_access_key = tool_parameters.get("aws_secret_access_key")
 
+                client_kwargs = {"service_name": "bedrock-agent-runtime", "region_name": aws_region or None}
+
+                # Only add credentials if both access key and secret key are provided
+                if aws_access_key_id and aws_secret_access_key:
+                    client_kwargs.update(
+                        {"aws_access_key_id": aws_access_key_id, "aws_secret_access_key": aws_secret_access_key}
+                    )
+
+                self.bedrock_client = boto3.client(**client_kwargs)
+        except Exception as e:
+            return self.create_text_message(f"Failed to initialize Bedrock client: {str(e)}")
+
+        try:
             line = 1
             if not self.knowledge_base_id:
                 self.knowledge_base_id = tool_parameters.get("knowledge_base_id")
@@ -123,7 +135,14 @@ class BedrockRetrieveTool(BuiltinTool):
             sorted_docs = sorted(retrieved_docs, key=operator.itemgetter("score"), reverse=True)
 
             line = 6
-            return [self.create_json_message(res) for res in sorted_docs]
+            result_type = tool_parameters.get("result_type")
+            if result_type == "json":
+                return [self.create_json_message(res) for res in sorted_docs]
+            else:
+                text = ""
+                for i, res in enumerate(sorted_docs):
+                    text += f"{i + 1}: {res['content']}\n"
+                return self.create_text_message(text)
 
         except Exception as e:
             return self.create_text_message(f"Exception {str(e)}, line : {line}")
@@ -138,7 +157,6 @@ class BedrockRetrieveTool(BuiltinTool):
         if not parameters.get("query"):
             raise ValueError("query is required")
 
-        # 可选:可以验证元数据过滤条件是否为有效的 JSON 字符串(如果提供)
         metadata_filter_str = parameters.get("metadata_filter")
         if metadata_filter_str and not isinstance(json.loads(metadata_filter_str), dict):
             raise ValueError("metadata_filter must be a valid JSON object")

+ 55 - 14
api/core/tools/provider/builtin/aws/tools/bedrock_retrieve.yaml

@@ -15,6 +15,60 @@ description:
   llm: A tool for retrieving relevant information from Amazon Bedrock Knowledge Base. You can find deploy instructions on Github Repo - https://github.com/aws-samples/dify-aws-tool
 
 parameters:
+  - name: aws_region
+    type: string
+    required: false
+    label:
+      en_US: AWS Region
+      zh_Hans: AWS区域
+    human_description:
+      en_US: AWS region for the Bedrock service
+      zh_Hans: Bedrock服务的AWS区域
+    form: form
+
+  - name: aws_access_key_id
+    type: string
+    required: false
+    label:
+      en_US: AWS Access Key ID
+      zh_Hans: AWS访问密钥ID
+    human_description:
+      en_US: AWS access key ID for authentication (optional)
+      zh_Hans: 用于身份验证的AWS访问密钥ID(可选)
+    form: form
+
+  - name: aws_secret_access_key
+    type: string
+    required: false
+    label:
+      en_US: AWS Secret Access Key
+      zh_Hans: AWS秘密访问密钥
+    human_description:
+      en_US: AWS secret access key for authentication (optional)
+      zh_Hans: 用于身份验证的AWS秘密访问密钥(可选)
+    form: form
+
+  - name: result_type
+    type: select
+    required: true
+    label:
+      en_US: result type
+      zh_Hans: 结果类型
+    human_description:
+      en_US: return a list of json or texts
+      zh_Hans: 返回一个列表,内容是json还是纯文本
+    default: text
+    options:
+      - value: json
+        label:
+          en_US: JSON
+          zh_Hans: JSON
+      - value: text
+        label:
+          en_US: Text
+          zh_Hans: 文本
+    form: form
+
   - name: knowledge_base_id
     type: string
     required: true
@@ -95,6 +149,7 @@ parameters:
       zh_Hans: 重拍模型ID
       pt_BR: rerank model id
     llm_description: rerank model id
+    default: default
     options:
       - value: default
         label:
@@ -110,20 +165,6 @@ parameters:
           zh_Hans: amazon.rerank-v1:0
     form: form
 
-  - name: aws_region
-    type: string
-    required: false
-    label:
-      en_US: AWS Region
-      zh_Hans: AWS 区域
-      pt_BR: AWS Region
-    human_description:
-      en_US: AWS region where the Bedrock Knowledge Base is located
-      zh_Hans: Bedrock知识库所在的AWS区域
-      pt_BR: AWS region where the Bedrock Knowledge Base is located
-    llm_description: AWS region where the Bedrock Knowledge Base is located
-    form: form
-
   - name: metadata_filter   # Additional parameter for metadata filtering
     type: string            # String type, expects JSON-formatted filter conditions
     required: false         # Optional field - can be omitted

+ 87 - 274
api/core/tools/provider/builtin/aws/tools/bedrock_retrieve_and_generate.py

@@ -1,5 +1,5 @@
 import json
-from typing import Any, Optional
+from typing import Any
 
 import boto3
 
@@ -10,193 +10,63 @@ from core.tools.tool.builtin_tool import BuiltinTool
 class BedrockRetrieveAndGenerateTool(BuiltinTool):
     bedrock_client: Any = None
 
-    def _create_text_inference_config(
-        self,
-        max_tokens: Optional[int] = None,
-        stop_sequences: Optional[str] = None,
-        temperature: Optional[float] = None,
-        top_p: Optional[float] = None,
-    ) -> Optional[dict]:
-        """Create text inference configuration"""
-        if any([max_tokens, stop_sequences, temperature, top_p]):
-            config = {}
-            if max_tokens is not None:
-                config["maxTokens"] = max_tokens
-            if stop_sequences:
-                try:
-                    config["stopSequences"] = json.loads(stop_sequences)
-                except json.JSONDecodeError:
-                    config["stopSequences"] = []
-            if temperature is not None:
-                config["temperature"] = temperature
-            if top_p is not None:
-                config["topP"] = top_p
-            return config
-        return None
-
-    def _create_guardrail_config(
-        self,
-        guardrail_id: Optional[str] = None,
-        guardrail_version: Optional[str] = None,
-    ) -> Optional[dict]:
-        """Create guardrail configuration"""
-        if guardrail_id and guardrail_version:
-            return {"guardrailId": guardrail_id, "guardrailVersion": guardrail_version}
-        return None
-
-    def _create_generation_config(
-        self,
-        additional_model_fields: Optional[str] = None,
-        guardrail_config: Optional[dict] = None,
-        text_inference_config: Optional[dict] = None,
-        performance_mode: Optional[str] = None,
-        prompt_template: Optional[str] = None,
-    ) -> dict:
-        """Create generation configuration"""
-        config = {}
-
-        if additional_model_fields:
-            try:
-                config["additionalModelRequestFields"] = json.loads(additional_model_fields)
-            except json.JSONDecodeError:
-                pass
-
-        if guardrail_config:
-            config["guardrailConfiguration"] = guardrail_config
-
-        if text_inference_config:
-            config["inferenceConfig"] = {"textInferenceConfig": text_inference_config}
-
-        if performance_mode:
-            config["performanceConfig"] = {"latency": performance_mode}
-
-        if prompt_template:
-            config["promptTemplate"] = {"textPromptTemplate": prompt_template}
-
-        return config
-
-    def _create_orchestration_config(
-        self,
-        orchestration_additional_model_fields: Optional[str] = None,
-        orchestration_text_inference_config: Optional[dict] = None,
-        orchestration_performance_mode: Optional[str] = None,
-        orchestration_prompt_template: Optional[str] = None,
-    ) -> dict:
-        """Create orchestration configuration"""
-        config = {}
-
-        if orchestration_additional_model_fields:
-            try:
-                config["additionalModelRequestFields"] = json.loads(orchestration_additional_model_fields)
-            except json.JSONDecodeError:
-                pass
-
-        if orchestration_text_inference_config:
-            config["inferenceConfig"] = {"textInferenceConfig": orchestration_text_inference_config}
-
-        if orchestration_performance_mode:
-            config["performanceConfig"] = {"latency": orchestration_performance_mode}
-
-        if orchestration_prompt_template:
-            config["promptTemplate"] = {"textPromptTemplate": orchestration_prompt_template}
-
-        return config
-
-    def _create_vector_search_config(
-        self,
-        number_of_results: int = 5,
-        search_type: str = "SEMANTIC",
-        metadata_filter: Optional[dict] = None,
-    ) -> dict:
-        """Create vector search configuration"""
-        config = {
-            "numberOfResults": number_of_results,
-            "overrideSearchType": search_type,
-        }
-
-        # Only add filter if metadata_filter is not empty
-        if metadata_filter:
-            config["filter"] = metadata_filter
-
-        return config
-
-    def _bedrock_retrieve_and_generate(
+    def _invoke(
         self,
-        query: str,
-        knowledge_base_id: str,
-        model_arn: str,
-        # Generation Configuration
-        additional_model_fields: Optional[str] = None,
-        guardrail_id: Optional[str] = None,
-        guardrail_version: Optional[str] = None,
-        max_tokens: Optional[int] = None,
-        stop_sequences: Optional[str] = None,
-        temperature: Optional[float] = None,
-        top_p: Optional[float] = None,
-        performance_mode: str = "standard",
-        prompt_template: Optional[str] = None,
-        # Orchestration Configuration
-        orchestration_additional_model_fields: Optional[str] = None,
-        orchestration_max_tokens: Optional[int] = None,
-        orchestration_stop_sequences: Optional[str] = None,
-        orchestration_temperature: Optional[float] = None,
-        orchestration_top_p: Optional[float] = None,
-        orchestration_performance_mode: Optional[str] = None,
-        orchestration_prompt_template: Optional[str] = None,
-        # Retrieval Configuration
-        number_of_results: int = 5,
-        search_type: str = "SEMANTIC",
-        metadata_filter: Optional[dict] = None,
-        # Additional Configuration
-        session_id: Optional[str] = None,
-    ) -> dict[str, Any]:
+        user_id: str,
+        tool_parameters: dict[str, Any],
+    ) -> ToolInvokeMessage:
         try:
-            # Create text inference configurations
-            text_inference_config = self._create_text_inference_config(max_tokens, stop_sequences, temperature, top_p)
-            orchestration_text_inference_config = self._create_text_inference_config(
-                orchestration_max_tokens, orchestration_stop_sequences, orchestration_temperature, orchestration_top_p
-            )
-
-            # Create guardrail configuration
-            guardrail_config = self._create_guardrail_config(guardrail_id, guardrail_version)
-
-            # Create vector search configuration
-            vector_search_config = self._create_vector_search_config(number_of_results, search_type, metadata_filter)
-
-            # Create generation configuration
-            generation_config = self._create_generation_config(
-                additional_model_fields, guardrail_config, text_inference_config, performance_mode, prompt_template
-            )
+            # Initialize Bedrock client if not already initialized
+            if not self.bedrock_client:
+                aws_region = tool_parameters.get("aws_region")
+                aws_access_key_id = tool_parameters.get("aws_access_key_id")
+                aws_secret_access_key = tool_parameters.get("aws_secret_access_key")
 
-            # Create orchestration configuration
-            orchestration_config = self._create_orchestration_config(
-                orchestration_additional_model_fields,
-                orchestration_text_inference_config,
-                orchestration_performance_mode,
-                orchestration_prompt_template,
-            )
+                client_kwargs = {"service_name": "bedrock-agent-runtime", "region_name": aws_region or None}
 
-            # Create knowledge base configuration
-            knowledge_base_config = {
-                "knowledgeBaseId": knowledge_base_id,
-                "modelArn": model_arn,
-                "generationConfiguration": generation_config,
-                "orchestrationConfiguration": orchestration_config,
-                "retrievalConfiguration": {"vectorSearchConfiguration": vector_search_config},
-            }
+                # Only add credentials if both access key and secret key are provided
+                if aws_access_key_id and aws_secret_access_key:
+                    client_kwargs.update(
+                        {"aws_access_key_id": aws_access_key_id, "aws_secret_access_key": aws_secret_access_key}
+                    )
 
-            # Create request configuration
-            request_config = {
-                "input": {"text": query},
-                "retrieveAndGenerateConfiguration": {
-                    "type": "KNOWLEDGE_BASE",
-                    "knowledgeBaseConfiguration": knowledge_base_config,
-                },
-            }
+                self.bedrock_client = boto3.client(**client_kwargs)
+        except Exception as e:
+            return self.create_text_message(f"Failed to initialize Bedrock client: {str(e)}")
 
-            # Add session configuration if provided
-            if session_id and len(session_id) >= 2:
-                request_config["sessionConfiguration"] = {"sessionId": session_id}
+        try:
+            request_config = {}
+
+            # Set input configuration
+            input_text = tool_parameters.get("input")
+            if input_text:
+                request_config["input"] = {"text": input_text}
+
+            # Build retrieve and generate configuration
+            config_type = tool_parameters.get("type")
+            retrieve_generate_config = {"type": config_type}
+
+            # Add configuration based on type
+            if config_type == "KNOWLEDGE_BASE":
+                kb_config_str = tool_parameters.get("knowledge_base_configuration")
+                kb_config = json.loads(kb_config_str) if kb_config_str else None
+                retrieve_generate_config["knowledgeBaseConfiguration"] = kb_config
+            else:  # EXTERNAL_SOURCES
+                es_config_str = tool_parameters.get("external_sources_configuration")
+                es_config = json.loads(kb_config_str) if es_config_str else None
+                retrieve_generate_config["externalSourcesConfiguration"] = es_config
+
+            request_config["retrieveAndGenerateConfiguration"] = retrieve_generate_config
+
+            # Parse session configuration
+            session_config_str = tool_parameters.get("session_configuration")
+            session_config = json.loads(session_config_str) if session_config_str else None
+            if session_config:
+                request_config["sessionConfiguration"] = session_config
+
+            # Add session ID if provided
+            session_id = tool_parameters.get("session_id")
+            if session_id:
                 request_config["sessionId"] = session_id
 
             # Send request
@@ -226,99 +96,42 @@ class BedrockRetrieveAndGenerateTool(BuiltinTool):
                     citation_info["references"].append(reference)
 
                 result["citations"].append(citation_info)
-
-            return result
-
-        except Exception as e:
-            raise Exception(f"Error calling Bedrock service: {str(e)}")
-
-    def _invoke(
-        self,
-        user_id: str,
-        tool_parameters: dict[str, Any],
-    ) -> ToolInvokeMessage:
-        try:
-            # Initialize Bedrock client if not already initialized
-            if not self.bedrock_client:
-                aws_region = tool_parameters.get("aws_region")
-                aws_access_key_id = tool_parameters.get("aws_access_key_id")
-                aws_secret_access_key = tool_parameters.get("aws_secret_access_key")
-
-                client_kwargs = {
-                    "service_name": "bedrock-agent-runtime",
-                }
-                if aws_region:
-                    client_kwargs["region_name"] = aws_region
-                # Only add credentials if both access key and secret key are provided
-                if aws_access_key_id and aws_secret_access_key:
-                    client_kwargs.update(
-                        {"aws_access_key_id": aws_access_key_id, "aws_secret_access_key": aws_secret_access_key}
-                    )
-
-                try:
-                    self.bedrock_client = boto3.client(**client_kwargs)
-                except Exception as e:
-                    return self.create_text_message(f"Failed to initialize Bedrock client: {str(e)}")
-
-            # Parse metadata filter if provided
-            metadata_filter = None
-            if metadata_filter_str := tool_parameters.get("metadata_filter"):
-                try:
-                    parsed_filter = json.loads(metadata_filter_str)
-                    if parsed_filter:  # Only set if not empty
-                        metadata_filter = parsed_filter
-                except json.JSONDecodeError:
-                    return self.create_text_message("metadata_filter must be a valid JSON string")
-
-            try:
-                response = self._bedrock_retrieve_and_generate(
-                    query=tool_parameters["query"],
-                    knowledge_base_id=tool_parameters["knowledge_base_id"],
-                    model_arn=tool_parameters["model_arn"],
-                    # Generation Configuration
-                    additional_model_fields=tool_parameters.get("additional_model_fields"),
-                    guardrail_id=tool_parameters.get("guardrail_id"),
-                    guardrail_version=tool_parameters.get("guardrail_version"),
-                    max_tokens=tool_parameters.get("max_tokens"),
-                    stop_sequences=tool_parameters.get("stop_sequences"),
-                    temperature=tool_parameters.get("temperature"),
-                    top_p=tool_parameters.get("top_p"),
-                    performance_mode=tool_parameters.get("performance_mode", "standard"),
-                    prompt_template=tool_parameters.get("prompt_template"),
-                    # Orchestration Configuration
-                    orchestration_additional_model_fields=tool_parameters.get("orchestration_additional_model_fields"),
-                    orchestration_max_tokens=tool_parameters.get("orchestration_max_tokens"),
-                    orchestration_stop_sequences=tool_parameters.get("orchestration_stop_sequences"),
-                    orchestration_temperature=tool_parameters.get("orchestration_temperature"),
-                    orchestration_top_p=tool_parameters.get("orchestration_top_p"),
-                    orchestration_performance_mode=tool_parameters.get("orchestration_performance_mode"),
-                    orchestration_prompt_template=tool_parameters.get("orchestration_prompt_template"),
-                    # Retrieval Configuration
-                    number_of_results=tool_parameters.get("number_of_results", 5),
-                    search_type=tool_parameters.get("search_type", "SEMANTIC"),
-                    metadata_filter=metadata_filter,
-                    # Additional Configuration
-                    session_id=tool_parameters.get("session_id"),
-                )
-                return self.create_json_message(response)
-
-            except Exception as e:
-                return self.create_text_message(f"Tool invocation error: {str(e)}")
-
+            result_type = tool_parameters.get("result_type")
+            if result_type == "json":
+                return self.create_json_message(result)
+            elif result_type == "text-with-citations":
+                return self.create_text_message(result)
+            else:
+                return self.create_text_message(result.get("output"))
+        except json.JSONDecodeError as e:
+            return self.create_text_message(f"Invalid JSON format: {str(e)}")
         except Exception as e:
-            return self.create_text_message(f"Tool execution error: {str(e)}")
+            return self.create_text_message(f"Tool invocation error: {str(e)}")
 
     def validate_parameters(self, parameters: dict[str, Any]) -> None:
         """Validate the parameters"""
-        required_params = ["query", "model_arn", "knowledge_base_id"]
-        for param in required_params:
-            if not parameters.get(param):
-                raise ValueError(f"{param} is required")
-
-        # Validate metadata filter if provided
-        if metadata_filter_str := parameters.get("metadata_filter"):
-            try:
-                if not isinstance(json.loads(metadata_filter_str), dict):
-                    raise ValueError("metadata_filter must be a valid JSON object")
-            except json.JSONDecodeError:
-                raise ValueError("metadata_filter must be a valid JSON string")
+        # Validate required parameters
+        if not parameters.get("input"):
+            raise ValueError("input is required")
+        if not parameters.get("type"):
+            raise ValueError("type is required")
+
+        # Validate JSON configurations
+        json_configs = ["knowledge_base_configuration", "external_sources_configuration", "session_configuration"]
+        for config in json_configs:
+            if config_value := parameters.get(config):
+                try:
+                    json.loads(config_value)
+                except json.JSONDecodeError:
+                    raise ValueError(f"{config} must be a valid JSON string")
+
+        # Validate configuration type
+        config_type = parameters.get("type")
+        if config_type not in ["KNOWLEDGE_BASE", "EXTERNAL_SOURCES"]:
+            raise ValueError("type must be either KNOWLEDGE_BASE or EXTERNAL_SOURCES")
+
+        # Validate type-specific configuration
+        if config_type == "KNOWLEDGE_BASE" and not parameters.get("knowledge_base_configuration"):
+            raise ValueError("knowledge_base_configuration is required when type is KNOWLEDGE_BASE")
+        elif config_type == "EXTERNAL_SOURCES" and not parameters.get("external_sources_configuration"):
+            raise ValueError("external_sources_configuration is required when type is EXTERNAL_SOURCES")

+ 59 - 269
api/core/tools/provider/builtin/aws/tools/bedrock_retrieve_and_generate.yaml

@@ -8,24 +8,11 @@ identity:
 
 description:
   human:
-    en_US: A tool for retrieving and generating information using Amazon Bedrock Knowledge Base
-    zh_Hans: 使用Amazon Bedrock知识库进行信息检索和生成的工具
+    en_US: "This is an advanced usage of Bedrock Retrieve. Please refer to the API documentation for detailed parameters and paste them into the corresponding Knowledge Base Configuration or External Sources Configuration"
+    zh_Hans: "这个工具为Bedrock Retrieve的高级用法,请参考API设置详细的参数,并粘贴到对应的知识库配置或者外部源配置"
   llm: A tool for retrieving and generating information using Amazon Bedrock Knowledge Base
 
 parameters:
-# Additional Configuration
-  - name: session_id
-    type: string
-    required: false
-    label:
-      en_US: Session ID
-      zh_Hans: 会话ID
-    human_description:
-      en_US: Optional session ID for continuous conversations
-      zh_Hans: 用于连续对话的可选会话ID
-    form: form
-
-  # AWS Configuration
   - name: aws_region
     type: string
     required: false
@@ -59,300 +46,103 @@ parameters:
       zh_Hans: 用于身份验证的AWS秘密访问密钥(可选)
     form: form
 
-  # Knowledge Base Configuration
-  - name: knowledge_base_id
-    type: string
-    required: true
-    label:
-      en_US: Knowledge Base ID
-      zh_Hans: 知识库ID
-    human_description:
-      en_US: ID of the Bedrock Knowledge Base
-      zh_Hans: Bedrock知识库的ID
-    form: form
-
-  - name: model_arn
-    type: string
-    required: true
-    label:
-      en_US: Model ARN
-      zh_Hans: 模型ARN
-    human_description:
-      en_US: The ARN of the model to use
-      zh_Hans: 要使用的模型ARN
-    form: form
-
-  # Retrieval Configuration
-  - name: query
-    type: string
-    required: true
-    label:
-      en_US: Query
-      zh_Hans: 查询
-    human_description:
-      en_US: The search query to retrieve information
-      zh_Hans: 用于检索信息的查询语句
-    form: llm
-
-  - name: number_of_results
-    type: number
-    required: false
-    label:
-      en_US: Number of Results
-      zh_Hans: 结果数量
-    human_description:
-      en_US: Number of results to retrieve (1-10)
-      zh_Hans: 要检索的结果数量(1-10)
-    default: 5
-    min: 1
-    max: 10
-    form: form
-
-  - name: search_type
+  - name: result_type
     type: select
-    required: false
+    required: true
     label:
-      en_US: Search Type
-      zh_Hans: 搜索类型
+      en_US: result type
+      zh_Hans: 结果类型
     human_description:
-      en_US: Type of search to perform
-      zh_Hans: 要执行的搜索类型
-    default: SEMANTIC
+      en_US: return a list of json or texts
+      zh_Hans: 返回一个列表,内容是json还是纯文本
+    default: text
     options:
-      - value: SEMANTIC
+      - value: json
         label:
-          en_US: Semantic Search
-          zh_Hans: 语义搜索
-      - value: HYBRID
+          en_US: JSON
+          zh_Hans: JSON
+      - value: text
         label:
-          en_US: Hybrid Search
-          zh_Hans: 混合搜索
-    form: form
-
-  - name: metadata_filter
-    type: string
-    required: false
-    label:
-      en_US: Metadata Filter
-      zh_Hans: 元数据过滤器
-    human_description:
-      en_US: JSON formatted filter conditions for metadata, supporting operations like equals, greaterThan, lessThan, etc.
-      zh_Hans: 元数据的JSON格式过滤条件,支持等于、大于、小于等操作
-    default: "{}"
-    form: form
-
-# Generation Configuration
-  - name: guardrail_id
-    type: string
-    required: false
-    label:
-      en_US: Guardrail ID
-      zh_Hans: 防护栏ID
-    human_description:
-      en_US: ID of the guardrail to apply
-      zh_Hans: 要应用的防护栏ID
-    form: form
-
-  - name: guardrail_version
-    type: string
-    required: false
-    label:
-      en_US: Guardrail Version
-      zh_Hans: 防护栏版本
-    human_description:
-      en_US: Version of the guardrail to apply
-      zh_Hans: 要应用的防护栏版本
-    form: form
-
-  - name: max_tokens
-    type: number
-    required: false
-    label:
-      en_US: Maximum Tokens
-      zh_Hans: 最大令牌数
-    human_description:
-      en_US: Maximum number of tokens to generate
-      zh_Hans: 生成的最大令牌数
-    default: 2048
+          en_US: Text
+          zh_Hans: 文本
+      - value: text-with-citations
+        label:
+          en_US: Text With Citations
+          zh_Hans: 文本(包含引用)
     form: form
 
-  - name: stop_sequences
+  - name: input
     type: string
-    required: false
-    label:
-      en_US: Stop Sequences
-      zh_Hans: 停止序列
-    human_description:
-      en_US: JSON array of strings that will stop generation when encountered
-      zh_Hans: JSON数组格式的字符串,遇到这些序列时将停止生成
-    default: "[]"
-    form: form
-
-  - name: temperature
-    type: number
-    required: false
-    label:
-      en_US: Temperature
-      zh_Hans: 温度
-    human_description:
-      en_US: Controls randomness in the output (0-1)
-      zh_Hans: 控制输出的随机性(0-1)
-    default: 0.7
-    min: 0
-    max: 1
-    form: form
-
-  - name: top_p
-    type: number
-    required: false
+    required: true
     label:
-      en_US: Top P
-      zh_Hans: Top P值
+      en_US: Input Text
+      zh_Hans: 输入文本
     human_description:
-      en_US: Controls diversity via nucleus sampling (0-1)
-      zh_Hans: 通过核采样控制多样性(0-1)
-    default: 0.95
-    min: 0
-    max: 1
-    form: form
+      en_US: The text query to retrieve information
+      zh_Hans: 用于检索信息的文本查询
+    form: llm
 
-  - name: performance_mode
+  - name: type
     type: select
-    required: false
+    required: true
     label:
-      en_US: Performance Mode
-      zh_Hans: 性能模式
+      en_US: Configuration Type
+      zh_Hans: 配置类型
     human_description:
-      en_US: Select performance optimization mode(performanceConfig.latency)
-      zh_Hans: 选择性能优化模式(performanceConfig.latency)
-    default: standard
+      en_US: Type of retrieve and generate configuration
+      zh_Hans: 检索和生成配置的类型
     options:
-      - value: standard
+      - value: KNOWLEDGE_BASE
         label:
-          en_US: Standard
-          zh_Hans: 标准
-      - value: optimized
+          en_US: Knowledge Base
+          zh_Hans: 知识库
+      - value: EXTERNAL_SOURCES
         label:
-          en_US: Optimized
-          zh_Hans: 优化
+          en_US: External Sources
+          zh_Hans: 外部源
     form: form
 
-  - name: prompt_template
+  - name: knowledge_base_configuration
     type: string
     required: false
     label:
-      en_US: Prompt Template
-      zh_Hans: 提示模板
+      en_US: Knowledge Base Configuration
+      zh_Hans: 知识库配置
     human_description:
-      en_US: Custom prompt template for generation
-      zh_Hans: 用于生成的自定义提示模板
+      en_US: Please refer to @https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/retrieve_and_generate.html#retrieve-and-generate for complete parameters and paste them here
+      zh_Hans: 请参考 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/retrieve_and_generate.html#retrieve-and-generate 配置完整的参数并粘贴到这里
     form: form
 
-  - name: additional_model_fields
+  - name: external_sources_configuration
     type: string
     required: false
     label:
-      en_US: Additional Model Fields
-      zh_Hans: 额外模型字段
+      en_US: External Sources Configuration
+      zh_Hans: 外部源配置
     human_description:
-      en_US: JSON formatted additional fields for model configuration
-      zh_Hans: JSON格式的额外模型配置字段
-    default: "{}"
+      en_US: Please refer to https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/retrieve_and_generate.html#retrieve-and-generate for complete parameters and paste them here
+      zh_Hans: 请参考 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/retrieve_and_generate.html#retrieve-and-generate 配置完整的参数并粘贴到这里
     form: form
 
-# Orchestration Configuration
-  - name: orchestration_max_tokens
-    type: number
-    required: false
-    label:
-      en_US: Orchestration Maximum Tokens
-      zh_Hans: 编排最大令牌数
-    human_description:
-      en_US: Maximum number of tokens for orchestration
-      zh_Hans: 编排过程的最大令牌数
-    default: 2048
-    form: form
-
-  - name: orchestration_stop_sequences
+  - name: session_configuration
     type: string
     required: false
     label:
-      en_US: Orchestration Stop Sequences
-      zh_Hans: 编排停止序列
+      en_US: Session Configuration
+      zh_Hans: 会话配置
     human_description:
-      en_US: JSON array of strings that will stop orchestration when encountered
-      zh_Hans: JSON数组格式的字符串,遇到这些序列时将停止编排
-    default: "[]"
+      en_US: JSON formatted session configuration
+      zh_Hans: JSON格式的会话配置
+    default: ""
     form: form
 
-  - name: orchestration_temperature
-    type: number
-    required: false
-    label:
-      en_US: Orchestration Temperature
-      zh_Hans: 编排温度
-    human_description:
-      en_US: Controls randomness in the orchestration output (0-1)
-      zh_Hans: 控制编排输出的随机性(0-1)
-    default: 0.7
-    min: 0
-    max: 1
-    form: form
-
-  - name: orchestration_top_p
-    type: number
-    required: false
-    label:
-      en_US: Orchestration Top P
-      zh_Hans: 编排Top P值
-    human_description:
-      en_US: Controls diversity via nucleus sampling in orchestration (0-1)
-      zh_Hans: 通过核采样控制编排的多样性(0-1)
-    default: 0.95
-    min: 0
-    max: 1
-    form: form
-
-  - name: orchestration_performance_mode
-    type: select
-    required: false
-    label:
-      en_US: Orchestration Performance Mode
-      zh_Hans: 编排性能模式
-    human_description:
-      en_US: Select performance optimization mode for orchestration
-      zh_Hans: 选择编排的性能优化模式
-    default: standard
-    options:
-      - value: standard
-        label:
-          en_US: Standard
-          zh_Hans: 标准
-      - value: optimized
-        label:
-          en_US: Optimized
-          zh_Hans: 优化
-    form: form
-
-  - name: orchestration_prompt_template
-    type: string
-    required: false
-    label:
-      en_US: Orchestration Prompt Template
-      zh_Hans: 编排提示模板
-    human_description:
-      en_US: Custom prompt template for orchestration
-      zh_Hans: 用于编排的自定义提示模板
-    form: form
-
-  - name: orchestration_additional_model_fields
+  - name: session_id
     type: string
     required: false
     label:
-      en_US: Orchestration Additional Model Fields
-      zh_Hans: 编排额外模型字段
+      en_US: Session ID
+      zh_Hans: 会话ID
     human_description:
-      en_US: JSON formatted additional fields for orchestration model configuration
-      zh_Hans: JSON格式的编排模型额外配置字段
-    default: "{}"
+      en_US: Session ID for continuous conversations
+      zh_Hans: 用于连续对话的会话ID
     form: form

+ 52 - 11
api/poetry.lock

@@ -931,19 +931,19 @@ files = [
 
 [[package]]
 name = "boto3"
-version = "1.36.4"
+version = "1.36.12"
 description = "The AWS SDK for Python"
 optional = false
 python-versions = ">=3.8"
 groups = ["main"]
 markers = "python_version == \"3.11\" or python_version >= \"3.12\""
 files = [
-    {file = "boto3-1.36.4-py3-none-any.whl", hash = "sha256:9f8f699e75ec63fcc98c4dd7290997c7c06c68d3ac8161ad4735fe71f5fe945c"},
-    {file = "boto3-1.36.4.tar.gz", hash = "sha256:eeceeb74ef8b65634d358c27aa074917f4449dc828f79301f1075232618eb502"},
+    {file = "boto3-1.36.12-py3-none-any.whl", hash = "sha256:32cdf0967287f3ec25a9dc09df0d29cb86b8900c3e0546a63d672775d8127abf"},
+    {file = "boto3-1.36.12.tar.gz", hash = "sha256:287d84f49bba3255a17b374578127d42b6251e72f55914a62e0ad9ca78c0954b"},
 ]
 
 [package.dependencies]
-botocore = ">=1.36.4,<1.37.0"
+botocore = ">=1.36.12,<1.37.0"
 jmespath = ">=0.7.1,<2.0.0"
 s3transfer = ">=0.11.0,<0.12.0"
 
@@ -952,15 +952,15 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
 
 [[package]]
 name = "botocore"
-version = "1.36.5"
+version = "1.36.12"
 description = "Low-level, data-driven core of boto 3."
 optional = false
 python-versions = ">=3.8"
 groups = ["main"]
 markers = "python_version == \"3.11\" or python_version >= \"3.12\""
 files = [
-    {file = "botocore-1.36.5-py3-none-any.whl", hash = "sha256:6d9f70afa9bf9d21407089dc22b8cc8ec6fa44866d4660858c062c74fc8555eb"},
-    {file = "botocore-1.36.5.tar.gz", hash = "sha256:234ed3d29a8954c37a551c933453bf14c6ae44a69a4f273ffef377a2612ca6a6"},
+    {file = "botocore-1.36.12-py3-none-any.whl", hash = "sha256:5ae1ed362c8ed908a6ced8cdd12b21e2196c100bc79f9e95c9c1fc7f9ea74f5a"},
+    {file = "botocore-1.36.12.tar.gz", hash = "sha256:86ed88beb4f244c96529435c868d3940073c2774116f0023fb7691f6e7053bd9"},
 ]
 
 [package.dependencies]
@@ -969,7 +969,7 @@ python-dateutil = ">=2.1,<3.0.0"
 urllib3 = {version = ">=1.25.4,<2.2.0 || >2.2.0,<3", markers = "python_version >= \"3.10\""}
 
 [package.extras]
-crt = ["awscrt (==0.23.4)"]
+crt = ["awscrt (==0.23.8)"]
 
 [[package]]
 name = "bottleneck"
@@ -1043,6 +1043,10 @@ files = [
     {file = "Brotli-1.1.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:a37b8f0391212d29b3a91a799c8e4a2855e0576911cdfb2515487e30e322253d"},
     {file = "Brotli-1.1.0-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:e84799f09591700a4154154cab9787452925578841a94321d5ee8fb9a9a328f0"},
     {file = "Brotli-1.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f66b5337fa213f1da0d9000bc8dc0cb5b896b726eefd9c6046f699b169c41b9e"},
+    {file = "Brotli-1.1.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5dab0844f2cf82be357a0eb11a9087f70c5430b2c241493fc122bb6f2bb0917c"},
+    {file = "Brotli-1.1.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e4fe605b917c70283db7dfe5ada75e04561479075761a0b3866c081d035b01c1"},
+    {file = "Brotli-1.1.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:1e9a65b5736232e7a7f91ff3d02277f11d339bf34099a56cdab6a8b3410a02b2"},
+    {file = "Brotli-1.1.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:58d4b711689366d4a03ac7957ab8c28890415e267f9b6589969e74b6e42225ec"},
     {file = "Brotli-1.1.0-cp310-cp310-win32.whl", hash = "sha256:be36e3d172dc816333f33520154d708a2657ea63762ec16b62ece02ab5e4daf2"},
     {file = "Brotli-1.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:0c6244521dda65ea562d5a69b9a26120769b7a9fb3db2fe9545935ed6735b128"},
     {file = "Brotli-1.1.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:a3daabb76a78f829cafc365531c972016e4aa8d5b4bf60660ad8ecee19df7ccc"},
@@ -1055,8 +1059,14 @@ files = [
     {file = "Brotli-1.1.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:19c116e796420b0cee3da1ccec3b764ed2952ccfcc298b55a10e5610ad7885f9"},
     {file = "Brotli-1.1.0-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:510b5b1bfbe20e1a7b3baf5fed9e9451873559a976c1a78eebaa3b86c57b4265"},
     {file = "Brotli-1.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:a1fd8a29719ccce974d523580987b7f8229aeace506952fa9ce1d53a033873c8"},
+    {file = "Brotli-1.1.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c247dd99d39e0338a604f8c2b3bc7061d5c2e9e2ac7ba9cc1be5a69cb6cd832f"},
+    {file = "Brotli-1.1.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:1b2c248cd517c222d89e74669a4adfa5577e06ab68771a529060cf5a156e9757"},
+    {file = "Brotli-1.1.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:2a24c50840d89ded6c9a8fdc7b6ed3692ed4e86f1c4a4a938e1e92def92933e0"},
+    {file = "Brotli-1.1.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f31859074d57b4639318523d6ffdca586ace54271a73ad23ad021acd807eb14b"},
     {file = "Brotli-1.1.0-cp311-cp311-win32.whl", hash = "sha256:39da8adedf6942d76dc3e46653e52df937a3c4d6d18fdc94a7c29d263b1f5b50"},
     {file = "Brotli-1.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:aac0411d20e345dc0920bdec5548e438e999ff68d77564d5e9463a7ca9d3e7b1"},
+    {file = "Brotli-1.1.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:32d95b80260d79926f5fab3c41701dbb818fde1c9da590e77e571eefd14abe28"},
+    {file = "Brotli-1.1.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:b760c65308ff1e462f65d69c12e4ae085cff3b332d894637f6273a12a482d09f"},
     {file = "Brotli-1.1.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:316cc9b17edf613ac76b1f1f305d2a748f1b976b033b049a6ecdfd5612c70409"},
     {file = "Brotli-1.1.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:caf9ee9a5775f3111642d33b86237b05808dafcd6268faa492250e9b78046eb2"},
     {file = "Brotli-1.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:70051525001750221daa10907c77830bc889cb6d865cc0b813d9db7fefc21451"},
@@ -1067,8 +1077,24 @@ files = [
     {file = "Brotli-1.1.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:4093c631e96fdd49e0377a9c167bfd75b6d0bad2ace734c6eb20b348bc3ea180"},
     {file = "Brotli-1.1.0-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:7e4c4629ddad63006efa0ef968c8e4751c5868ff0b1c5c40f76524e894c50248"},
     {file = "Brotli-1.1.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:861bf317735688269936f755fa136a99d1ed526883859f86e41a5d43c61d8966"},
+    {file = "Brotli-1.1.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:87a3044c3a35055527ac75e419dfa9f4f3667a1e887ee80360589eb8c90aabb9"},
+    {file = "Brotli-1.1.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:c5529b34c1c9d937168297f2c1fde7ebe9ebdd5e121297ff9c043bdb2ae3d6fb"},
+    {file = "Brotli-1.1.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:ca63e1890ede90b2e4454f9a65135a4d387a4585ff8282bb72964fab893f2111"},
+    {file = "Brotli-1.1.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e79e6520141d792237c70bcd7a3b122d00f2613769ae0cb61c52e89fd3443839"},
     {file = "Brotli-1.1.0-cp312-cp312-win32.whl", hash = "sha256:5f4d5ea15c9382135076d2fb28dde923352fe02951e66935a9efaac8f10e81b0"},
     {file = "Brotli-1.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:906bc3a79de8c4ae5b86d3d75a8b77e44404b0f4261714306e3ad248d8ab0951"},
+    {file = "Brotli-1.1.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:8bf32b98b75c13ec7cf774164172683d6e7891088f6316e54425fde1efc276d5"},
+    {file = "Brotli-1.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:7bc37c4d6b87fb1017ea28c9508b36bbcb0c3d18b4260fcdf08b200c74a6aee8"},
+    {file = "Brotli-1.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3c0ef38c7a7014ffac184db9e04debe495d317cc9c6fb10071f7fefd93100a4f"},
+    {file = "Brotli-1.1.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:91d7cc2a76b5567591d12c01f019dd7afce6ba8cba6571187e21e2fc418ae648"},
+    {file = "Brotli-1.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a93dde851926f4f2678e704fadeb39e16c35d8baebd5252c9fd94ce8ce68c4a0"},
+    {file = "Brotli-1.1.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f0db75f47be8b8abc8d9e31bc7aad0547ca26f24a54e6fd10231d623f183d089"},
+    {file = "Brotli-1.1.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:6967ced6730aed543b8673008b5a391c3b1076d834ca438bbd70635c73775368"},
+    {file = "Brotli-1.1.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:7eedaa5d036d9336c95915035fb57422054014ebdeb6f3b42eac809928e40d0c"},
+    {file = "Brotli-1.1.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:d487f5432bf35b60ed625d7e1b448e2dc855422e87469e3f450aa5552b0eb284"},
+    {file = "Brotli-1.1.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:832436e59afb93e1836081a20f324cb185836c617659b07b129141a8426973c7"},
+    {file = "Brotli-1.1.0-cp313-cp313-win32.whl", hash = "sha256:43395e90523f9c23a3d5bdf004733246fba087f2948f87ab28015f12359ca6a0"},
+    {file = "Brotli-1.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:9011560a466d2eb3f5a6e4929cf4a09be405c64154e12df0dd72713f6500e32b"},
     {file = "Brotli-1.1.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:a090ca607cbb6a34b0391776f0cb48062081f5f60ddcce5d11838e67a01928d1"},
     {file = "Brotli-1.1.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2de9d02f5bda03d27ede52e8cfe7b865b066fa49258cbab568720aa5be80a47d"},
     {file = "Brotli-1.1.0-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2333e30a5e00fe0fe55903c8832e08ee9c3b1382aacf4db26664a16528d51b4b"},
@@ -1078,6 +1104,10 @@ files = [
     {file = "Brotli-1.1.0-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:fd5f17ff8f14003595ab414e45fce13d073e0762394f957182e69035c9f3d7c2"},
     {file = "Brotli-1.1.0-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:069a121ac97412d1fe506da790b3e69f52254b9df4eb665cd42460c837193354"},
     {file = "Brotli-1.1.0-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:e93dfc1a1165e385cc8239fab7c036fb2cd8093728cbd85097b284d7b99249a2"},
+    {file = "Brotli-1.1.0-cp36-cp36m-musllinux_1_2_aarch64.whl", hash = "sha256:aea440a510e14e818e67bfc4027880e2fb500c2ccb20ab21c7a7c8b5b4703d75"},
+    {file = "Brotli-1.1.0-cp36-cp36m-musllinux_1_2_i686.whl", hash = "sha256:6974f52a02321b36847cd19d1b8e381bf39939c21efd6ee2fc13a28b0d99348c"},
+    {file = "Brotli-1.1.0-cp36-cp36m-musllinux_1_2_ppc64le.whl", hash = "sha256:a7e53012d2853a07a4a79c00643832161a910674a893d296c9f1259859a289d2"},
+    {file = "Brotli-1.1.0-cp36-cp36m-musllinux_1_2_x86_64.whl", hash = "sha256:d7702622a8b40c49bffb46e1e3ba2e81268d5c04a34f460978c6b5517a34dd52"},
     {file = "Brotli-1.1.0-cp36-cp36m-win32.whl", hash = "sha256:a599669fd7c47233438a56936988a2478685e74854088ef5293802123b5b2460"},
     {file = "Brotli-1.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:d143fd47fad1db3d7c27a1b1d66162e855b5d50a89666af46e1679c496e8e579"},
     {file = "Brotli-1.1.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:11d00ed0a83fa22d29bc6b64ef636c4552ebafcef57154b4ddd132f5638fbd1c"},
@@ -1089,6 +1119,10 @@ files = [
     {file = "Brotli-1.1.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:919e32f147ae93a09fe064d77d5ebf4e35502a8df75c29fb05788528e330fe74"},
     {file = "Brotli-1.1.0-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:23032ae55523cc7bccb4f6a0bf368cd25ad9bcdcc1990b64a647e7bbcce9cb5b"},
     {file = "Brotli-1.1.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:224e57f6eac61cc449f498cc5f0e1725ba2071a3d4f48d5d9dffba42db196438"},
+    {file = "Brotli-1.1.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:cb1dac1770878ade83f2ccdf7d25e494f05c9165f5246b46a621cc849341dc01"},
+    {file = "Brotli-1.1.0-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:3ee8a80d67a4334482d9712b8e83ca6b1d9bc7e351931252ebef5d8f7335a547"},
+    {file = "Brotli-1.1.0-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:5e55da2c8724191e5b557f8e18943b1b4839b8efc3ef60d65985bcf6f587dd38"},
+    {file = "Brotli-1.1.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:d342778ef319e1026af243ed0a07c97acf3bad33b9f29e7ae6a1f68fd083e90c"},
     {file = "Brotli-1.1.0-cp37-cp37m-win32.whl", hash = "sha256:587ca6d3cef6e4e868102672d3bd9dc9698c309ba56d41c2b9c85bbb903cdb95"},
     {file = "Brotli-1.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:2954c1c23f81c2eaf0b0717d9380bd348578a94161a65b3a2afc62c86467dd68"},
     {file = "Brotli-1.1.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:efa8b278894b14d6da122a72fefcebc28445f2d3f880ac59d46c90f4c13be9a3"},
@@ -1101,6 +1135,10 @@ files = [
     {file = "Brotli-1.1.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:1ab4fbee0b2d9098c74f3057b2bc055a8bd92ccf02f65944a241b4349229185a"},
     {file = "Brotli-1.1.0-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:141bd4d93984070e097521ed07e2575b46f817d08f9fa42b16b9b5f27b5ac088"},
     {file = "Brotli-1.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fce1473f3ccc4187f75b4690cfc922628aed4d3dd013d047f95a9b3919a86596"},
+    {file = "Brotli-1.1.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:d2b35ca2c7f81d173d2fadc2f4f31e88cc5f7a39ae5b6db5513cf3383b0e0ec7"},
+    {file = "Brotli-1.1.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:af6fa6817889314555aede9a919612b23739395ce767fe7fcbea9a80bf140fe5"},
+    {file = "Brotli-1.1.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:2feb1d960f760a575dbc5ab3b1c00504b24caaf6986e2dc2b01c09c87866a943"},
+    {file = "Brotli-1.1.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:4410f84b33374409552ac9b6903507cdb31cd30d2501fc5ca13d18f73548444a"},
     {file = "Brotli-1.1.0-cp38-cp38-win32.whl", hash = "sha256:db85ecf4e609a48f4b29055f1e144231b90edc90af7481aa731ba2d059226b1b"},
     {file = "Brotli-1.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:3d7954194c36e304e1523f55d7042c59dc53ec20dd4e9ea9d151f1b62b4415c0"},
     {file = "Brotli-1.1.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5fb2ce4b8045c78ebbc7b8f3c15062e435d47e7393cc57c25115cfd49883747a"},
@@ -1113,6 +1151,10 @@ files = [
     {file = "Brotli-1.1.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:949f3b7c29912693cee0afcf09acd6ebc04c57af949d9bf77d6101ebb61e388c"},
     {file = "Brotli-1.1.0-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:89f4988c7203739d48c6f806f1e87a1d96e0806d44f0fba61dba81392c9e474d"},
     {file = "Brotli-1.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:de6551e370ef19f8de1807d0a9aa2cdfdce2e85ce88b122fe9f6b2b076837e59"},
+    {file = "Brotli-1.1.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:0737ddb3068957cf1b054899b0883830bb1fec522ec76b1098f9b6e0f02d9419"},
+    {file = "Brotli-1.1.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:4f3607b129417e111e30637af1b56f24f7a49e64763253bbc275c75fa887d4b2"},
+    {file = "Brotli-1.1.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:6c6e0c425f22c1c719c42670d561ad682f7bfeeef918edea971a79ac5252437f"},
+    {file = "Brotli-1.1.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:494994f807ba0b92092a163a0a283961369a65f6cbe01e8891132b7a320e61eb"},
     {file = "Brotli-1.1.0-cp39-cp39-win32.whl", hash = "sha256:f0d8a7a6b5983c2496e364b969f0e526647a06b075d034f3297dc66f3b360c64"},
     {file = "Brotli-1.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:cdad5b9014d83ca68c25d2e9444e28e967ef16e80f6b436918c700c117a85467"},
     {file = "Brotli-1.1.0.tar.gz", hash = "sha256:81de08ac11bcb85841e440c13611c00b67d3bf82698314928d0b676362546724"},
@@ -2084,7 +2126,6 @@ files = [
     {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:761817a3377ef15ac23cd7834715081791d4ec77f9297ee694ca1ee9c2c7e5eb"},
     {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:3c672a53c0fb4725a29c303be906d3c1fa99c32f58abe008a82705f9ee96f40b"},
     {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:4ac4c9f37eba52cb6fbeaf5b59c152ea976726b865bd4cf87883a7e7006cc543"},
-    {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:60eb32934076fa07e4316b7b2742fa52cbb190b42c2df2863dbc4230a0a9b385"},
     {file = "cryptography-44.0.0-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ed3534eb1090483c96178fcb0f8893719d96d5274dfde98aa6add34614e97c8e"},
     {file = "cryptography-44.0.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:f3f6fdfa89ee2d9d496e2c087cebef9d4fcbb0ad63c40e821b39f74bf48d9c5e"},
     {file = "cryptography-44.0.0-cp37-abi3-win32.whl", hash = "sha256:eb33480f1bad5b78233b0ad3e1b0be21e8ef1da745d8d2aecbb20671658b9053"},
@@ -2095,7 +2136,6 @@ files = [
     {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:c5eb858beed7835e5ad1faba59e865109f3e52b3783b9ac21e7e47dc5554e289"},
     {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f53c2c87e0fb4b0c00fa9571082a057e37690a8f12233306161c8f4b819960b7"},
     {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:9e6fc8a08e116fb7c7dd1f040074c9d7b51d74a8ea40d4df2fc7aa08b76b9e6c"},
-    {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:9abcc2e083cbe8dde89124a47e5e53ec38751f0d7dfd36801008f316a127d7ba"},
     {file = "cryptography-44.0.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:d2436114e46b36d00f8b72ff57e598978b37399d2786fd39793c36c6d5cb1c64"},
     {file = "cryptography-44.0.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a01956ddfa0a6790d594f5b34fc1bfa6098aca434696a03cfdbe469b8ed79285"},
     {file = "cryptography-44.0.0-cp39-abi3-win32.whl", hash = "sha256:eca27345e1214d1b9f9490d200f9db5a874479be914199194e746c893788d417"},
@@ -7761,6 +7801,7 @@ files = [
     {file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:bb89f0a835bcfc1d42ccd5f41f04870c1b936d8507c6df12b7737febc40f0909"},
     {file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:f0c2d907a1e102526dd2986df638343388b94c33860ff3bbe1384130828714b1"},
     {file = "psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f8157bed2f51db683f31306aa497311b560f2265998122abe1dce6428bd86567"},
+    {file = "psycopg2_binary-2.9.10-cp313-cp313-win_amd64.whl", hash = "sha256:27422aa5f11fbcd9b18da48373eb67081243662f9b46e6fd07c3eb46e4535142"},
     {file = "psycopg2_binary-2.9.10-cp38-cp38-macosx_12_0_x86_64.whl", hash = "sha256:eb09aa7f9cecb45027683bb55aebaaf45a0df8bf6de68801a6afdc7947bb09d4"},
     {file = "psycopg2_binary-2.9.10-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b73d6d7f0ccdad7bc43e6d34273f70d587ef62f824d7261c4ae9b8b1b6af90e8"},
     {file = "psycopg2_binary-2.9.10-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ce5ab4bf46a211a8e924d307c1b1fcda82368586a19d0a24f8ae166f5c784864"},
@@ -12388,4 +12429,4 @@ cffi = ["cffi (>=1.11)"]
 [metadata]
 lock-version = "2.1"
 python-versions = ">=3.11,<3.13"
-content-hash = "6243573a26b9aa03558eb2c176d2477a08b1033a17065e870e4be83af0af644d"
+content-hash = "14896fb8a4495238d70515986341128d0096ba130c3acce127a29a903a59a811"

+ 1 - 1
api/pyproject.toml

@@ -21,7 +21,7 @@ azure-ai-inference = "~1.0.0b3"
 azure-ai-ml = "~1.20.0"
 azure-identity = "1.16.1"
 beautifulsoup4 = "4.12.2"
-boto3 = "1.36.4"
+boto3 = "1.36.12"
 bs4 = "~0.0.1"
 cachetools = "~5.3.0"
 celery = "~5.4.0"

+ 1 - 1
sdks/python-client/tests/test_client.py

@@ -87,7 +87,7 @@ class TestKnowledgeBaseClient(unittest.TestCase):
     def _test_005_batch_indexing_status(self):
         client = self._get_dataset_kb_client()
         response = client.batch_indexing_status(self.batch_id)
-        data = response.json()
+        response.json()
         self.assertEqual(response.status_code, 200)
 
     def _test_006_update_document_by_file(self):