RetrieveKnowledgePoints

Updated at:

Retrieves knowledge points in one or more authorized knowledge bases and returns summaries, relationship paths, and ambiguity candidates.

Operation description

Retrieves knowledge points from one or more knowledge bases within the authorization scope of the current caller, and returns knowledge point summaries, relationship paths, and ambiguity candidates.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:RetrieveKnowledgePoints

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Query

string

Yes

The natural language question. The length cannot exceed 256 Unicode code points after leading and trailing whitespaces are removed.

How is sales revenue calculated, and which tables does it come from?

KnowledgeBaseIds

array

No

The list of knowledge base IDs to restrict the search. You can specify 1 to 50 unique IDs. If this parameter is omitted, knowledge bases are discovered within the authorization scope of the current caller. If knowledge bases are explicitly specified, each is authenticated individually. If the caller lacks permissions for any specified knowledge base, the entire request fails.

string

No

The knowledge base ID.

12345678-1234-4234-8234-123456789abc

MaxResults

integer

No

The maximum number of hits across all knowledge bases combined. Valid values: 1 to 50. Default value: 10. This parameter does not specify the quota for each knowledge base or the page size.

10

FocusObjects

array<object>

No

The graph objects to focus the search on. You can specify up to 2 unique objects. The objects must be within the current authorized search scope and do not expand permissions.

object

No

KnowledgeBaseId

string

Yes

The ID of the knowledge base to which the knowledge point belongs. This parameter is used together with Type and Id to locate the knowledge point.

12345678-1234-4234-8234-123456789abc

Type

string

Yes

The read category of the knowledge point. Set this parameter to GRAPH for the current focus objects and graph nodes.

GRAPH

Id

string

Yes

The location ID of the knowledge point. Copy this value exactly as it appears in the search results and use it together with the corresponding KnowledgeBaseId and Type. Do not parse or convert this value.

node-sales

Response elements

Element

Type

Description

Example

object

The successful response of the operation.

RequestId

string

The unique identifier of the request. You can use this ID to troubleshoot issues.

00000000-0000-4000-8000-000000000001

Success

boolean

Indicates whether the request is successful.

Data

object

The knowledge point summaries, relationship paths, ambiguity candidates, and warnings for the current search.

Results

array<object>

The knowledge point summaries returned by unified relevance. The total number of results across all knowledge bases does not exceed the value of MaxResults. The results can include GRAPH, WIKI, and KNOWLEDGE_CONTENT.

array<object>

KnowledgeBaseId

string

The ID of the knowledge base to which the knowledge point belongs. This parameter is used together with Type and Id to locate the knowledge point.

12345678-1234-4234-8234-123456789abc

Type

string

The read category of the knowledge point. GRAPH indicates a local graph, WIKI indicates a topic page, and KNOWLEDGE_CONTENT indicates knowledge content.

GRAPH

Id

string

The location ID of the knowledge point. Copy this value exactly as it appears in the search results and use it together with the corresponding KnowledgeBaseId and Type. Do not parse or convert this value.

node-sales

Title

string

The display title of the current knowledge point.

Sales revenue

Summary

string

The readable summary of the knowledge point. The summary is not guaranteed to contain the complete content. To obtain details, call GetKnowledgePoint.

The sales revenue metric and its associated order table

Sources

array<object>

The download information of the uploaded original documents explicitly associated with the current content. This parameter is omitted if no reliable source is available or if the caller lacks read permissions for the original files. The ability to retrieve a knowledge point does not imply the permission to download the complete original file.

object

FileName

string

The full file name of the original document used for building. This is not the name of the current knowledge point snippet.

Sales_policy.pdf

DownloadUrl

string

The temporary HTTPS download URL of the original file. The URL is valid for 2 hours. This parameter is returned only when the source can be reliably located and the caller has read permissions for the original file. Do not forward this URL publicly or store it for long-term use.

https://example.com/sales-policy.pdf

ExpirationTime

integer

The expiration time of the download URL. The value is a UNIX timestamp in milliseconds.

1794376800000

Definition

string

The published business definition of the metric. This parameter is omitted if no reliable definition is available.

Distinct count by refund order ID

Expression

string

The published and verifiable complete calculation expression of the metric. This parameter is omitted if no reliable formula is available.

COUNT(DISTINCT refund_id)

ExpressionDialect

string

The explicitly annotated expression dialect of the published definition. This parameter is omitted if no dialect is annotated.

sql

Paths

array<object>

The object relationship paths matched in the current search. These paths do not correspond to the Results array by index. The system does not guarantee that all relationships are exhaustively listed.

array<object>

Nodes

array<object>

The graph nodes in the current relationship path. You can read the details of each node by using its KnowledgeBaseId, Type, and Id.

object

KnowledgeBaseId

string

The ID of the knowledge base to which the knowledge point belongs. This parameter is used together with Type and Id to locate the knowledge point.

12345678-1234-4234-8234-123456789abc

Type

string

The read category of the knowledge point. Set this parameter to GRAPH for the current focus objects and graph nodes.

GRAPH

Id

string

The location ID of the knowledge point. Copy this value exactly as it appears in the search results and use it together with the corresponding KnowledgeBaseId and Type. Do not parse or convert this value.

node-sales

Title

string

The display title of the current knowledge point.

Sales revenue

Edges

array<object>

The directed relationships that connect the nodes in the Nodes array of the current path.

object

FromId

string

The Id of the source node in the Nodes array of the same path.

node-sales

ToId

string

The Id of the destination node in the Nodes array of the same path.

node-orders

RelationType

string

The public relationship type directed from the source node to the destination node. For example, CALCULATED_FROM indicates that the source node is calculated based on the destination node. You cannot infer the complete formula solely based on the relationship type.

CALCULATED_FROM

Ambiguities

array<object>

The ambiguity descriptions and candidate objects returned when the target is not yet confirmed.

array<object>

Mention

string

The name or description of the unresolved referent in the query.

Sales revenue

Candidates

array<object>

The candidate graph nodes when ambiguity exists. Each candidate carries a KnowledgeBaseId, Type, and Id for reading details, which does not indicate that the user has confirmed the selection.

object

KnowledgeBaseId

string

The ID of the knowledge base to which the knowledge point belongs. This parameter is used together with Type and Id to locate the knowledge point.

12345678-1234-4234-8234-123456789abc

Type

string

The read category of the knowledge point. Set this parameter to GRAPH for the current focus objects and graph nodes.

GRAPH

Id

string

The location ID of the knowledge point. Copy this value exactly as it appears in the search results and use it together with the corresponding KnowledgeBaseId and Type. Do not parse or convert this value.

node-sales

Title

string

The display title of the current knowledge point.

Sales revenue

Warnings

array<object>

The truncation, scope limitation, or degradation warnings for the current call. Use the Code parameter for programmatic judgment. The Message parameter is for human-readable descriptions only.

object

Code

string

The truncation or degradation warning code. For example, CONTENT_TRUNCATED indicates that the content is truncated, and SOURCE_UNAVAILABLE indicates that the original file download is temporarily unavailable.

CONTENT_TRUNCATED

Message

string

The sanitized human-readable description of the current warning. Use the Code parameter for programmatic judgment instead of relying on the text.

Some content exceeds the length limit and has been truncated

Code

string

The business error code. This parameter is omitted if the request is successful. If the request fails, the common error response protocol applies.

InvalidParameter

Message

string

The human-readable description of the business error. This parameter is omitted if the request is successful. When troubleshooting a failure, provide the RequestId as well.

The request parameters are invalid.

Examples

Success response

JSON format

{
  "RequestId": "00000000-0000-4000-8000-000000000001",
  "Success": false,
  "Data": {
    "Results": [
      {
        "KnowledgeBaseId": "12345678-1234-4234-8234-123456789abc",
        "Type": "GRAPH",
        "Id": "node-sales",
        "Title": "Sales revenue",
        "Summary": "The sales revenue metric and its associated order table",
        "Sources": [
          {
            "FileName": "Sales_policy.pdf",
            "DownloadUrl": "https://example.com/sales-policy.pdf",
            "ExpirationTime": 1794376800000
          }
        ],
        "Definition": "按退款单号去重计数。",
        "Expression": "COUNT(DISTINCT refund_id)",
        "ExpressionDialect": "sql"
      }
    ],
    "Paths": [
      {
        "Nodes": [
          {
            "KnowledgeBaseId": "12345678-1234-4234-8234-123456789abc",
            "Type": "GRAPH",
            "Id": "node-sales",
            "Title": "Sales revenue"
          }
        ],
        "Edges": [
          {
            "FromId": "node-sales",
            "ToId": "node-orders",
            "RelationType": "CALCULATED_FROM"
          }
        ]
      }
    ],
    "Ambiguities": [
      {
        "Mention": "Sales revenue",
        "Candidates": [
          {
            "KnowledgeBaseId": "12345678-1234-4234-8234-123456789abc",
            "Type": "GRAPH",
            "Id": "node-sales",
            "Title": "Sales revenue"
          }
        ]
      }
    ],
    "Warnings": [
      {
        "Code": "CONTENT_TRUNCATED",
        "Message": "Some content exceeds the length limit and has been truncated"
      }
    ]
  },
  "Code": "InvalidParameter",
  "Message": "The request parameters are invalid."
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The request parameters are invalid.
500 InternalError The knowledge base operation failed. Use RequestId to contact support.
403 Forbidden You are not authorized to perform this operation.
404 ResourceNotFound The requested resource does not exist or is not visible.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.