bailian-20231229/main.tea (3,461 lines of code) (raw):

/** * */ import Util; import OpenApi; import OpenApiUtil; import EndpointUtil; extends OpenApi; init(config: OpenApi.Config){ super(config); @endpointRule = ''; checkConfig(config); @endpoint = getEndpoint('bailian', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint); } function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{ if (!Util.empty(endpoint)) { return endpoint; } if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) { return endpointMap[regionId]; } return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix); } model AddCategoryRequest { categoryName?: string(name='CategoryName', description='This parameter is required.'), categoryType?: string(name='CategoryType', description='This parameter is required.', example='UNSTRUCTURED'), parentCategoryId?: string(name='ParentCategoryId', example='cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX'), } model AddCategoryResponseBody = { code?: string(name='Code', example='success'), data?: { categoryId?: string(name='CategoryId', example='cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX'), categoryName?: string(name='CategoryName'), }(name='Data'), message?: string(name='Message', example='Requests throttling triggered.'), requestId?: string(name='RequestId', description='Id of the request', example='778C0B3B-03C1-5FC1-A947-36EDD13606AB'), status?: string(name='Status', example='200'), success?: boolean(name='Success', example='true'), } model AddCategoryResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: AddCategoryResponseBody(name='body'), } /** * @summary 添加类目 * * @param request AddCategoryRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return AddCategoryResponse */ async function addCategoryWithOptions(WorkspaceId: string, request: AddCategoryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): AddCategoryResponse { Util.validateModel(request); var body : map[string]any = {}; if (!Util.isUnset(request.categoryName)) { body['CategoryName'] = request.categoryName; } if (!Util.isUnset(request.categoryType)) { body['CategoryType'] = request.categoryType; } if (!Util.isUnset(request.parentCategoryId)) { body['ParentCategoryId'] = request.parentCategoryId; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'AddCategory', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/category/`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 添加类目 * * @param request AddCategoryRequest * @return AddCategoryResponse */ async function addCategory(WorkspaceId: string, request: AddCategoryRequest): AddCategoryResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return addCategoryWithOptions(WorkspaceId, request, headers, runtime); } model AddFileRequest { categoryId?: string(name='CategoryId', description='The primary key ID of the category to which the document is uploaded. This parameter corresponds to the `CategoryId`<props="china"> returned by the [AddCategory](https://www.alibabacloud.com/help/zh/model-studio/developer-reference/api-bailian-2023-12-29-addcategory) operation. You can also click the ID icon next to the category name on the Unstructured Data tab of the [Data Management](https://bailian.console.alibabacloud.com/#/data-center) page to view the ID. You can set the parameter to default, which specifies the Default Category created by the system. This parameter is required.', example='cate_cdd11b1b79a74e8bbd675c356a91ee3510024405'), categoryType?: string(name='CategoryType'), leaseId?: string(name='LeaseId', description='The lease ID, which corresponds to the `FileUploadLeaseId` parameter returned by the [ApplyFileUploadLease](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-applyfileuploadlease) operation. This parameter is required.', example='68abd1dea7b6404d8f7d7b9f7fbd332d.1716698936847'), originalFileUrl?: string(name='OriginalFileUrl'), parser?: string(name='Parser', description='The parser. Valid value: * DASHSCOPE_DOCMIND: Intelligent document parsing by Alibaba Cloud. This parameter is required.', example='DASHSCOPE_DOCMIND'), tags?: [ string ](name='Tags', description='A list of tags associated with the document. The default value is null, which means no tags. You can specify up to 10 tags.'), } model AddFileShrinkRequest { categoryId?: string(name='CategoryId', description='The primary key ID of the category to which the document is uploaded. This parameter corresponds to the `CategoryId`<props="china"> returned by the [AddCategory](https://www.alibabacloud.com/help/zh/model-studio/developer-reference/api-bailian-2023-12-29-addcategory) operation. You can also click the ID icon next to the category name on the Unstructured Data tab of the [Data Management](https://bailian.console.alibabacloud.com/#/data-center) page to view the ID. You can set the parameter to default, which specifies the Default Category created by the system. This parameter is required.', example='cate_cdd11b1b79a74e8bbd675c356a91ee3510024405'), categoryType?: string(name='CategoryType'), leaseId?: string(name='LeaseId', description='The lease ID, which corresponds to the `FileUploadLeaseId` parameter returned by the [ApplyFileUploadLease](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-applyfileuploadlease) operation. This parameter is required.', example='68abd1dea7b6404d8f7d7b9f7fbd332d.1716698936847'), originalFileUrl?: string(name='OriginalFileUrl'), parser?: string(name='Parser', description='The parser. Valid value: * DASHSCOPE_DOCMIND: Intelligent document parsing by Alibaba Cloud. This parameter is required.', example='DASHSCOPE_DOCMIND'), tagsShrink?: string(name='Tags', description='A list of tags associated with the document. The default value is null, which means no tags. You can specify up to 10 tags.'), } model AddFileResponseBody = { code?: string(name='Code', description='The status code.', example='DataCenter.FileTooLarge'), data?: { fileId?: string(name='FileId', description='The primary key ID of the document. We recommend that you store the ID because it is required for all subsequent API operations related to this document.', example='file_9a65732555b54d5ea10796ca5742ba22_XXXXXXXX'), parser?: string(name='Parser', description='The parser that is used to parse the document. Valid value: * DASHSCOPE_DOCMIND: Intelligent document parsing by Alibaba Cloud.', example='DASHSCOPE_DOCMIND'), }(name='Data', description='The returned data fields.'), message?: string(name='Message', description='The error message.', example='User not authorized to operate on the specified resource.'), requestId?: string(name='RequestId', description='The request ID.', example='778C0B3B-xxxx-5FC1-A947-36EDD13606AB'), status?: string(name='Status', description='The HTTP status code.', example='200'), success?: string(name='Success', description='Indications whether the call is successful. Valid values: * true * false', example='true'), } model AddFileResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: AddFileResponseBody(name='body'), } /** * @summary Imports an unstructured document stored in the temporary storage space to Data Management. You cannot use the API to import structured documents. Use the console instead. * * @description * Before you call this operation, make sure that you have obtained the lease and uploaded the document to the temporary storage space by using the [ApplyFileUploadLease](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-applyfileuploadlease) operation. For more information, see [Upload files by calling API](https://www.alibabacloud.com/help/en/model-studio/developer-reference/upload-files-by-calling-api). * > After you call this operation, the used lease ID expires immediately. Do not use the same lease ID to submit new requests. * * You must call this operation within 12 hours after you call the [ApplyFileUploadLease](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-applyfileuploadlease) operation. Otherwise, the lease expires and the request fails. * * After you call this operation, the system parses and imports your document. The process takes some time. * * This interface is not idempotent. * * @param tmpReq AddFileRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return AddFileResponse */ async function addFileWithOptions(WorkspaceId: string, tmpReq: AddFileRequest, headers: map[string]string, runtime: Util.RuntimeOptions): AddFileResponse { Util.validateModel(tmpReq); var request = new AddFileShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.tags)) { request.tagsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tags, 'Tags', 'json'); } var body : map[string]any = {}; if (!Util.isUnset(request.categoryId)) { body['CategoryId'] = request.categoryId; } if (!Util.isUnset(request.categoryType)) { body['CategoryType'] = request.categoryType; } if (!Util.isUnset(request.leaseId)) { body['LeaseId'] = request.leaseId; } if (!Util.isUnset(request.originalFileUrl)) { body['OriginalFileUrl'] = request.originalFileUrl; } if (!Util.isUnset(request.parser)) { body['Parser'] = request.parser; } if (!Util.isUnset(request.tagsShrink)) { body['Tags'] = request.tagsShrink; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'AddFile', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/file`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Imports an unstructured document stored in the temporary storage space to Data Management. You cannot use the API to import structured documents. Use the console instead. * * @description * Before you call this operation, make sure that you have obtained the lease and uploaded the document to the temporary storage space by using the [ApplyFileUploadLease](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-applyfileuploadlease) operation. For more information, see [Upload files by calling API](https://www.alibabacloud.com/help/en/model-studio/developer-reference/upload-files-by-calling-api). * > After you call this operation, the used lease ID expires immediately. Do not use the same lease ID to submit new requests. * * You must call this operation within 12 hours after you call the [ApplyFileUploadLease](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-applyfileuploadlease) operation. Otherwise, the lease expires and the request fails. * * After you call this operation, the system parses and imports your document. The process takes some time. * * This interface is not idempotent. * * @param request AddFileRequest * @return AddFileResponse */ async function addFile(WorkspaceId: string, request: AddFileRequest): AddFileResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return addFileWithOptions(WorkspaceId, request, headers, runtime); } model ApplyFileUploadLeaseRequest { categoryType?: string(name='CategoryType'), fileName?: string(name='FileName', description='The name of the uploaded document, including the extension. Supported formats: pdf, doc, docx, md, txt, ppt, and pptx. The document name must be 4 to 128 characters in length. This parameter is required.'), md5?: string(name='Md5', description='The MD5 value of the uploaded document. This parameter is verified by the server (not in the current version). This parameter is required.', example='19657c391f6c70bcea63c154d8606bb3'), sizeInBytes?: string(name='SizeInBytes', description='The size of the uploaded document, in bytes. This parameter is verified by the server (not in the current version). Valid values: 1 to 100000000. This parameter is required.', example='1000'), useInternalEndpoint?: boolean(name='UseInternalEndpoint'), } model ApplyFileUploadLeaseResponseBody = { code?: string(name='Code', description='The status code.', example='DataCenter.FileTooLarge'), data?: { fileUploadLeaseId?: string(name='FileUploadLeaseId', description='The unique ID of the lease.', example='1e6a159107384782be5e45ac4759b247.1719325231035'), param?: { headers?: any(name='Headers', description='The key-value pair to be placed in the Header. Both the key and the value are strings.', example='"X-bailian-extra": "MTAwNTQyNjQ5NTE2OTE3OA==", "Content-Type": "application/pdf"'), method?: string(name='Method', description='The HTTP call method. Valid values: * PUT * POST', example='PUT'), url?: string(name='Url', description='The upload URL of the document.', example='https://bailian-datahub-data-origin-prod.oss-cn-hangzhou.aliyuncs.com/1005426495169178/10024405/68abd1dea7b6404d8f7d7b9f7fbd332d.1716698936847.pdf?Expires=1716699536&OSSAccessKeyId=TestID&Signature=HfwPUZo4pR6DatSDym0zFKVh9Wg%3D'), }(name='Param', description='The HTTP request parameters used to upload the document.'), type?: string(name='Type', description='The upload method of the document. Valid values: * OSS.PreSignedURL * HTTP', example='HTTP'), }(name='Data', description='The returned data fields.'), message?: string(name='Message', description='The error message.', example='User not authorized to operate on the specified resource'), requestId?: string(name='RequestId', description='The request ID.', example='778C0B3B-xxxx-5FC1-A947-36EDD13606AB'), status?: string(name='Status', description='The HTTP status code.', example='200'), success?: boolean(name='Success', description='Indications whether the call is successful. Valid values: * true * false', example='true'), } model ApplyFileUploadLeaseResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ApplyFileUploadLeaseResponseBody(name='body'), } /** * @summary Applies for a document upload lease to upload a document. * * @description * This operation returns an HTTP URL that can be used to upload an unstructured document (the lease) and parameters required for the upload. Structured documents are not supported. * * The HTTP URL returned by this operation is valid only for minutes. Upload the document before the URL expires. * * After you apply for a lease and upload a document, the document is stored in a temporary storage space for 12 hours. * * This interface is not idempotent. * * @param request ApplyFileUploadLeaseRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ApplyFileUploadLeaseResponse */ async function applyFileUploadLeaseWithOptions(CategoryId: string, WorkspaceId: string, request: ApplyFileUploadLeaseRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ApplyFileUploadLeaseResponse { Util.validateModel(request); var body : map[string]any = {}; if (!Util.isUnset(request.categoryType)) { body['CategoryType'] = request.categoryType; } if (!Util.isUnset(request.fileName)) { body['FileName'] = request.fileName; } if (!Util.isUnset(request.md5)) { body['Md5'] = request.md5; } if (!Util.isUnset(request.sizeInBytes)) { body['SizeInBytes'] = request.sizeInBytes; } if (!Util.isUnset(request.useInternalEndpoint)) { body['UseInternalEndpoint'] = request.useInternalEndpoint; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'ApplyFileUploadLease', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/category/${OpenApiUtil.getEncodeParam(CategoryId)}`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Applies for a document upload lease to upload a document. * * @description * This operation returns an HTTP URL that can be used to upload an unstructured document (the lease) and parameters required for the upload. Structured documents are not supported. * * The HTTP URL returned by this operation is valid only for minutes. Upload the document before the URL expires. * * After you apply for a lease and upload a document, the document is stored in a temporary storage space for 12 hours. * * This interface is not idempotent. * * @param request ApplyFileUploadLeaseRequest * @return ApplyFileUploadLeaseResponse */ async function applyFileUploadLease(CategoryId: string, WorkspaceId: string, request: ApplyFileUploadLeaseRequest): ApplyFileUploadLeaseResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return applyFileUploadLeaseWithOptions(CategoryId, WorkspaceId, request, headers, runtime); } model CreateAndPulishAgentRequest { applicationConfig?: { historyConfig?: { enableAdbRecord?: boolean(name='enableAdbRecord'), enableRecord?: boolean(name='enableRecord'), instanceId?: string(name='instanceId'), region?: string(name='region'), storeCode?: string(name='storeCode'), }(name='historyConfig'), longTermMemory?: { enable?: boolean(name='enable'), }(name='longTermMemory'), parameters?: { dialogRound?: int32(name='dialogRound'), maxTokens?: int32(name='maxTokens'), temperature?: double(name='temperature'), }(name='parameters'), ragConfig?: { answerScope?: string(name='answerScope'), enableCitation?: boolean(name='enableCitation'), enableSearch?: boolean(name='enableSearch'), enableWebSearch?: boolean(name='enableWebSearch'), fixedReplyDetail?: string(name='fixedReplyDetail'), knowledgeBaseCodeList?: [ string ](name='knowledgeBaseCodeList'), promptStrategy?: string(name='promptStrategy'), ragRejectType?: string(name='ragRejectType'), rejectFilterPrompt?: string(name='rejectFilterPrompt'), rejectFilterType?: string(name='rejectFilterType'), retrieveMaxLength?: int32(name='retrieveMaxLength'), topK?: int32(name='topK'), }(name='ragConfig'), securityConfig?: { processingStrategy?: string(name='processingStrategy'), }(name='securityConfig'), tools?: [ { type?: string(name='type'), } ](name='tools'), workFlows?: [ { type?: string(name='type'), } ](name='workFlows'), }(name='applicationConfig'), instructions?: string(name='instructions'), modelId?: string(name='modelId'), name?: string(name='name'), sampleLibrary?: { enableSample?: boolean(name='enableSample'), sampleLibraryIdList?: [ string ](name='sampleLibraryIdList'), topK?: int32(name='topK'), }(name='sampleLibrary'), } model CreateAndPulishAgentShrinkRequest { applicationConfigShrink?: string(name='applicationConfig'), instructions?: string(name='instructions'), modelId?: string(name='modelId'), name?: string(name='name'), sampleLibraryShrink?: string(name='sampleLibrary'), } model CreateAndPulishAgentResponseBody = { code?: string(name='code'), data?: string(name='data'), httpStatusCode?: int32(name='httpStatusCode'), message?: string(name='message'), requestId?: string(name='requestId'), success?: boolean(name='success'), } model CreateAndPulishAgentResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreateAndPulishAgentResponseBody(name='body'), } /** * @summary 创建并发布智能体应用 * * @param tmpReq CreateAndPulishAgentRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreateAndPulishAgentResponse */ async function createAndPulishAgentWithOptions(workspaceId: string, tmpReq: CreateAndPulishAgentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateAndPulishAgentResponse { Util.validateModel(tmpReq); var request = new CreateAndPulishAgentShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.applicationConfig)) { request.applicationConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.applicationConfig, 'applicationConfig', 'json'); } if (!Util.isUnset(tmpReq.sampleLibrary)) { request.sampleLibraryShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sampleLibrary, 'sampleLibrary', 'json'); } var body : map[string]any = {}; if (!Util.isUnset(request.applicationConfigShrink)) { body['applicationConfig'] = request.applicationConfigShrink; } if (!Util.isUnset(request.instructions)) { body['instructions'] = request.instructions; } if (!Util.isUnset(request.modelId)) { body['modelId'] = request.modelId; } if (!Util.isUnset(request.name)) { body['name'] = request.name; } if (!Util.isUnset(request.sampleLibraryShrink)) { body['sampleLibrary'] = request.sampleLibraryShrink; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'CreateAndPulishAgent', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/application/agents`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 创建并发布智能体应用 * * @param request CreateAndPulishAgentRequest * @return CreateAndPulishAgentResponse */ async function createAndPulishAgent(workspaceId: string, request: CreateAndPulishAgentRequest): CreateAndPulishAgentResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return createAndPulishAgentWithOptions(workspaceId, request, headers, runtime); } model CreateIndexRequest { categoryIds?: [ string ](name='CategoryIds', description='The list of primary key IDs of the categories to be imported into the knowledge base.'), chunkSize?: int32(name='ChunkSize', description='The estimated length of chunks. The maximum number of characters for a chunk. Texts exceeding this limit are splited. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: [1-2048]. The default value is empty, which means using the intelligent splitting method. > If you specify the `ChunkSize` parameter, you must also specify the `OverlapSize` and `Separator` parameters. If you do not specify these three parameters, the system uses the intelligent splitting method by default.', example='128'), columns?: [ { column?: string(name='Column'), isRecall?: boolean(name='IsRecall'), isSearch?: boolean(name='IsSearch'), name?: string(name='Name'), type?: string(name='Type'), } ](name='Columns'), dataSource?: { credentialId?: string(name='CredentialId', description='> This parameter is not available. Do not specify this parameter.'), credentialKey?: string(name='CredentialKey', description='> This parameter is not available. Do not specify this parameter.'), database?: string(name='Database', description='> This parameter is not available. Do not specify this parameter.'), endpoint?: string(name='Endpoint', description='> This parameter is not available. Do not specify this parameter.'), isPrivateLink?: boolean(name='IsPrivateLink', description='> This parameter is not available. Do not specify this parameter.'), region?: string(name='Region', description='> This parameter is not available. Do not specify this parameter.'), subPath?: string(name='SubPath', description='> This parameter is not available. Do not specify this parameter.'), subType?: string(name='SubType', description='> This parameter is not available. Do not specify this parameter.'), table?: string(name='Table', description='> This parameter is not available. Do not specify this parameter.'), type?: string(name='Type', description='> This parameter is not available. Do not specify this parameter.'), }(name='DataSource', description='> This parameter is not available. Do not specify this parameter.'), description?: string(name='Description', description='The description of the knowledge base. The description must be 0 to 1,000 characters in length. This parameter is empty by default.'), documentIds?: [ string ](name='DocumentIds', description='The list of primary key IDs of the documents to be imported into the knowledge base.'), embeddingModelName?: string(name='EmbeddingModelName', description='The name of the embedding model. The embedding model converts the original input prompt and knowledge text into numerical vectors for similarity comparison. The default and only model available is DashScope text-embedding-v2. It supports multiple languages including Chinese and English and normalizes the vector results. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid value: * text-embedding-v2 The default value is null, which means using the text-embedding-v2 model.', example='text-embedding-v2'), name?: string(name='Name', description='The name of the knowledge base. The name must be 1 to 20 characters in length and can contain characters classified as letter in Unicode, including English letters, Chinese characters, digits, among others. The name can also contain colons (:), underscores (_), periods (.), and hyphens (-). This parameter is required.'), overlapSize?: int32(name='OverlapSize', description='The overlap length. The number of overlapping characters between two consecutive chunks. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: 0 to 1024. The default value is empty, which means using the intelligent splitting method.', example='16'), rerankMinScore?: double(name='RerankMinScore', description='Similarity Threshold. The lowest similarity score of chunks that can be returned. This parameter is used to filter text chunks returned by the rank model. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: [0.01-1.00]. Default value: 0.20.', example='0.20'), rerankModelName?: string(name='RerankModelName', description='The name of the rank model. The rank model is a scoring system outside the knowledge base. It calculates the similarity score of each text chunk in the input question and knowledge base and ranks them in descending order. Then, the model returns the top K chunks with the highest scores. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * gte-rerank-hybrid * gte-rerank The default value is empty, which means using the official gte-rerank-hybrid model. > If you need only semantic ranking, we recommend that you use gte-rerank. If you need both semantic ranking and text matching features to ensure relevance, we recommend that you use gte-rerank-hybrid.', example='gte-rerank-hybrid'), separator?: string(name='Separator', description='The clause identifier. The document is split into chunks based on this identifier. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). You can specify multiple identifiers and do not need to add any other characters to separate them. For example: !,\\\\\\\\\\\\n. Valid values: * \\\\n: line break * ,: Chinese comma * ,: English comma * 。 : Chinese full stop * .: English full stop * ! : Chinese exclamation point * ! : English exclamation point * ;: Chinese semicolon * ;: English semicolon * ?: Chinese question mark * ?: English question mark The default value is empty, which means using the intelligent splitting method.', example=','), sinkInstanceId?: string(name='SinkInstanceId', description='The ID of the vector storage instance. This parameter is available only when SinkType is set to ADB. You can view the ID on the [Instances](https://gpdbnext.console.aliyun.com/gpdb/list) page of AnalyticDB for PostgreSQL.', example='gp-bp321093j84'), sinkRegion?: string(name='SinkRegion', description='The region of the vector storage instance. This parameter is available only when SinkType is set to ADB. You can call the [DescribeRegions](https://www.alibabacloud.com/help/en/analyticdb/analyticdb-for-postgresql/developer-reference/api-gpdb-2016-05-03-describeregions) operation to query the most recent region list.', example='cn-hangzhou'), sinkType?: string(name='SinkType', description='The vector storage type of the knowledge base. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * DEFAULT: The built-in vector database. * ADB: AnalyticDB for PostgreSQL database. If you need advanced features, such as managing, auditing, and monitoring, we recommend that you specify ADB. > If you have not used AnalyticDB for AnalyticDB in Model Studio before, go to the [Create Knowledge Base](https://bailian.console.aliyun.com/#/knowledge-base/create) page, select ADB-PG as Vector Storage Type, and follow the instructions to grant permissions. If you specify ADB, you must also specify the `SinkInstanceId` and `SinkRegion` parameters. This parameter is required.', example='DEFAULT'), sourceType?: string(name='SourceType', description='The data type of [Data Management](https://bailian.console.aliyun.com/#/data-center). For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * DATA_CENTER_CATEGORY: The category type. Import all documents from one or more categories in Data Center. * DATA_CENTER_FILE: The document type. Import one or more documents from Data Center. > If this parameter is set to DATA_CENTER_CATEGORY, you must specify the `CategoryIds` parameter. If this parameter is set to DATA_CENTER_FILE, you must specify the `DocumentIds` parameter. > If you want to create an empty knowledge base, you can use an empty category. Set this parameter to DATA_CENTER_CATEGORY. And specify the ID of an empty category for the `CategoryIds` parameter. This parameter is required.', example='DATA_CENTER_FILE', nullable=false), structureType?: string(name='StructureType', description='The data type of the knowledge base. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid value: * unstructured > After a knowledge base is created, its data type cannot be changed. You cannot create a structured knowledge base by calling an API operation. Use the console instead. This parameter is required.', example='structured'), chunkMode?: string(name='chunkMode'), enableHeaders?: boolean(name='enableHeaders'), metaExtractColumns?: [ { desc?: string(name='Desc'), enableLlm?: boolean(name='EnableLlm'), enableSearch?: boolean(name='EnableSearch'), key?: string(name='Key'), type?: string(name='Type'), value?: string(name='Value'), } ](name='metaExtractColumns'), } model CreateIndexShrinkRequest { categoryIdsShrink?: string(name='CategoryIds', description='The list of primary key IDs of the categories to be imported into the knowledge base.'), chunkSize?: int32(name='ChunkSize', description='The estimated length of chunks. The maximum number of characters for a chunk. Texts exceeding this limit are splited. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: [1-2048]. The default value is empty, which means using the intelligent splitting method. > If you specify the `ChunkSize` parameter, you must also specify the `OverlapSize` and `Separator` parameters. If you do not specify these three parameters, the system uses the intelligent splitting method by default.', example='128'), columnsShrink?: string(name='Columns'), dataSourceShrink?: string(name='DataSource', description='> This parameter is not available. Do not specify this parameter.'), description?: string(name='Description', description='The description of the knowledge base. The description must be 0 to 1,000 characters in length. This parameter is empty by default.'), documentIdsShrink?: string(name='DocumentIds', description='The list of primary key IDs of the documents to be imported into the knowledge base.'), embeddingModelName?: string(name='EmbeddingModelName', description='The name of the embedding model. The embedding model converts the original input prompt and knowledge text into numerical vectors for similarity comparison. The default and only model available is DashScope text-embedding-v2. It supports multiple languages including Chinese and English and normalizes the vector results. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid value: * text-embedding-v2 The default value is null, which means using the text-embedding-v2 model.', example='text-embedding-v2'), name?: string(name='Name', description='The name of the knowledge base. The name must be 1 to 20 characters in length and can contain characters classified as letter in Unicode, including English letters, Chinese characters, digits, among others. The name can also contain colons (:), underscores (_), periods (.), and hyphens (-). This parameter is required.'), overlapSize?: int32(name='OverlapSize', description='The overlap length. The number of overlapping characters between two consecutive chunks. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: 0 to 1024. The default value is empty, which means using the intelligent splitting method.', example='16'), rerankMinScore?: double(name='RerankMinScore', description='Similarity Threshold. The lowest similarity score of chunks that can be returned. This parameter is used to filter text chunks returned by the rank model. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: [0.01-1.00]. Default value: 0.20.', example='0.20'), rerankModelName?: string(name='RerankModelName', description='The name of the rank model. The rank model is a scoring system outside the knowledge base. It calculates the similarity score of each text chunk in the input question and knowledge base and ranks them in descending order. Then, the model returns the top K chunks with the highest scores. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * gte-rerank-hybrid * gte-rerank The default value is empty, which means using the official gte-rerank-hybrid model. > If you need only semantic ranking, we recommend that you use gte-rerank. If you need both semantic ranking and text matching features to ensure relevance, we recommend that you use gte-rerank-hybrid.', example='gte-rerank-hybrid'), separator?: string(name='Separator', description='The clause identifier. The document is split into chunks based on this identifier. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). You can specify multiple identifiers and do not need to add any other characters to separate them. For example: !,\\\\\\\\\\\\n. Valid values: * \\\\n: line break * ,: Chinese comma * ,: English comma * 。 : Chinese full stop * .: English full stop * ! : Chinese exclamation point * ! : English exclamation point * ;: Chinese semicolon * ;: English semicolon * ?: Chinese question mark * ?: English question mark The default value is empty, which means using the intelligent splitting method.', example=','), sinkInstanceId?: string(name='SinkInstanceId', description='The ID of the vector storage instance. This parameter is available only when SinkType is set to ADB. You can view the ID on the [Instances](https://gpdbnext.console.aliyun.com/gpdb/list) page of AnalyticDB for PostgreSQL.', example='gp-bp321093j84'), sinkRegion?: string(name='SinkRegion', description='The region of the vector storage instance. This parameter is available only when SinkType is set to ADB. You can call the [DescribeRegions](https://www.alibabacloud.com/help/en/analyticdb/analyticdb-for-postgresql/developer-reference/api-gpdb-2016-05-03-describeregions) operation to query the most recent region list.', example='cn-hangzhou'), sinkType?: string(name='SinkType', description='The vector storage type of the knowledge base. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * DEFAULT: The built-in vector database. * ADB: AnalyticDB for PostgreSQL database. If you need advanced features, such as managing, auditing, and monitoring, we recommend that you specify ADB. > If you have not used AnalyticDB for AnalyticDB in Model Studio before, go to the [Create Knowledge Base](https://bailian.console.aliyun.com/#/knowledge-base/create) page, select ADB-PG as Vector Storage Type, and follow the instructions to grant permissions. If you specify ADB, you must also specify the `SinkInstanceId` and `SinkRegion` parameters. This parameter is required.', example='DEFAULT'), sourceType?: string(name='SourceType', description='The data type of [Data Management](https://bailian.console.aliyun.com/#/data-center). For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * DATA_CENTER_CATEGORY: The category type. Import all documents from one or more categories in Data Center. * DATA_CENTER_FILE: The document type. Import one or more documents from Data Center. > If this parameter is set to DATA_CENTER_CATEGORY, you must specify the `CategoryIds` parameter. If this parameter is set to DATA_CENTER_FILE, you must specify the `DocumentIds` parameter. > If you want to create an empty knowledge base, you can use an empty category. Set this parameter to DATA_CENTER_CATEGORY. And specify the ID of an empty category for the `CategoryIds` parameter. This parameter is required.', example='DATA_CENTER_FILE', nullable=false), structureType?: string(name='StructureType', description='The data type of the knowledge base. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid value: * unstructured > After a knowledge base is created, its data type cannot be changed. You cannot create a structured knowledge base by calling an API operation. Use the console instead. This parameter is required.', example='structured'), chunkMode?: string(name='chunkMode'), enableHeaders?: boolean(name='enableHeaders'), metaExtractColumnsShrink?: string(name='metaExtractColumns'), } model CreateIndexResponseBody = { code?: string(name='Code', description='HTTP status code', example='Forbidden'), data?: { id?: string(name='Id', description='The primary key ID of the knowledge base, `IndexId`. > We recommend that you store this ID. It is required for all subsequent API operations related to this knowledge base.', example='jkurxhju6b'), }(name='Data', description='The returned data.'), message?: string(name='Message', description='The error message.', example='Invalid input, variable name is missing'), requestId?: string(name='RequestId', description='The request ID.', example='17204B98-7734-4F9A-8464-2446A84821CA'), status?: string(name='Status', description='The status code.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model CreateIndexResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreateIndexResponseBody(name='body'), } /** * @summary Creates an unstructured knowledge base and imports one or more parsed documents into the knowledge base. You cannot create a structured knowledge base by calling an API operation. Use the console instead. * * @description 1. You must first upload documents to [Data Management](https://bailian.console.aliyun.com/#/data-center) and obtain the `FileId`. The documents are the knowledge source of the knowledge base. For more information, see [Import Data](https://www.alibabacloud.com/help/en/model-studio/user-guide/data-import-instructions). * 2. This operation only initializes a knowledge base creation job. You must also call the [SubmitIndexJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexjob) operation to complete the job. * 3. This interface is not idempotent. * * @param tmpReq CreateIndexRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreateIndexResponse */ async function createIndexWithOptions(WorkspaceId: string, tmpReq: CreateIndexRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateIndexResponse { Util.validateModel(tmpReq); var request = new CreateIndexShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.categoryIds)) { request.categoryIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.categoryIds, 'CategoryIds', 'json'); } if (!Util.isUnset(tmpReq.columns)) { request.columnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.columns, 'Columns', 'json'); } if (!Util.isUnset(tmpReq.dataSource)) { request.dataSourceShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.dataSource, 'DataSource', 'json'); } if (!Util.isUnset(tmpReq.documentIds)) { request.documentIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.documentIds, 'DocumentIds', 'json'); } if (!Util.isUnset(tmpReq.metaExtractColumns)) { request.metaExtractColumnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.metaExtractColumns, 'metaExtractColumns', 'json'); } var query : map[string]any = {}; if (!Util.isUnset(request.categoryIdsShrink)) { query['CategoryIds'] = request.categoryIdsShrink; } if (!Util.isUnset(request.chunkSize)) { query['ChunkSize'] = request.chunkSize; } if (!Util.isUnset(request.columnsShrink)) { query['Columns'] = request.columnsShrink; } if (!Util.isUnset(request.dataSourceShrink)) { query['DataSource'] = request.dataSourceShrink; } if (!Util.isUnset(request.description)) { query['Description'] = request.description; } if (!Util.isUnset(request.documentIdsShrink)) { query['DocumentIds'] = request.documentIdsShrink; } if (!Util.isUnset(request.embeddingModelName)) { query['EmbeddingModelName'] = request.embeddingModelName; } if (!Util.isUnset(request.name)) { query['Name'] = request.name; } if (!Util.isUnset(request.overlapSize)) { query['OverlapSize'] = request.overlapSize; } if (!Util.isUnset(request.rerankMinScore)) { query['RerankMinScore'] = request.rerankMinScore; } if (!Util.isUnset(request.rerankModelName)) { query['RerankModelName'] = request.rerankModelName; } if (!Util.isUnset(request.separator)) { query['Separator'] = request.separator; } if (!Util.isUnset(request.sinkInstanceId)) { query['SinkInstanceId'] = request.sinkInstanceId; } if (!Util.isUnset(request.sinkRegion)) { query['SinkRegion'] = request.sinkRegion; } if (!Util.isUnset(request.sinkType)) { query['SinkType'] = request.sinkType; } if (!Util.isUnset(request.sourceType)) { query['SourceType'] = request.sourceType; } if (!Util.isUnset(request.structureType)) { query['StructureType'] = request.structureType; } if (!Util.isUnset(request.chunkMode)) { query['chunkMode'] = request.chunkMode; } if (!Util.isUnset(request.enableHeaders)) { query['enableHeaders'] = request.enableHeaders; } if (!Util.isUnset(request.metaExtractColumnsShrink)) { query['metaExtractColumns'] = request.metaExtractColumnsShrink; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'CreateIndex', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/create`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Creates an unstructured knowledge base and imports one or more parsed documents into the knowledge base. You cannot create a structured knowledge base by calling an API operation. Use the console instead. * * @description 1. You must first upload documents to [Data Management](https://bailian.console.aliyun.com/#/data-center) and obtain the `FileId`. The documents are the knowledge source of the knowledge base. For more information, see [Import Data](https://www.alibabacloud.com/help/en/model-studio/user-guide/data-import-instructions). * 2. This operation only initializes a knowledge base creation job. You must also call the [SubmitIndexJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexjob) operation to complete the job. * 3. This interface is not idempotent. * * @param request CreateIndexRequest * @return CreateIndexResponse */ async function createIndex(WorkspaceId: string, request: CreateIndexRequest): CreateIndexResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return createIndexWithOptions(WorkspaceId, request, headers, runtime); } model CreateMemoryRequest { description?: string(name='description'), } model CreateMemoryResponseBody = { memoryId?: string(name='memoryId', example='6bff4f317a14442fbc9f73d29dbd5fc3'), requestId?: string(name='requestId', example='6a71f2d9-f1c9-913b-818b-114029103cad'), } model CreateMemoryResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreateMemoryResponseBody(name='body'), } /** * @summary 创建Memory * * @param request CreateMemoryRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreateMemoryResponse */ async function createMemoryWithOptions(workspaceId: string, request: CreateMemoryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateMemoryResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.description)) { query['description'] = request.description; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'CreateMemory', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 创建Memory * * @param request CreateMemoryRequest * @return CreateMemoryResponse */ async function createMemory(workspaceId: string, request: CreateMemoryRequest): CreateMemoryResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return createMemoryWithOptions(workspaceId, request, headers, runtime); } model CreateMemoryNodeRequest { content?: string(name='content', description='This parameter is required.'), } model CreateMemoryNodeResponseBody = { memoryNodeId?: string(name='memoryNodeId', example='68de06c95368463a8be4a84efc872cc5'), requestId?: string(name='requestId', example='8C56C7AF-6573-19CE-B018-E05E1EDCF4C5'), } model CreateMemoryNodeResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreateMemoryNodeResponseBody(name='body'), } /** * @summary 创建记忆Node * * @param request CreateMemoryNodeRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreateMemoryNodeResponse */ async function createMemoryNodeWithOptions(workspaceId: string, memoryId: string, request: CreateMemoryNodeRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateMemoryNodeResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.content)) { query['content'] = request.content; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'CreateMemoryNode', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories/${OpenApiUtil.getEncodeParam(memoryId)}/memoryNodes`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 创建记忆Node * * @param request CreateMemoryNodeRequest * @return CreateMemoryNodeResponse */ async function createMemoryNode(workspaceId: string, memoryId: string, request: CreateMemoryNodeRequest): CreateMemoryNodeResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return createMemoryNodeWithOptions(workspaceId, memoryId, request, headers, runtime); } model CreatePromptTemplateRequest { content?: string(name='content', description='This parameter is required.'), name?: string(name='name', description='This parameter is required.'), } model CreatePromptTemplateResponseBody = { promptTemplateId?: string(name='promptTemplateId', example='6e49109bfeb94a39bb268f4e483ccxxx'), requestId?: string(name='requestId', example='FE9B6CBF-47E6-5D76-9C5D-B814DD5ABxxx'), } model CreatePromptTemplateResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreatePromptTemplateResponseBody(name='body'), } /** * @summary Creates a prompt template. * * @param request CreatePromptTemplateRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreatePromptTemplateResponse */ async function createPromptTemplateWithOptions(workspaceId: string, request: CreatePromptTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreatePromptTemplateResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.content)) { query['content'] = request.content; } if (!Util.isUnset(request.name)) { query['name'] = request.name; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'CreatePromptTemplate', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/promptTemplates`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Creates a prompt template. * * @param request CreatePromptTemplateRequest * @return CreatePromptTemplateResponse */ async function createPromptTemplate(workspaceId: string, request: CreatePromptTemplateRequest): CreatePromptTemplateResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return createPromptTemplateWithOptions(workspaceId, request, headers, runtime); } model DeleteAgentResponseBody = { code?: string(name='code'), data?: string(name='data'), httpStatusCode?: int32(name='httpStatusCode'), message?: string(name='message'), requestId?: string(name='requestId'), success?: boolean(name='success'), } model DeleteAgentResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteAgentResponseBody(name='body'), } /** * @summary 删除智能体 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteAgentResponse */ async function deleteAgentWithOptions(workspaceId: string, appCode: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteAgentResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'DeleteAgent', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/application/agents/${OpenApiUtil.getEncodeParam(appCode)}`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 删除智能体 * * @return DeleteAgentResponse */ async function deleteAgent(workspaceId: string, appCode: string): DeleteAgentResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return deleteAgentWithOptions(workspaceId, appCode, headers, runtime); } model DeleteCategoryResponseBody = { code?: string(name='Code', example='success'), data?: { categoryId?: string(name='CategoryId', example='cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX'), }(name='Data', description='data'), message?: string(name='Message', example='workspace id is null or invalid.'), requestId?: string(name='RequestId', description='Id of the request', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', example='200'), success?: boolean(name='Success', example='true'), } model DeleteCategoryResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteCategoryResponseBody(name='body'), } /** * @summary 删除类目 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteCategoryResponse */ async function deleteCategoryWithOptions(CategoryId: string, WorkspaceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteCategoryResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'DeleteCategory', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/category/${OpenApiUtil.getEncodeParam(CategoryId)}/`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 删除类目 * * @return DeleteCategoryResponse */ async function deleteCategory(CategoryId: string, WorkspaceId: string): DeleteCategoryResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return deleteCategoryWithOptions(CategoryId, WorkspaceId, headers, runtime); } model DeleteFileResponseBody = { code?: string(name='Code', example='InvalidParameter'), data?: { fileId?: string(name='FileId', example='file_9a65732555b54d5ea10796ca5742ba22_XXXXXXXX'), }(name='Data'), message?: string(name='Message', example='Current file status does not support delete.'), requestId?: string(name='RequestId', description='Id of the request', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', example='200'), success?: boolean(name='Success', example='true'), } model DeleteFileResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteFileResponseBody(name='body'), } /** * @summary 删除文档 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteFileResponse */ async function deleteFileWithOptions(FileId: string, WorkspaceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteFileResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'DeleteFile', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/file/${OpenApiUtil.getEncodeParam(FileId)}/`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 删除文档 * * @return DeleteFileResponse */ async function deleteFile(FileId: string, WorkspaceId: string): DeleteFileResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return deleteFileWithOptions(FileId, WorkspaceId, headers, runtime); } model DeleteIndexRequest { indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='f89ie0fj5a'), } model DeleteIndexResponseBody = { code?: string(name='Code', description='HTTP status code', example='Index.InvalidParameter'), message?: string(name='Message', description='The error message.', example='Required parameter(%s) missing or invalid, please check the request parameters.'), requestId?: string(name='RequestId', description='The request ID.', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', description='The status code.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model DeleteIndexResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteIndexResponseBody(name='body'), } /** * @summary Deletes a specified knowledge base permanently. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * If a knowledge base is being called by an application, disassociate the knowledge base before you can delete it. To disassociate the knowledge base, you must use the console. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). * * After you delete a knowledge base, it cannot be recovered. We recommend that you proceed with caution. * * Imported documents are not deleted from the [Data Management](https://bailian.console.aliyun.com/#/data-center) if you call this operation. * * This interface is idempotent. * * @param request DeleteIndexRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteIndexResponse */ async function deleteIndexWithOptions(WorkspaceId: string, request: DeleteIndexRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteIndexResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.indexId)) { query['IndexId'] = request.indexId; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'DeleteIndex', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/delete`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Deletes a specified knowledge base permanently. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * If a knowledge base is being called by an application, disassociate the knowledge base before you can delete it. To disassociate the knowledge base, you must use the console. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). * * After you delete a knowledge base, it cannot be recovered. We recommend that you proceed with caution. * * Imported documents are not deleted from the [Data Management](https://bailian.console.aliyun.com/#/data-center) if you call this operation. * * This interface is idempotent. * * @param request DeleteIndexRequest * @return DeleteIndexResponse */ async function deleteIndex(WorkspaceId: string, request: DeleteIndexRequest): DeleteIndexResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return deleteIndexWithOptions(WorkspaceId, request, headers, runtime); } model DeleteIndexDocumentRequest { documentIds?: [ string ](name='DocumentIds', description='The list of the primary key IDs of the documents. This parameter is required.'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='79c0aly8zw'), } model DeleteIndexDocumentShrinkRequest { documentIdsShrink?: string(name='DocumentIds', description='The list of the primary key IDs of the documents. This parameter is required.'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='79c0aly8zw'), } model DeleteIndexDocumentResponseBody = { code?: string(name='Code', description='HTTP status code', example='Index.InvalidParameter'), data?: { deletedDocument?: [ string ](name='DeletedDocument', description='The list of primary key IDs of documents that are deleted.'), }(name='Data', description='The parameters returned by the operation.'), message?: string(name='Message', description='The error message.', example='Required parameter(%s) missing or invalid, please check the request parameters.'), requestId?: string(name='RequestId', description='The request ID.', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', description='The status code.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model DeleteIndexDocumentResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteIndexDocumentResponseBody(name='body'), } /** * @summary Deletes one or more documents from a specified unstructured knowledge base permanently. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * Only documents with the INSERT_ERROR and FINISH states can be deleted. To query the status of documents in a specified knowledge base, call the [ListIndexDocuments](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-listindexdocuments) operation. * * After you delete a document, it cannot be recovered and the [Retrieve](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-retrieve) operation cannot query information about the document. We recommend that you proceed with caution. * * Imported documents are not deleted from the [Data Management](https://bailian.console.aliyun.com/#/data-center) if you call this operation. * * This interface is idempotent. * * @param tmpReq DeleteIndexDocumentRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteIndexDocumentResponse */ async function deleteIndexDocumentWithOptions(WorkspaceId: string, tmpReq: DeleteIndexDocumentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteIndexDocumentResponse { Util.validateModel(tmpReq); var request = new DeleteIndexDocumentShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.documentIds)) { request.documentIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.documentIds, 'DocumentIds', 'json'); } var query : map[string]any = {}; if (!Util.isUnset(request.documentIdsShrink)) { query['DocumentIds'] = request.documentIdsShrink; } if (!Util.isUnset(request.indexId)) { query['IndexId'] = request.indexId; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'DeleteIndexDocument', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/delete_index_document`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Deletes one or more documents from a specified unstructured knowledge base permanently. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * Only documents with the INSERT_ERROR and FINISH states can be deleted. To query the status of documents in a specified knowledge base, call the [ListIndexDocuments](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-listindexdocuments) operation. * * After you delete a document, it cannot be recovered and the [Retrieve](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-retrieve) operation cannot query information about the document. We recommend that you proceed with caution. * * Imported documents are not deleted from the [Data Management](https://bailian.console.aliyun.com/#/data-center) if you call this operation. * * This interface is idempotent. * * @param request DeleteIndexDocumentRequest * @return DeleteIndexDocumentResponse */ async function deleteIndexDocument(WorkspaceId: string, request: DeleteIndexDocumentRequest): DeleteIndexDocumentResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return deleteIndexDocumentWithOptions(WorkspaceId, request, headers, runtime); } model DeleteMemoryResponseBody = { requestId?: string(name='requestId', example='6a71f2d9-f1c9-913b-818b-114029103cad'), } model DeleteMemoryResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteMemoryResponseBody(name='body'), } /** * @summary 删除memory * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteMemoryResponse */ async function deleteMemoryWithOptions(workspaceId: string, memoryId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteMemoryResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'DeleteMemory', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories/${OpenApiUtil.getEncodeParam(memoryId)}`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 删除memory * * @return DeleteMemoryResponse */ async function deleteMemory(workspaceId: string, memoryId: string): DeleteMemoryResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return deleteMemoryWithOptions(workspaceId, memoryId, headers, runtime); } model DeleteMemoryNodeResponseBody = { requestId?: string(name='requestId', example='8C56C7AF-6573-19CE-B018-E05E1EDCF4C5'), } model DeleteMemoryNodeResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteMemoryNodeResponseBody(name='body'), } /** * @summary 删除记忆Node * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteMemoryNodeResponse */ async function deleteMemoryNodeWithOptions(workspaceId: string, memoryId: string, memoryNodeId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteMemoryNodeResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'DeleteMemoryNode', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories/${OpenApiUtil.getEncodeParam(memoryId)}/memoryNodes/${OpenApiUtil.getEncodeParam(memoryNodeId)}`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 删除记忆Node * * @return DeleteMemoryNodeResponse */ async function deleteMemoryNode(workspaceId: string, memoryId: string, memoryNodeId: string): DeleteMemoryNodeResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return deleteMemoryNodeWithOptions(workspaceId, memoryId, memoryNodeId, headers, runtime); } model DeletePromptTemplateResponseBody = { requestId?: string(name='requestId', description='The request ID.', example='FE9B6CBF-47E6-5D76-9C5D-B814DD5ABxxx'), } model DeletePromptTemplateResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeletePromptTemplateResponseBody(name='body'), } /** * @summary Deletes a prompt template based on the template ID. * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeletePromptTemplateResponse */ async function deletePromptTemplateWithOptions(workspaceId: string, promptTemplateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeletePromptTemplateResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'DeletePromptTemplate', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/promptTemplates/${OpenApiUtil.getEncodeParam(promptTemplateId)}`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Deletes a prompt template based on the template ID. * * @return DeletePromptTemplateResponse */ async function deletePromptTemplate(workspaceId: string, promptTemplateId: string): DeletePromptTemplateResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return deletePromptTemplateWithOptions(workspaceId, promptTemplateId, headers, runtime); } model DescribeFileResponseBody = { code?: string(name='Code', description='The status code.', example='Success'), data?: { categoryId?: string(name='CategoryId', description='The ID of the category to which the document belongs.', example='cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX'), createTime?: string(name='CreateTime', description='The timestamp when the document was uploaded to Model Studio. Format: yyyy-MM-dd HH:mm:ss. Time zone: UTC + 8.', example='2024-05-26 12:45:43'), fileId?: string(name='FileId', description='The primary key ID of the document.', example='file_9a65732555b54d5ea10796ca5742ba22_XXXXXXXX'), fileName?: string(name='FileName', description='The name of the document.', example='test.pdf'), fileType?: string(name='FileType', description='The file type of the document. The value is an extension. Valid values: pdf, docx, doc, txt, md, pptx, and ppt.', example='pdf'), parser?: string(name='Parser', description='The parser that is used to parse the document. Valid value: * DASHSCOPE_DOCMIND: The default document parser.', example='DASHSCOPE_DOCMIND'), sizeInBytes?: long(name='SizeInBytes', description='The size of the document. Unit: bytes.', example='1234'), status?: string(name='Status', description='The status of the document. Valid values: * INIT: pending parsing. * PARSING * PARSE_SUCCESS * PARSE_FAILED', example='PARSE_SUCCESS'), tags?: [ string ](name='Tags', description='The tags that are associated with the document. A document can be associated with multiple tags.'), }(name='Data', description='The returned data fields.'), message?: string(name='Message', description='The error message.', example='Requests throttling triggered.'), requestId?: string(name='RequestId', description='The request ID.', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', description='The HTTP status code.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model DescribeFileResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DescribeFileResponseBody(name='body'), } /** * @summary Queries the details of an unstructured document. * * @description Before you call this API, make sure that your document is uploaded to the [Data Management](https://bailian.console.aliyun.com/knowledge-base#/data-center) page of Alibaba Cloud Model Studio. * * You can also call this operation to query unstructured documents that you upload on the [Data Management](https://bailian.console.aliyun.com/knowledge-base#/data-center) page. * * This operation is idempotent. * **Throttling:** Make sure that the interval between the two queries is at least 15 seconds. Otherwise, you may trigger system throttling. If throttling is triggered, try again later. * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DescribeFileResponse */ async function describeFileWithOptions(WorkspaceId: string, FileId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeFileResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'DescribeFile', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/file/${OpenApiUtil.getEncodeParam(FileId)}/`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries the details of an unstructured document. * * @description Before you call this API, make sure that your document is uploaded to the [Data Management](https://bailian.console.aliyun.com/knowledge-base#/data-center) page of Alibaba Cloud Model Studio. * * You can also call this operation to query unstructured documents that you upload on the [Data Management](https://bailian.console.aliyun.com/knowledge-base#/data-center) page. * * This operation is idempotent. * **Throttling:** Make sure that the interval between the two queries is at least 15 seconds. Otherwise, you may trigger system throttling. If throttling is triggered, try again later. * * @return DescribeFileResponse */ async function describeFile(WorkspaceId: string, FileId: string): DescribeFileResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return describeFileWithOptions(WorkspaceId, FileId, headers, runtime); } model GetIndexJobStatusRequest { indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='79c0aly8zw'), jobId?: string(name='JobId', description='The knowledge base job ID, which is the `Data.Id` parameter returned by the [SubmitIndexJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexjob) or [SubmitIndexAddDocumentsJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexadddocumentsjob) operations. This parameter is required.', example='20230718xxxx-146c93bf'), pageNumber?: int32(name='PageNumber', description='Both the [SubmitIndexJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexjob) and [SubmitIndexAddDocumentsJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexadddocumentsjob) operations support batch import of documents. This operation returns both the overall `Status` of the job and the `Document.Status` of each document. If there are a large number of documents, you can use the `PageNumber` parameter to perform a paged query. Pages start from page 1. Default value: 1.', example='1'), pageSize?: int32(name='pageSize', description='The number of document import jobs that are displayed on each page. No maximum value. Default value: 10.', example='10'), } model GetIndexJobStatusResponseBody = { code?: string(name='Code', description='HTTP status code', example='Index.Forbidden'), data?: { documents?: [ { code?: string(name='Code', description='HTTP status code', example='Index.Document.ChunkError'), docId?: string(name='DocId', description='The primary key ID of the document.', example='file_9a65732555b54d5ea10796ca5742ba22_XXXXXXXX'), docName?: string(name='DocName', description='The name of the document.'), gmtModified?: long(name='GmtModified'), message?: string(name='Message', description='The error message.', example='document parse error'), status?: string(name='Status', description='The import status of the document. Valid values: * INSERT_ERROR * RUNNING * DELETED * FINISH', example='RUNNING'), } ](name='Documents', description='The list of imported documents.'), jobId?: string(name='JobId', description='The ID of the job.', example='66122af12a4e45ddae6bd6c845556647'), status?: string(name='Status', description='The status of the knowledge base job. Valid values: * COMPLETED * FAILED * RUNNING * PENDING', example='PENDING'), }(name='Data', description='The returned data.'), message?: string(name='Message', description='The error message.', example='User not authorized to operate on the specified resource.'), requestId?: string(name='RequestId', description='The request ID.', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', description='The HTTP status code returned.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model GetIndexJobStatusResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetIndexJobStatusResponseBody(name='body'), } /** * @summary Queries the current status of a specified knowledge base creation or add document job. * * @description 1. A knowledge base job is running. You can call the [SubmitIndexJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexjob) operation to create a creation job or the [SubmitIndexAddDocumentsJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexadddocumentsjob) operation to create a add document job. Then, obtain the `JobId` returned by the operations. * 2. We recommend that you call this operation at intervals of more than 5 seconds. * 3. This interface is idempotent. * * @param request GetIndexJobStatusRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetIndexJobStatusResponse */ async function getIndexJobStatusWithOptions(WorkspaceId: string, request: GetIndexJobStatusRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetIndexJobStatusResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.indexId)) { query['IndexId'] = request.indexId; } if (!Util.isUnset(request.jobId)) { query['JobId'] = request.jobId; } if (!Util.isUnset(request.pageNumber)) { query['PageNumber'] = request.pageNumber; } if (!Util.isUnset(request.pageSize)) { query['pageSize'] = request.pageSize; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'GetIndexJobStatus', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/job/status`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries the current status of a specified knowledge base creation or add document job. * * @description 1. A knowledge base job is running. You can call the [SubmitIndexJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexjob) operation to create a creation job or the [SubmitIndexAddDocumentsJob](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-submitindexadddocumentsjob) operation to create a add document job. Then, obtain the `JobId` returned by the operations. * 2. We recommend that you call this operation at intervals of more than 5 seconds. * 3. This interface is idempotent. * * @param request GetIndexJobStatusRequest * @return GetIndexJobStatusResponse */ async function getIndexJobStatus(WorkspaceId: string, request: GetIndexJobStatusRequest): GetIndexJobStatusResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return getIndexJobStatusWithOptions(WorkspaceId, request, headers, runtime); } model GetMemoryResponseBody = { description?: string(name='description'), memoryId?: string(name='memoryId', example='6bff4f317a14442fbc9f73d29dbd5fc3'), requestId?: string(name='requestId', example='6a71f2d9-f1c9-913b-818b-114029103cad'), workspaceId?: string(name='workspaceId', example='llm-us9hjmt32nysdm5v'), } model GetMemoryResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetMemoryResponseBody(name='body'), } /** * @summary 获取memory * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetMemoryResponse */ async function getMemoryWithOptions(workspaceId: string, memoryId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetMemoryResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'GetMemory', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories/${OpenApiUtil.getEncodeParam(memoryId)}`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取memory * * @return GetMemoryResponse */ async function getMemory(workspaceId: string, memoryId: string): GetMemoryResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return getMemoryWithOptions(workspaceId, memoryId, headers, runtime); } model GetMemoryNodeResponseBody = { content?: string(name='content'), memoryId?: string(name='memoryId', example='6bff4f317a14442fbc9f73d29dbd5fc3'), memoryNodeId?: string(name='memoryNodeId', example='68de06c95368463a8be4a84efc872cc5'), requestId?: string(name='requestId', example='8C56C7AF-6573-19CE-B018-E05E1EDCF4C5'), workspaceId?: string(name='workspaceId', example='llm-us9hjmt32nysdm5v'), } model GetMemoryNodeResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetMemoryNodeResponseBody(name='body'), } /** * @summary 获取记忆Node * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetMemoryNodeResponse */ async function getMemoryNodeWithOptions(workspaceId: string, memoryId: string, memoryNodeId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetMemoryNodeResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'GetMemoryNode', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories/${OpenApiUtil.getEncodeParam(memoryId)}/memoryNodes/${OpenApiUtil.getEncodeParam(memoryNodeId)}`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取记忆Node * * @return GetMemoryNodeResponse */ async function getMemoryNode(workspaceId: string, memoryId: string, memoryNodeId: string): GetMemoryNodeResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return getMemoryNodeWithOptions(workspaceId, memoryId, memoryNodeId, headers, runtime); } model GetPromptTemplateResponseBody = { content?: string(name='content', description='The template content.'), name?: string(name='name', description='The template name.'), promptTemplateId?: string(name='promptTemplateId', description='The template ID.', example='6e49109bfeb94a39bb268f4e483ccxxx'), requestId?: string(name='requestId', description='The request ID.', example='8C56C7AF-6573-19CE-B018-E05E1EDCF4C5'), variables?: [ string ](name='variables', description='The variables of the template.', example='["theme"]'), workspaceId?: string(name='workspaceId', description='The workspace ID.', example='llm-us9hjmt32nysdxxx'), } model GetPromptTemplateResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetPromptTemplateResponseBody(name='body'), } /** * @summary Obtains a prompt template based on the template ID. * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetPromptTemplateResponse */ async function getPromptTemplateWithOptions(workspaceId: string, promptTemplateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPromptTemplateResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'GetPromptTemplate', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/promptTemplates/${OpenApiUtil.getEncodeParam(promptTemplateId)}`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Obtains a prompt template based on the template ID. * * @return GetPromptTemplateResponse */ async function getPromptTemplate(workspaceId: string, promptTemplateId: string): GetPromptTemplateResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return getPromptTemplateWithOptions(workspaceId, promptTemplateId, headers, runtime); } model GetPublishedAgentResponseBody = { code?: string(name='code'), data?: { applicationConfig?: { historyConfig?: { enableAdbRecord?: boolean(name='enableAdbRecord'), enableRecord?: boolean(name='enableRecord'), instanceId?: string(name='instanceId'), region?: string(name='region'), storeCode?: string(name='storeCode'), }(name='historyConfig'), longTermMemory?: { enable?: boolean(name='enable'), }(name='longTermMemory'), parameters?: { dialogRound?: int32(name='dialogRound'), maxTokens?: int32(name='maxTokens'), temperature?: double(name='temperature'), }(name='parameters'), ragConfig?: { enableCitation?: boolean(name='enableCitation'), enableSearch?: boolean(name='enableSearch'), knowledgeBaseCodeList?: [ string ](name='knowledgeBaseCodeList'), topK?: int32(name='topK'), }(name='ragConfig'), security?: { processingStrategy?: string(name='processingStrategy'), }(name='security'), tools?: [ { type?: string(name='type'), } ](name='tools'), workFlows?: [ { type?: string(name='type'), } ](name='workFlows'), }(name='applicationConfig'), code?: string(name='code'), instructions?: string(name='instructions'), modelId?: string(name='modelId'), name?: string(name='name'), }(name='data'), httpStatusCode?: int32(name='httpStatusCode'), message?: string(name='message'), requestId?: string(name='requestId'), success?: boolean(name='success'), } model GetPublishedAgentResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetPublishedAgentResponseBody(name='body'), } /** * @summary 获取发布态智能体应用 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetPublishedAgentResponse */ async function getPublishedAgentWithOptions(workspaceId: string, appCode: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetPublishedAgentResponse { var req = new OpenApi.OpenApiRequest{ headers = headers, }; var params = new OpenApi.Params{ action = 'GetPublishedAgent', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/application/agents/${OpenApiUtil.getEncodeParam(appCode)}`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取发布态智能体应用 * * @return GetPublishedAgentResponse */ async function getPublishedAgent(workspaceId: string, appCode: string): GetPublishedAgentResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return getPublishedAgentWithOptions(workspaceId, appCode, headers, runtime); } model ListCategoryRequest { categoryType?: string(name='CategoryType', description='This parameter is required.', example='UNSTRUCTURED'), maxResults?: int32(name='MaxResults', example='20'), nextToken?: string(name='NextToken', example='AAAAAdH70eOCSCKtacdomNzak4U='), parentCategoryId?: string(name='ParentCategoryId', example='cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX'), } model ListCategoryResponseBody = { code?: string(name='Code', example='success'), data?: { categoryList?: [ { categoryId?: string(name='CategoryId', example='cate_cdd11b1b79a74e8bbd675c356a91ee3XXXXXXXX'), categoryName?: string(name='CategoryName'), categoryType?: string(name='CategoryType', example='UNSTRUCTURED'), isDefault?: boolean(name='IsDefault', example='true'), parentCategoryId?: string(name='ParentCategoryId', example='cate_addd11b1b79a74e8bbd675c356a91ee3XXXXXXXX'), } ](name='CategoryList'), hasNext?: boolean(name='HasNext', example='true'), maxResults?: int32(name='MaxResults', example='20'), nextToken?: string(name='NextToken', example='AAAAALHWGpGoYCcYMxiFfmlhvh7Z4G8jiXR6IjHYd+M9WQVJ'), totalCount?: int32(name='TotalCount', example='20'), }(name='Data'), message?: string(name='Message', example='workspace id is null or invalid.'), requestId?: string(name='RequestId', description='Id of the request', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', example='200'), success?: boolean(name='Success', example='true'), } model ListCategoryResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListCategoryResponseBody(name='body'), } /** * @summary ListCategory * * @param request ListCategoryRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListCategoryResponse */ async function listCategoryWithOptions(WorkspaceId: string, request: ListCategoryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListCategoryResponse { Util.validateModel(request); var body : map[string]any = {}; if (!Util.isUnset(request.categoryType)) { body['CategoryType'] = request.categoryType; } if (!Util.isUnset(request.maxResults)) { body['MaxResults'] = request.maxResults; } if (!Util.isUnset(request.nextToken)) { body['NextToken'] = request.nextToken; } if (!Util.isUnset(request.parentCategoryId)) { body['ParentCategoryId'] = request.parentCategoryId; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'ListCategory', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/categories`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary ListCategory * * @param request ListCategoryRequest * @return ListCategoryResponse */ async function listCategory(WorkspaceId: string, request: ListCategoryRequest): ListCategoryResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listCategoryWithOptions(WorkspaceId, request, headers, runtime); } model ListChunksRequest { fields?: [ string ](name='Fields', description='An array of field names. This parameter is used to filter non-private fields (prefixed with_underscores) in the Metadata parameter returned by this operation. By default, this parameter is left empty, which means all non-private fields in the Metadata parameter are returned. If you only want specified non-private fields, such as title, set this parameter to title.'), fileId?: string(name='FileId'), filed?: string(name='Filed', description='The primary key ID of the document. This parameter is not required for structured knowledge base, but is required for unstructured knowledge base. To view the ID, you can click the ID icon next to the file name on the [Data Management](https://bailian.console.aliyun.com/#/data-center) page. You can filter returned chunks by the document ID. This parameter is left empty by default.', example='file_5f03dfea56da4050ab68d61871fc4cb3_10151493'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='otoru9en4v'), pageNum?: int32(name='PageNum', description='The number of the pages to return. Pages start from page 1. Default value: 1.', example='1'), pageSize?: int32(name='PageSize', description='The number of chunks to display on each page. Maximum value: 100. Default value: 10.', example='10'), } model ListChunksResponseBody = { code?: string(name='Code', description='The error code.', example='Index.InvalidParameter'), data?: { nodes?: [ { metadata?: any(name='Metadata', description='The metadata map of the chunk.'), score?: double(name='Score', description='The similarity score of the chunk.', example='0.3'), text?: string(name='Text', description='The text of the chunk.'), } ](name='Nodes', description='The list of chunks.'), total?: long(name='Total', description='The total number of chunks returned.', example='16'), }(name='Data', description='The data returned.'), message?: string(name='Message', description='The error message.', example='Required parameter(%s) missing or invalid, please check the request parameters.'), requestId?: string(name='RequestId', description='The request ID.', example='8F97A63B-55F1-527F-9D6E-467B6A7E8CF1'), status?: string(name='Status', description='The HTTP status code returned.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model ListChunksResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListChunksResponseBody(name='body'), } /** * @summary For unstructured knowledge base, obtains the details of all chunks of a specified document; for structured knowledge base, obtains the details of all chunks. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * This interface is idempotent. * * @param request ListChunksRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListChunksResponse */ async function listChunksWithOptions(WorkspaceId: string, request: ListChunksRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListChunksResponse { Util.validateModel(request); var body : map[string]any = {}; if (!Util.isUnset(request.fields)) { body['Fields'] = request.fields; } if (!Util.isUnset(request.fileId)) { body['FileId'] = request.fileId; } if (!Util.isUnset(request.filed)) { body['Filed'] = request.filed; } if (!Util.isUnset(request.indexId)) { body['IndexId'] = request.indexId; } if (!Util.isUnset(request.pageNum)) { body['PageNum'] = request.pageNum; } if (!Util.isUnset(request.pageSize)) { body['PageSize'] = request.pageSize; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'ListChunks', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/list_chunks`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary For unstructured knowledge base, obtains the details of all chunks of a specified document; for structured knowledge base, obtains the details of all chunks. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * This interface is idempotent. * * @param request ListChunksRequest * @return ListChunksResponse */ async function listChunks(WorkspaceId: string, request: ListChunksRequest): ListChunksResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listChunksWithOptions(WorkspaceId, request, headers, runtime); } model ListFileRequest { categoryId?: string(name='CategoryId', description='This parameter is required.', example='cate_cdd11b1b79a74e8bbd675c356a91ee3510024405'), fileName?: string(name='FileName'), maxResults?: int32(name='MaxResults', example='20'), nextToken?: string(name='NextToken', example='AAAAAdH70eOCSCKtacdomNzak4U='), } model ListFileResponseBody = { code?: string(name='Code', example='success'), data?: { fileList?: [ { categoryId?: string(name='CategoryId', example='cate_cdd11b1b79a74e8bbd675c356a91ee3510024405'), createTime?: string(name='CreateTime', example='2023-08-18 11:03:35'), fileId?: string(name='FileId', example='file_5ff599b3455a45db8c41b0054b361518_10098576'), fileName?: string(name='FileName', example='auto-test-1721096109278.pdf'), fileType?: string(name='FileType', example='docx'), parser?: string(name='Parser', example='DASHSCOPE_DOCMIND'), sizeInBytes?: long(name='SizeInBytes', example='512'), status?: string(name='Status', example='200'), tags?: [ string ](name='Tags'), } ](name='FileList'), hasNext?: boolean(name='HasNext', example='true'), maxResults?: int32(name='MaxResults', example='20'), nextToken?: string(name='NextToken', example='4jzbJk9J6lNeuXD9hP0viA=='), totalCount?: int32(name='TotalCount', example='48'), }(name='Data'), message?: string(name='Message', example='Requests throttling triggered.'), requestId?: string(name='RequestId', description='Id of the request', example='8F97A63B-55F1-527F-9D6E-467B6A7E8CF1'), status?: string(name='Status', example='200'), success?: boolean(name='Success', example='true'), } model ListFileResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListFileResponseBody(name='body'), } /** * @summary 获取文档列表 * * @param request ListFileRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListFileResponse */ async function listFileWithOptions(WorkspaceId: string, request: ListFileRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListFileResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.categoryId)) { query['CategoryId'] = request.categoryId; } if (!Util.isUnset(request.fileName)) { query['FileName'] = request.fileName; } if (!Util.isUnset(request.maxResults)) { query['MaxResults'] = request.maxResults; } if (!Util.isUnset(request.nextToken)) { query['NextToken'] = request.nextToken; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'ListFile', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/files`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取文档列表 * * @param request ListFileRequest * @return ListFileResponse */ async function listFile(WorkspaceId: string, request: ListFileRequest): ListFileResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listFileWithOptions(WorkspaceId, request, headers, runtime); } model ListIndexDocumentsRequest { documentName?: string(name='DocumentName', description='The names of the queried documents. The default value is null, which means the names are not used to filter the results.'), documentStatus?: string(name='DocumentStatus', description='The import status of the documents to be queried. Valid values: * INSERT_ERROR * RUNNING * DELETED * FINISH The default value is null, which means the import status is not used to filter the results.', example='FINISH'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='79c0aly8zw'), pageNumber?: int32(name='PageNumber', description='The page numbers of the pages to return. Pages start from page 1. Default value: 1.', example='1'), pageSize?: int32(name='PageSize', description='The number of documents displayed on each page. No maximum value. Default value: 10.', example='10'), } model ListIndexDocumentsResponseBody = { code?: string(name='Code', description='HTTP status code', example='InvalidParameter'), data?: { documents?: [ { code?: string(name='Code', description='The error status code of document import.', example='110002'), documentType?: string(name='DocumentType', description='The format of the document. Valid values: pdf, docx, doc, txt, md, pptx, ppt, and EXCEL.', example='pdf'), gmtModified?: long(name='GmtModified'), id?: string(name='Id', description='The primary key ID of the document.', example='doc_c134aa2073204a5d936d870bf960f56a10024701'), message?: string(name='Message', description='The error message of document import.', example='check fileUrlKey[file_path] / fileNameKey[null] / fileExtensionKey[file_extension] is invalid'), name?: string(name='Name', description='The name of the document.'), size?: int32(name='Size', description='The size of the document. Unit: bytes.', example='996764'), sourceId?: string(name='SourceId', description='For unstructured knowledge base, this parameter is the category ID. To view the category ID, you can click the ID icon next to the category name on the Unstructured Data tab of the [Data Management](https://bailian.console.aliyun.com/#/data-center) page. For structured knowledge base, this parameter is the data table ID. To view the table ID, you can click the ID icon next to the table name on the Structured Data tab of the [Data Management](https://bailian.console.aliyun.com/#/data-center) page.', example='cate_21a407a3372c4ba7aedc649709143f0c10021401'), status?: string(name='Status', description='The import status of the document. Valid values: * INSERT_ERROR * RUNNING * DELETED * FINISH', example='RUNNING'), } ](name='Documents', description='The list of documents in the knowledge base.'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base.', example='pno97tn8iu'), pageNumber?: int32(name='PageNumber', description='The specified page number.', example='1'), pageSize?: int32(name='PageSize', description='The specified number of documents on each page.', example='10'), totalCount?: long(name='TotalCount', description='The total number of documents returned.', example='2437'), }(name='Data', description='The returned data.'), message?: string(name='Message', description='The error message.', example='Required parameter(%s) missing or invalid, please check the request parameters.'), requestId?: string(name='RequestId', description='The request ID.', example='35A267BF-xxxx-54DB-8394-AA3B0742D833'), status?: string(name='Status', description='The status code.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model ListIndexDocumentsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListIndexDocumentsResponseBody(name='body'), } /** * @summary Queries the details of one or more documents in a specified knowledge base. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * This interface is idempotent. * * @param request ListIndexDocumentsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListIndexDocumentsResponse */ async function listIndexDocumentsWithOptions(WorkspaceId: string, request: ListIndexDocumentsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListIndexDocumentsResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.documentName)) { query['DocumentName'] = request.documentName; } if (!Util.isUnset(request.documentStatus)) { query['DocumentStatus'] = request.documentStatus; } if (!Util.isUnset(request.indexId)) { query['IndexId'] = request.indexId; } if (!Util.isUnset(request.pageNumber)) { query['PageNumber'] = request.pageNumber; } if (!Util.isUnset(request.pageSize)) { query['PageSize'] = request.pageSize; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'ListIndexDocuments', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/list_index_documents`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries the details of one or more documents in a specified knowledge base. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * This interface is idempotent. * * @param request ListIndexDocumentsRequest * @return ListIndexDocumentsResponse */ async function listIndexDocuments(WorkspaceId: string, request: ListIndexDocumentsRequest): ListIndexDocumentsResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listIndexDocumentsWithOptions(WorkspaceId, request, headers, runtime); } model ListIndicesRequest { indexName?: string(name='IndexName', description='The name of the knowledge base. You can query knowledge base by name. The name must be 1 to 20 characters in length and can contain characters classified as letter in Unicode, including English letters, Chinese characters, digits, among others. The name can also contain colons (:), underscores (_), periods (.), and hyphens (-). This parameter is left empty by default, which means that all knowledge bases in the specified workspace are queried.', example='idx_status_score'), pageNumber?: string(name='PageNumber', description='The number of the pages to return. Pages start from page 1. Default value: 1.', example='1'), pageSize?: string(name='PageSize', description='The number of knowledge bases to display on each page. No maximum value. Default value: 10.', example='10'), } model ListIndicesResponseBody = { code?: string(name='Code', description='HTTP status code', example='Index.InvalidParameter'), data?: { indices?: [ { chunkSize?: int32(name='ChunkSize', description='The estimated length of chunks. Valid values: [1-2048].', example='5'), description?: string(name='Description', description='The description of the knowledge base.', example='If each RAM user belongs to a RAM group, the configuration is considered compliant.'), documentIds?: [ string ](name='DocumentIds', description='The list of the primary key IDs of the documents.'), embeddingModelName?: string(name='EmbeddingModelName', description='The name of the embedding model. Valid values: * text-embedding-v2', example='conv-rewrite-qwen-1.8b'), id?: string(name='Id', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation.', example='259899'), name?: string(name='Name', description='The name of the knowledge base.', example='temp_mUB4j'), overlapSize?: int32(name='OverlapSize', description='The overlap length. Valid values: [0-1024].', example='10'), rerankMinScore?: string(name='RerankMinScore', description='Similarity Threshold Valid values: [0.01-1.00].', example='0.01'), rerankModelName?: string(name='RerankModelName', description='The name of the rank model. Valid values: * gte-rerank-hybrid * gte-rerank', example='gte-rerank-hybrid'), separator?: string(name='Separator', description='The clause identifier. Separate multiple clause identifiers with |. Valid values: * \\\\n: line break * ,: Chinese comma * ,: English comma * 。 : Chinese full stop * .: English full stop * ! : Chinese exclamation point * ! : English exclamation point * ;: Chinese semicolon * ;: English semicolon * ? : Chinese question mark * ?: English question mark', example='\\\\n'), sinkInstanceId?: string(name='SinkInstanceId', description='The ID of the vector storage instance.', example='gp-bp1gq62t1788yw2ol'), sinkRegion?: string(name='SinkRegion', description='The region of the vector storage instance.', example='cn-hangzhou'), sinkType?: string(name='SinkType', description='The vector storage type of the knowledge base. Valid values: * ES: Built-in vector database. * BUILT_IN: Built-in vector database. * ADB: AnalyticDB for PostgreSQL database.', example='es'), sourceType?: string(name='SourceType', description='The data type of [Data Management](https://bailian.console.aliyun.com/#/data-center). For unstructured knowledge base, possible values: * DATA_CENTER_CATEGORY: The category type. * DATA_CENTER_FILE: The document type. For structured knowledge base, possible values: * DATA_CENTER_STRUCTURED_TABLE: The data table type.', example='DATA_CENTER_FILE'), structureType?: string(name='StructureType', description='The vector storage type of the knowledge base. Valid values: * UNSTRUCTURED', example='structured'), } ](name='Indices', description='The list of knowledge bases.'), pageNumber?: int32(name='PageNumber', description='The specified page number.', example='1'), pageSize?: int32(name='PageSize', description='The specified number of documents on each page.', example='10'), totalCount?: int32(name='TotalCount', description='The total number of knowledge bases returned.', example='48'), }(name='Data', description='The returned data.'), message?: string(name='Message', description='The error message.', example='Required parameter(%s) missing or invalid, please check the request parameters.'), requestId?: string(name='RequestId', description='The request ID.', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', description='The HTTP status code returned.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model ListIndicesResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListIndicesResponseBody(name='body'), } /** * @summary Lists knowledge bases in a specified workspace. * * @description This interface is idempotent. * * @param request ListIndicesRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListIndicesResponse */ async function listIndicesWithOptions(WorkspaceId: string, request: ListIndicesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListIndicesResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.indexName)) { query['IndexName'] = request.indexName; } if (!Util.isUnset(request.pageNumber)) { query['PageNumber'] = request.pageNumber; } if (!Util.isUnset(request.pageSize)) { query['PageSize'] = request.pageSize; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'ListIndices', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/list_indices`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Lists knowledge bases in a specified workspace. * * @description This interface is idempotent. * * @param request ListIndicesRequest * @return ListIndicesResponse */ async function listIndices(WorkspaceId: string, request: ListIndicesRequest): ListIndicesResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listIndicesWithOptions(WorkspaceId, request, headers, runtime); } model ListMemoriesRequest { maxResults?: int32(name='maxResults', example='10'), nextToken?: string(name='nextToken', example='dc270401186b433f975d7e1faaa34e0e'), } model ListMemoriesResponseBody = { maxResults?: int32(name='maxResults', example='10'), memories?: [ { description?: string(name='description'), memoryId?: string(name='memoryId', example='3fc531f4519444beaafffa4538f60667'), } ](name='memories'), nextToken?: string(name='nextToken', example='dc270401186b433f975d7e1faaa34e0e'), requestId?: string(name='requestId', example='6a71f2d9-f1c9-913b-818b-114029103cad'), totalCount?: int32(name='totalCount', example='105'), workspaceId?: string(name='workspaceId', example='llm-us9hjmt32nysdm5v'), } model ListMemoriesResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListMemoriesResponseBody(name='body'), } /** * @summary 获取memory * * @param request ListMemoriesRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListMemoriesResponse */ async function listMemoriesWithOptions(workspaceId: string, request: ListMemoriesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListMemoriesResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.maxResults)) { query['maxResults'] = request.maxResults; } if (!Util.isUnset(request.nextToken)) { query['nextToken'] = request.nextToken; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'ListMemories', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取memory * * @param request ListMemoriesRequest * @return ListMemoriesResponse */ async function listMemories(workspaceId: string, request: ListMemoriesRequest): ListMemoriesResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listMemoriesWithOptions(workspaceId, request, headers, runtime); } model ListMemoryNodesRequest { maxResults?: int32(name='maxResults', example='20'), nextToken?: string(name='nextToken', example='dc270401186b433f975d7e1faaa34e0e'), } model ListMemoryNodesResponseBody = { maxResults?: int32(name='maxResults', example='20'), memoryNodes?: [ { content?: string(name='content'), memoryNodeId?: string(name='memoryNodeId', example='68de06c95368463a8be4a84efc872cc5'), } ](name='memoryNodes'), nextToken?: string(name='nextToken', example='dc270401186b433f975d7e1faaa34e0e'), requestId?: string(name='requestId', example='6a71f2d9-f1c9-913b-818b-114029103cad'), totalCount?: int32(name='totalCount', example='100'), } model ListMemoryNodesResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListMemoryNodesResponseBody(name='body'), } /** * @summary 获取记忆Node列表 * * @param request ListMemoryNodesRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListMemoryNodesResponse */ async function listMemoryNodesWithOptions(workspaceId: string, memoryId: string, request: ListMemoryNodesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListMemoryNodesResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.maxResults)) { query['maxResults'] = request.maxResults; } if (!Util.isUnset(request.nextToken)) { query['nextToken'] = request.nextToken; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'ListMemoryNodes', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories/${OpenApiUtil.getEncodeParam(memoryId)}/memoryNodes`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取记忆Node列表 * * @param request ListMemoryNodesRequest * @return ListMemoryNodesResponse */ async function listMemoryNodes(workspaceId: string, memoryId: string, request: ListMemoryNodesRequest): ListMemoryNodesResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listMemoryNodesWithOptions(workspaceId, memoryId, request, headers, runtime); } model ListPromptTemplatesRequest { maxResults?: int32(name='maxResults', description='The maximum number of returned entries.', example='10'), name?: string(name='name', description='The keyword that is used to search for templates.'), nextToken?: string(name='nextToken', description='The token that determines the start position of the query. Set this parameter to the value of the NextToken parameter that is returned from the last call.', example='dc270401186b433f975d7e1faaa34e0e'), type?: string(name='type', description='The type of the template. Valid values: · System · Custom', example='System'), } model ListPromptTemplatesResponseBody = { maxResults?: int32(name='maxResults', description='The maximum number of returned entries.', example='10'), nextToken?: string(name='nextToken', description='The token that determines the start position of the next query.', example='dc270401186b433f975d7e1faaa34e0e'), promptTemplates?: [ { content?: string(name='content', description='The template content'), name?: string(name='name', description='The template name.'), promptTemplateId?: string(name='promptTemplateId', description='The template ID.', example='d6935b7efbe34d11b13df9307151cf8c'), type?: string(name='type', description='The template type.', example='"System"'), variables?: [ string ](name='variables', description='The variables of the template.'), } ](name='promptTemplates', description='The templates.'), requestId?: string(name='requestId', description='The request ID.', example='FE9B6CBF-47E6-5D76-9C5D-B814DD5AB071'), totalCount?: int32(name='totalCount', description='The total number of entries returned.', example='15'), workspaceId?: string(name='workspaceId', description='The workspace ID.', example='llm-us9hjmt32nysdxxx'), } model ListPromptTemplatesResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListPromptTemplatesResponseBody(name='body'), } /** * @summary Obtains a list of prompt templates. * * @param request ListPromptTemplatesRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListPromptTemplatesResponse */ async function listPromptTemplatesWithOptions(workspaceId: string, request: ListPromptTemplatesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPromptTemplatesResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.maxResults)) { query['maxResults'] = request.maxResults; } if (!Util.isUnset(request.name)) { query['name'] = request.name; } if (!Util.isUnset(request.nextToken)) { query['nextToken'] = request.nextToken; } if (!Util.isUnset(request.type)) { query['type'] = request.type; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'ListPromptTemplates', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/promptTemplates`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Obtains a list of prompt templates. * * @param request ListPromptTemplatesRequest * @return ListPromptTemplatesResponse */ async function listPromptTemplates(workspaceId: string, request: ListPromptTemplatesRequest): ListPromptTemplatesResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listPromptTemplatesWithOptions(workspaceId, request, headers, runtime); } model ListPublishedAgentRequest { pageNo?: int32(name='pageNo'), pageSize?: int32(name='pageSize'), } model ListPublishedAgentResponseBody = { code?: string(name='code'), data?: { list?: [ { applicationConfig?: { historyConfig?: { enableAdbRecord?: boolean(name='enableAdbRecord'), enableRecord?: boolean(name='enableRecord'), instanceId?: string(name='instanceId'), region?: string(name='region'), storeCode?: string(name='storeCode'), }(name='historyConfig'), longTermMemory?: { enable?: boolean(name='enable'), }(name='longTermMemory'), parameters?: { dialogRound?: int32(name='dialogRound'), maxTokens?: int32(name='maxTokens'), temperature?: double(name='temperature'), }(name='parameters'), ragConfig?: { enableCitation?: boolean(name='enableCitation'), enableSearch?: boolean(name='enableSearch'), knowledgeBaseCodeList?: [ string ](name='knowledgeBaseCodeList'), topK?: int32(name='topK'), }(name='ragConfig'), security?: { processingStrategy?: string(name='processingStrategy'), }(name='security'), tools?: [ { type?: string(name='type'), } ](name='tools'), workFlows?: [ { type?: string(name='type'), } ](name='workFlows'), }(name='applicationConfig'), code?: string(name='code'), instructions?: string(name='instructions'), modelId?: string(name='modelId'), name?: string(name='name'), } ](name='list'), pageNo?: int32(name='pageNo'), pageSize?: int32(name='pageSize'), total?: int32(name='total'), }(name='data'), httpStatusCode?: int32(name='httpStatusCode'), message?: string(name='message'), requestId?: string(name='requestId'), success?: string(name='success'), } model ListPublishedAgentResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListPublishedAgentResponseBody(name='body'), } /** * @summary 查询已发布的智能体应用列表 * * @param request ListPublishedAgentRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListPublishedAgentResponse */ async function listPublishedAgentWithOptions(workspaceId: string, request: ListPublishedAgentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListPublishedAgentResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.pageNo)) { query['pageNo'] = request.pageNo; } if (!Util.isUnset(request.pageSize)) { query['pageSize'] = request.pageSize; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'ListPublishedAgent', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/application/agents`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 查询已发布的智能体应用列表 * * @param request ListPublishedAgentRequest * @return ListPublishedAgentResponse */ async function listPublishedAgent(workspaceId: string, request: ListPublishedAgentRequest): ListPublishedAgentResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return listPublishedAgentWithOptions(workspaceId, request, headers, runtime); } model RetrieveRequest { denseSimilarityTopK?: int32(name='DenseSimilarityTopK', description='Vector retrieval top K. After generating vectors based on input text, the top K chunks in the knowledge base that are most similar to the vector representation of the input text are retrieved. Valid values: 0 to 100. The sum of the `DenseSimilarityTopK` and `SparseSimilarityTopK` parameters must be less than or equal to 200. Default value: 100.', example='100'), enableReranking?: boolean(name='EnableReranking', description='Specifies whether to enable reranking. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * true * false Default value: true.', example='true'), enableRewrite?: boolean(name='EnableRewrite', description='Specifies whether to enable multi-round conversation rewriting. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * true * false Default value: false.', example='false'), images?: [ string ](name='Images'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='5pwe0m2g6t'), query?: string(name='Query', description='The input query prompt. The length and characters of the query are not limited.'), queryHistory?: [ { content?: string(name='content'), role?: string(name='role'), } ](name='QueryHistory'), rerank?: [ { modelName?: string(name='ModelName', description='The name of the rank model. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * gte-rerank-hybrid: Recommended official model. * gte-rerank', example='gte-rerank-hybrid'), } ](name='Rerank', description='Ranking configurations.'), rerankMinScore?: float(name='RerankMinScore', description='Similarity Threshold The lowest similarity score of chunks that can be returned. This parameter is used to filter text chunks returned by the rank model. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: [0.01-1.00]. The priority of this parameter is greater than the similarity threshold configured for the knowledge base. By default, this parameter is left empty. In this case, the similarity threshold of the knowledge base is used.', example='0.20'), rerankTopN?: int32(name='RerankTopN', description='The top N return data after reranking. Valid values: 1 to 20. Default value: 5.', example='5'), rewrite?: [ { modelName?: string(name='ModelName', description='Conversation rewriting model name. The query rewriting model automatically adjusts the original prompt based on the context to improve retrieval performance. Valid value: * conv-rewrite-qwen-1.8b By default, this parameter is left empty, which means conv-rewrite-qwen-1.8b is used.', example='conv-rewrite-qwen-1.8b'), } ](name='Rewrite', description='Conversation rewriting configurations.'), saveRetrieverHistory?: boolean(name='SaveRetrieverHistory', description='Specifies whether to save the retrieve test history. Valid values: * true * false Default value: false.', example='false'), searchFilters?: [ map[string]string ](name='SearchFilters', description='Specifies complex filter conditions. For more information about the syntax of SearchFilters, see the SearchFilter syntax section of this topic.'), sparseSimilarityTopK?: int32(name='SparseSimilarityTopK', description='The top K of keyword retrieval. Chunks that exactly match the keywords of the input text are retrieved from the knowledge base. This filters out irrelevant chunks and boosts accuracy. Valid values: 0 to 100. The sum of the `DenseSimilarityTopK` and `SparseSimilarityTopK` parameters must be less than or equal to 200. Default value: 100.', example='100'), } model RetrieveShrinkRequest { denseSimilarityTopK?: int32(name='DenseSimilarityTopK', description='Vector retrieval top K. After generating vectors based on input text, the top K chunks in the knowledge base that are most similar to the vector representation of the input text are retrieved. Valid values: 0 to 100. The sum of the `DenseSimilarityTopK` and `SparseSimilarityTopK` parameters must be less than or equal to 200. Default value: 100.', example='100'), enableReranking?: boolean(name='EnableReranking', description='Specifies whether to enable reranking. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * true * false Default value: true.', example='true'), enableRewrite?: boolean(name='EnableRewrite', description='Specifies whether to enable multi-round conversation rewriting. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * true * false Default value: false.', example='false'), imagesShrink?: string(name='Images'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='5pwe0m2g6t'), query?: string(name='Query', description='The input query prompt. The length and characters of the query are not limited.'), queryHistoryShrink?: string(name='QueryHistory'), rerankShrink?: string(name='Rerank', description='Ranking configurations.'), rerankMinScore?: float(name='RerankMinScore', description='Similarity Threshold The lowest similarity score of chunks that can be returned. This parameter is used to filter text chunks returned by the rank model. For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: [0.01-1.00]. The priority of this parameter is greater than the similarity threshold configured for the knowledge base. By default, this parameter is left empty. In this case, the similarity threshold of the knowledge base is used.', example='0.20'), rerankTopN?: int32(name='RerankTopN', description='The top N return data after reranking. Valid values: 1 to 20. Default value: 5.', example='5'), rewriteShrink?: string(name='Rewrite', description='Conversation rewriting configurations.'), saveRetrieverHistory?: boolean(name='SaveRetrieverHistory', description='Specifies whether to save the retrieve test history. Valid values: * true * false Default value: false.', example='false'), searchFiltersShrink?: string(name='SearchFilters', description='Specifies complex filter conditions. For more information about the syntax of SearchFilters, see the SearchFilter syntax section of this topic.'), sparseSimilarityTopK?: int32(name='SparseSimilarityTopK', description='The top K of keyword retrieval. Chunks that exactly match the keywords of the input text are retrieved from the knowledge base. This filters out irrelevant chunks and boosts accuracy. Valid values: 0 to 100. The sum of the `DenseSimilarityTopK` and `SparseSimilarityTopK` parameters must be less than or equal to 200. Default value: 100.', example='100'), } model RetrieveResponseBody = { code?: string(name='Code', description='HTTP status code', example='Index.InvalidParameter'), data?: { nodes?: [ { metadata?: any(name='Metadata', description='The metadata map of the chunk.'), score?: double(name='Score', description='The similarity score of the chunk. Valid values:[0-1].', example='0.3'), text?: string(name='Text', description='The text of the chunk.'), } ](name='Nodes', description='The list of queried chunks.'), }(name='Data', description='The returned data.'), message?: string(name='Message', description='The error message.', example='Required parameter(%s) missing or invalid, please check the request parameters.'), requestId?: string(name='RequestId', description='The request ID.', example='17204B98-7734-4F9A-8464-2446A84821CA'), status?: string(name='Status', description='The HTTP status code returned.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model RetrieveResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: RetrieveResponseBody(name='body'), } /** * @summary Queries information from a specified knowledge base. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * The response time may be long because this operation involves complex retrieval and matching. We recommend that you set appropriate timeout and retry policy for requests. * * This interface is idempotent. * * @param tmpReq RetrieveRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return RetrieveResponse */ async function retrieveWithOptions(WorkspaceId: string, tmpReq: RetrieveRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RetrieveResponse { Util.validateModel(tmpReq); var request = new RetrieveShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.images)) { request.imagesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.images, 'Images', 'simple'); } if (!Util.isUnset(tmpReq.queryHistory)) { request.queryHistoryShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.queryHistory, 'QueryHistory', 'json'); } if (!Util.isUnset(tmpReq.rerank)) { request.rerankShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.rerank, 'Rerank', 'json'); } if (!Util.isUnset(tmpReq.rewrite)) { request.rewriteShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.rewrite, 'Rewrite', 'json'); } if (!Util.isUnset(tmpReq.searchFilters)) { request.searchFiltersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.searchFilters, 'SearchFilters', 'json'); } var query : map[string]any = {}; if (!Util.isUnset(request.denseSimilarityTopK)) { query['DenseSimilarityTopK'] = request.denseSimilarityTopK; } if (!Util.isUnset(request.enableReranking)) { query['EnableReranking'] = request.enableReranking; } if (!Util.isUnset(request.enableRewrite)) { query['EnableRewrite'] = request.enableRewrite; } if (!Util.isUnset(request.imagesShrink)) { query['Images'] = request.imagesShrink; } if (!Util.isUnset(request.indexId)) { query['IndexId'] = request.indexId; } if (!Util.isUnset(request.query)) { query['Query'] = request.query; } if (!Util.isUnset(request.queryHistoryShrink)) { query['QueryHistory'] = request.queryHistoryShrink; } if (!Util.isUnset(request.rerankShrink)) { query['Rerank'] = request.rerankShrink; } if (!Util.isUnset(request.rerankMinScore)) { query['RerankMinScore'] = request.rerankMinScore; } if (!Util.isUnset(request.rerankTopN)) { query['RerankTopN'] = request.rerankTopN; } if (!Util.isUnset(request.rewriteShrink)) { query['Rewrite'] = request.rewriteShrink; } if (!Util.isUnset(request.saveRetrieverHistory)) { query['SaveRetrieverHistory'] = request.saveRetrieverHistory; } if (!Util.isUnset(request.searchFiltersShrink)) { query['SearchFilters'] = request.searchFiltersShrink; } if (!Util.isUnset(request.sparseSimilarityTopK)) { query['SparseSimilarityTopK'] = request.sparseSimilarityTopK; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'Retrieve', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/retrieve`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries information from a specified knowledge base. * * @description * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * The response time may be long because this operation involves complex retrieval and matching. We recommend that you set appropriate timeout and retry policy for requests. * * This interface is idempotent. * * @param request RetrieveRequest * @return RetrieveResponse */ async function retrieve(WorkspaceId: string, request: RetrieveRequest): RetrieveResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return retrieveWithOptions(WorkspaceId, request, headers, runtime); } model SubmitIndexAddDocumentsJobRequest { categoryIds?: [ string ](name='CategoryIds', description='The list of primary key IDs of the category.'), chunkMode?: string(name='ChunkMode'), chunkSize?: int32(name='ChunkSize'), documentIds?: [ string ](name='DocumentIds', description='The list of the primary key IDs of the documents.'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='79c0aly8zw'), overlapSize?: int32(name='OverlapSize'), separator?: string(name='Separator'), sourceType?: string(name='SourceType', description='The data type of [Data Management](https://bailian.console.aliyun.com/#/data-center). For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * DATA_CENTER_CATEGORY: The category type. Import all documents from one or more categories in Data Center. * DATA_CENTER_FILE: The document type. Import one or more documents from Data Center. > If this parameter is set to DATA_CENTER_CATEGORY, you must specify the `CategoryIds` parameter. If this parameter is set to DATA_CENTER_FILE, you must specify the `DocumentIds` parameter. This parameter is required.', example='DATA_CENTER_FILE'), } model SubmitIndexAddDocumentsJobShrinkRequest { categoryIdsShrink?: string(name='CategoryIds', description='The list of primary key IDs of the category.'), chunkMode?: string(name='ChunkMode'), chunkSize?: int32(name='ChunkSize'), documentIdsShrink?: string(name='DocumentIds', description='The list of the primary key IDs of the documents.'), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='79c0aly8zw'), overlapSize?: int32(name='OverlapSize'), separator?: string(name='Separator'), sourceType?: string(name='SourceType', description='The data type of [Data Management](https://bailian.console.aliyun.com/#/data-center). For more information, see [Create a knowledge base](https://www.alibabacloud.com/help/en/model-studio/user-guide/rag-knowledge-base). Valid values: * DATA_CENTER_CATEGORY: The category type. Import all documents from one or more categories in Data Center. * DATA_CENTER_FILE: The document type. Import one or more documents from Data Center. > If this parameter is set to DATA_CENTER_CATEGORY, you must specify the `CategoryIds` parameter. If this parameter is set to DATA_CENTER_FILE, you must specify the `DocumentIds` parameter. This parameter is required.', example='DATA_CENTER_FILE'), } model SubmitIndexAddDocumentsJobResponseBody = { code?: string(name='Code', description='HTTP status code', example='Index.InvalidParameter'), data?: { id?: string(name='Id', description='The primary key ID of the task, `JobId`.', example='42687eb254a34802bed398357f5498ae'), }(name='Data', description='The data returned.'), message?: string(name='Message', description='The error message.', example='Required parameter(%s) missing or invalid, please check the request parameters.'), requestId?: string(name='RequestId', description='The request ID.', example='778C0B3B-03C1-5FC1-A947-36EDD13606AB'), status?: string(name='Status', description='The HTTP status code returned.', example='200'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='true'), } model SubmitIndexAddDocumentsJobResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: SubmitIndexAddDocumentsJobResponseBody(name='body'), } /** * @summary Adds parsed documents to an unstructured knowledge base. * * @description * You must first upload documents to [Data Management](https://bailian.console.aliyun.com/#/data-center) and obtain the `FileId`. The documents are the knowledge source of the knowledge base. For more information, see [Import Data](https://www.alibabacloud.com/help/en/model-studio/user-guide/data-import-instructions). * * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * After you call this operation, you can call the [GetIndexJobStatus](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-getindexjobstatus) operation to query the status of the job. More than 20 calls to the GetIndexJobStatus operation per minute may trigger throttling. * * Execution takes a period of time after this operation is called. Do not make new request before the request is returned. This interface is not idempotent. * * @param tmpReq SubmitIndexAddDocumentsJobRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return SubmitIndexAddDocumentsJobResponse */ async function submitIndexAddDocumentsJobWithOptions(WorkspaceId: string, tmpReq: SubmitIndexAddDocumentsJobRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SubmitIndexAddDocumentsJobResponse { Util.validateModel(tmpReq); var request = new SubmitIndexAddDocumentsJobShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.categoryIds)) { request.categoryIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.categoryIds, 'CategoryIds', 'json'); } if (!Util.isUnset(tmpReq.documentIds)) { request.documentIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.documentIds, 'DocumentIds', 'json'); } var query : map[string]any = {}; if (!Util.isUnset(request.categoryIdsShrink)) { query['CategoryIds'] = request.categoryIdsShrink; } if (!Util.isUnset(request.chunkMode)) { query['ChunkMode'] = request.chunkMode; } if (!Util.isUnset(request.chunkSize)) { query['ChunkSize'] = request.chunkSize; } if (!Util.isUnset(request.documentIdsShrink)) { query['DocumentIds'] = request.documentIdsShrink; } if (!Util.isUnset(request.indexId)) { query['IndexId'] = request.indexId; } if (!Util.isUnset(request.overlapSize)) { query['OverlapSize'] = request.overlapSize; } if (!Util.isUnset(request.separator)) { query['Separator'] = request.separator; } if (!Util.isUnset(request.sourceType)) { query['SourceType'] = request.sourceType; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'SubmitIndexAddDocumentsJob', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/add_documents_to_index`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Adds parsed documents to an unstructured knowledge base. * * @description * You must first upload documents to [Data Management](https://bailian.console.aliyun.com/#/data-center) and obtain the `FileId`. The documents are the knowledge source of the knowledge base. For more information, see [Import Data](https://www.alibabacloud.com/help/en/model-studio/user-guide/data-import-instructions). * * Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base `IndexId` is valid. * * After you call this operation, you can call the [GetIndexJobStatus](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-getindexjobstatus) operation to query the status of the job. More than 20 calls to the GetIndexJobStatus operation per minute may trigger throttling. * * Execution takes a period of time after this operation is called. Do not make new request before the request is returned. This interface is not idempotent. * * @param request SubmitIndexAddDocumentsJobRequest * @return SubmitIndexAddDocumentsJobResponse */ async function submitIndexAddDocumentsJob(WorkspaceId: string, request: SubmitIndexAddDocumentsJobRequest): SubmitIndexAddDocumentsJobResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return submitIndexAddDocumentsJobWithOptions(WorkspaceId, request, headers, runtime); } model SubmitIndexJobRequest { indexId?: string(name='IndexId', description='The primary key ID of the knowledge base, which is the `Data.Id` parameter returned by the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation. This parameter is required.', example='79c0aly8zw'), } model SubmitIndexJobResponseBody = { code?: string(name='Code', description='HTTP status code', example='InvalidParameter'), data?: { id?: string(name='Id', description='The primary key ID of the job, which is the `JobId` parameter of the [GetIndexJobStatus](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-getindexjobstatus) operation.', example='eFDr2fGRzP9gdDZWAdo3YQ=='), indexId?: string(name='IndexId', description='The primary key ID of the knowledge base.', example='khdyak1uuj'), }(name='Data', description='The data returned.'), message?: string(name='Message', description='The error message.', example='Required parameter(%s) missing or invalid, please check the request parameters.'), requestId?: string(name='RequestId', description='The request ID.', example='17204B98-xxxx-4F9A-8464-2446A84821CA'), status?: string(name='Status', description='The status code.', example='Success'), success?: boolean(name='Success', description='Indications whether the API call is successful. Valid values: * true * false', example='True'), } model SubmitIndexJobResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: SubmitIndexJobResponseBody(name='body'), } /** * @summary Submits a specified CreateIndex job to complete knowledge base creation. * * @description 1. Before you call this operation, you must call the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation and obtain the `IndexId`. * 2. Execution takes a period of time after this operation is called. Do not make new request before the request is returned. * 3. If you want to query the execution status of the job after you call this operation, call the [GetIndexJobStatus](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-getindexjobstatus) operation. * 4. This interface is not idempotent. * * @param request SubmitIndexJobRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return SubmitIndexJobResponse */ async function submitIndexJobWithOptions(WorkspaceId: string, request: SubmitIndexJobRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SubmitIndexJobResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.indexId)) { query['IndexId'] = request.indexId; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'SubmitIndexJob', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/index/submit_index_job`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Submits a specified CreateIndex job to complete knowledge base creation. * * @description 1. Before you call this operation, you must call the [CreateIndex](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-createindex) operation and obtain the `IndexId`. * 2. Execution takes a period of time after this operation is called. Do not make new request before the request is returned. * 3. If you want to query the execution status of the job after you call this operation, call the [GetIndexJobStatus](https://www.alibabacloud.com/help/en/model-studio/developer-reference/api-bailian-2023-12-29-getindexjobstatus) operation. * 4. This interface is not idempotent. * * @param request SubmitIndexJobRequest * @return SubmitIndexJobResponse */ async function submitIndexJob(WorkspaceId: string, request: SubmitIndexJobRequest): SubmitIndexJobResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return submitIndexJobWithOptions(WorkspaceId, request, headers, runtime); } model UpdateAndPublishAgentRequest { applicationConfig?: { historyConfig?: { enableAdbRecord?: boolean(name='enableAdbRecord'), enableRecord?: boolean(name='enableRecord'), instanceId?: string(name='instanceId'), region?: string(name='region'), storeCode?: string(name='storeCode'), }(name='historyConfig'), longTermMemory?: { enable?: boolean(name='enable'), }(name='longTermMemory'), parameters?: { dialogRound?: int32(name='dialogRound'), maxTokens?: int32(name='maxTokens'), temperature?: double(name='temperature'), }(name='parameters'), ragConfig?: { answerScope?: string(name='answerScope'), enableCitation?: boolean(name='enableCitation'), enableSearch?: boolean(name='enableSearch'), enableWebSearch?: boolean(name='enableWebSearch'), fixedReplyDetail?: string(name='fixedReplyDetail'), knowledgeBaseCodeList?: [ string ](name='knowledgeBaseCodeList'), promptStrategy?: string(name='promptStrategy'), ragRejectType?: string(name='ragRejectType'), rejectFilterPrompt?: string(name='rejectFilterPrompt'), rejectFilterType?: string(name='rejectFilterType'), retrieveMaxLength?: int32(name='retrieveMaxLength'), topK?: int32(name='topK'), }(name='ragConfig'), security?: { processingStrategy?: string(name='processingStrategy'), }(name='security'), tools?: [ { type?: string(name='type'), } ](name='tools'), workFlows?: [ { type?: string(name='type'), } ](name='workFlows'), }(name='applicationConfig'), instructions?: string(name='instructions'), modelId?: string(name='modelId'), name?: string(name='name'), sampleLibrary?: { enableSample?: boolean(name='enableSample'), sampleLibraryIdList?: [ string ](name='sampleLibraryIdList'), topK?: int32(name='topK'), }(name='sampleLibrary'), } model UpdateAndPublishAgentShrinkRequest { applicationConfigShrink?: string(name='applicationConfig'), instructions?: string(name='instructions'), modelId?: string(name='modelId'), name?: string(name='name'), sampleLibraryShrink?: string(name='sampleLibrary'), } model UpdateAndPublishAgentResponseBody = { code?: string(name='code'), data?: string(name='data'), httpStatusCode?: int32(name='httpStatusCode'), message?: string(name='message'), requestId?: string(name='requestId'), success?: boolean(name='success'), } model UpdateAndPublishAgentResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: UpdateAndPublishAgentResponseBody(name='body'), } /** * @summary 更新并发布智能体应用 * * @param tmpReq UpdateAndPublishAgentRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return UpdateAndPublishAgentResponse */ async function updateAndPublishAgentWithOptions(workspaceId: string, appCode: string, tmpReq: UpdateAndPublishAgentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateAndPublishAgentResponse { Util.validateModel(tmpReq); var request = new UpdateAndPublishAgentShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.applicationConfig)) { request.applicationConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.applicationConfig, 'applicationConfig', 'json'); } if (!Util.isUnset(tmpReq.sampleLibrary)) { request.sampleLibraryShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sampleLibrary, 'sampleLibrary', 'json'); } var body : map[string]any = {}; if (!Util.isUnset(request.applicationConfigShrink)) { body['applicationConfig'] = request.applicationConfigShrink; } if (!Util.isUnset(request.instructions)) { body['instructions'] = request.instructions; } if (!Util.isUnset(request.modelId)) { body['modelId'] = request.modelId; } if (!Util.isUnset(request.name)) { body['name'] = request.name; } if (!Util.isUnset(request.sampleLibraryShrink)) { body['sampleLibrary'] = request.sampleLibraryShrink; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'UpdateAndPublishAgent', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/application/agents/${OpenApiUtil.getEncodeParam(appCode)}`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 更新并发布智能体应用 * * @param request UpdateAndPublishAgentRequest * @return UpdateAndPublishAgentResponse */ async function updateAndPublishAgent(workspaceId: string, appCode: string, request: UpdateAndPublishAgentRequest): UpdateAndPublishAgentResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return updateAndPublishAgentWithOptions(workspaceId, appCode, request, headers, runtime); } model UpdateAndPublishAgentSelectiveRequest { applicationConfig?: { historyConfig?: { enableAdbRecord?: boolean(name='enableAdbRecord'), enableRecord?: boolean(name='enableRecord'), instanceId?: string(name='instanceId'), region?: string(name='region'), storeCode?: string(name='storeCode'), }(name='historyConfig'), longTermMemory?: { enable?: boolean(name='enable'), }(name='longTermMemory'), parameters?: { dialogRound?: int32(name='dialogRound'), maxTokens?: int32(name='maxTokens'), temperature?: double(name='temperature'), }(name='parameters'), ragConfig?: { answerScope?: string(name='answerScope'), enableCitation?: boolean(name='enableCitation'), enableSearch?: boolean(name='enableSearch'), enableWebSearch?: boolean(name='enableWebSearch'), fixedReplyDetail?: string(name='fixedReplyDetail'), knowledgeBaseCodeList?: [ string ](name='knowledgeBaseCodeList'), promptStrategy?: string(name='promptStrategy'), ragRejectType?: string(name='ragRejectType'), rejectFilterPrompt?: string(name='rejectFilterPrompt'), rejectFilterType?: string(name='rejectFilterType'), retrieveMaxLength?: int32(name='retrieveMaxLength'), topK?: int32(name='topK'), }(name='ragConfig'), security?: { processingStrategy?: string(name='processingStrategy'), }(name='security'), tools?: [ { type?: string(name='type'), } ](name='tools'), workFlows?: [ { type?: string(name='type'), } ](name='workFlows'), }(name='applicationConfig'), instructions?: string(name='instructions'), modelId?: string(name='modelId'), name?: string(name='name'), sampleLibrary?: { enableSample?: boolean(name='enableSample'), sampleLibraryIdList?: [ string ](name='sampleLibraryIdList'), topK?: int32(name='topK'), }(name='sampleLibrary'), } model UpdateAndPublishAgentSelectiveShrinkRequest { applicationConfigShrink?: string(name='applicationConfig'), instructions?: string(name='instructions'), modelId?: string(name='modelId'), name?: string(name='name'), sampleLibraryShrink?: string(name='sampleLibrary'), } model UpdateAndPublishAgentSelectiveResponseBody = { code?: string(name='code'), data?: string(name='data'), httpStatusCode?: int32(name='httpStatusCode'), message?: string(name='message'), requestId?: string(name='requestId'), success?: boolean(name='success'), } model UpdateAndPublishAgentSelectiveResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: UpdateAndPublishAgentSelectiveResponseBody(name='body'), } /** * @summary 选择更新并发布智能体应用 * * @param tmpReq UpdateAndPublishAgentSelectiveRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return UpdateAndPublishAgentSelectiveResponse */ async function updateAndPublishAgentSelectiveWithOptions(workspaceId: string, appCode: string, tmpReq: UpdateAndPublishAgentSelectiveRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateAndPublishAgentSelectiveResponse { Util.validateModel(tmpReq); var request = new UpdateAndPublishAgentSelectiveShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.applicationConfig)) { request.applicationConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.applicationConfig, 'applicationConfig', 'json'); } if (!Util.isUnset(tmpReq.sampleLibrary)) { request.sampleLibraryShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sampleLibrary, 'sampleLibrary', 'json'); } var body : map[string]any = {}; if (!Util.isUnset(request.applicationConfigShrink)) { body['applicationConfig'] = request.applicationConfigShrink; } if (!Util.isUnset(request.instructions)) { body['instructions'] = request.instructions; } if (!Util.isUnset(request.modelId)) { body['modelId'] = request.modelId; } if (!Util.isUnset(request.name)) { body['name'] = request.name; } if (!Util.isUnset(request.sampleLibraryShrink)) { body['sampleLibrary'] = request.sampleLibraryShrink; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'UpdateAndPublishAgentSelective', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/application/agents/${OpenApiUtil.getEncodeParam(appCode)}/updateAndPublishAgentSelective`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 选择更新并发布智能体应用 * * @param request UpdateAndPublishAgentSelectiveRequest * @return UpdateAndPublishAgentSelectiveResponse */ async function updateAndPublishAgentSelective(workspaceId: string, appCode: string, request: UpdateAndPublishAgentSelectiveRequest): UpdateAndPublishAgentSelectiveResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return updateAndPublishAgentSelectiveWithOptions(workspaceId, appCode, request, headers, runtime); } model UpdateFileTagRequest { tags?: [ string ](name='Tags', description='This parameter is required.'), } model UpdateFileTagShrinkRequest { tagsShrink?: string(name='Tags', description='This parameter is required.'), } model UpdateFileTagResponseBody = { code?: string(name='Code', example='Success'), data?: { fileId?: string(name='FileId', example='file_9a65732555b54d5ea10796ca5742ba22_xxxxxxxx'), }(name='Data'), message?: string(name='Message', example='Requests throttling triggered.'), requestId?: string(name='RequestId', description='RequestId', example='35A267BF-xxxx-54DB-8394-AA3B0742D833'), status?: string(name='Status', example='200'), success?: boolean(name='Success', example='true'), } model UpdateFileTagResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: UpdateFileTagResponseBody(name='body'), } /** * @summary 更新文档Tag * * @param tmpReq UpdateFileTagRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return UpdateFileTagResponse */ async function updateFileTagWithOptions(WorkspaceId: string, FileId: string, tmpReq: UpdateFileTagRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateFileTagResponse { Util.validateModel(tmpReq); var request = new UpdateFileTagShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!Util.isUnset(tmpReq.tags)) { request.tagsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tags, 'Tags', 'json'); } var body : map[string]any = {}; if (!Util.isUnset(request.tagsShrink)) { body['Tags'] = request.tagsShrink; } var req = new OpenApi.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApi.Params{ action = 'UpdateFileTag', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(WorkspaceId)}/datacenter/file/${OpenApiUtil.getEncodeParam(FileId)}`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'formData', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 更新文档Tag * * @param request UpdateFileTagRequest * @return UpdateFileTagResponse */ async function updateFileTag(WorkspaceId: string, FileId: string, request: UpdateFileTagRequest): UpdateFileTagResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return updateFileTagWithOptions(WorkspaceId, FileId, request, headers, runtime); } model UpdateMemoryRequest { description?: string(name='description'), } model UpdateMemoryResponseBody = { requestId?: string(name='requestId', example='6a71f2d9-f1c9-913b-818b-114029103cad'), } model UpdateMemoryResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: UpdateMemoryResponseBody(name='body'), } /** * @summary 更新memory * * @param request UpdateMemoryRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return UpdateMemoryResponse */ async function updateMemoryWithOptions(workspaceId: string, memoryId: string, request: UpdateMemoryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateMemoryResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.description)) { query['description'] = request.description; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'UpdateMemory', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories/${OpenApiUtil.getEncodeParam(memoryId)}`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 更新memory * * @param request UpdateMemoryRequest * @return UpdateMemoryResponse */ async function updateMemory(workspaceId: string, memoryId: string, request: UpdateMemoryRequest): UpdateMemoryResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return updateMemoryWithOptions(workspaceId, memoryId, request, headers, runtime); } model UpdateMemoryNodeRequest { content?: string(name='content', description='This parameter is required.'), } model UpdateMemoryNodeResponseBody = { requestId?: string(name='requestId', example='8C56C7AF-6573-19CE-B018-E05E1EDCF4C5'), } model UpdateMemoryNodeResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: UpdateMemoryNodeResponseBody(name='body'), } /** * @summary 更新记忆Node * * @param request UpdateMemoryNodeRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return UpdateMemoryNodeResponse */ async function updateMemoryNodeWithOptions(workspaceId: string, memoryId: string, memoryNodeId: string, request: UpdateMemoryNodeRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateMemoryNodeResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.content)) { query['content'] = request.content; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'UpdateMemoryNode', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/memories/${OpenApiUtil.getEncodeParam(memoryId)}/memoryNodes/${OpenApiUtil.getEncodeParam(memoryNodeId)}`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 更新记忆Node * * @param request UpdateMemoryNodeRequest * @return UpdateMemoryNodeResponse */ async function updateMemoryNode(workspaceId: string, memoryId: string, memoryNodeId: string, request: UpdateMemoryNodeRequest): UpdateMemoryNodeResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return updateMemoryNodeWithOptions(workspaceId, memoryId, memoryNodeId, request, headers, runtime); } model UpdatePromptTemplateRequest { content?: string(name='content', description='The template content.'), name?: string(name='name', description='The template name.'), } model UpdatePromptTemplateResponseBody = { requestId?: string(name='requestId', description='The request ID.', example='FE9B6CBF-47E6-5D76-9C5D-B814DD5ABxxx'), } model UpdatePromptTemplateResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: UpdatePromptTemplateResponseBody(name='body'), } /** * @summary Updates a prompt template based on the template ID. * * @param request UpdatePromptTemplateRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return UpdatePromptTemplateResponse */ async function updatePromptTemplateWithOptions(workspaceId: string, promptTemplateId: string, request: UpdatePromptTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdatePromptTemplateResponse { Util.validateModel(request); var query : map[string]any = {}; if (!Util.isUnset(request.content)) { query['content'] = request.content; } if (!Util.isUnset(request.name)) { query['name'] = request.name; } var req = new OpenApi.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApi.Params{ action = 'UpdatePromptTemplate', version = '2023-12-29', protocol = 'HTTPS', pathname = `/${OpenApiUtil.getEncodeParam(workspaceId)}/promptTemplates/${OpenApiUtil.getEncodeParam(promptTemplateId)}`, method = 'PATCH', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Updates a prompt template based on the template ID. * * @param request UpdatePromptTemplateRequest * @return UpdatePromptTemplateResponse */ async function updatePromptTemplate(workspaceId: string, promptTemplateId: string, request: UpdatePromptTemplateRequest): UpdatePromptTemplateResponse { var runtime = new Util.RuntimeOptions{}; var headers : map[string]string = {}; return updatePromptTemplateWithOptions(workspaceId, promptTemplateId, request, headers, runtime); }