ballerinax/ai.wso2.integration Ballerina library

1.2.0

Overview

The ai.wso2.integration module provides a Ballerina ai:KnowledgeBase implementation for retrieving relevant content from a WSO2 Integration knowledge base.

Quickstart

Copy
import ballerina/ai;
import ballerinax/ai.wso2.integration;

integration:CloudKnowledgeBase knowledgeBase = check new (
    serviceUrl,
    {auth: {token: accessToken}}
);

ai:QueryMatch[] matches = check knowledgeBase.retrieve("How do I configure the integration?");

Authentication

KnowledgeBaseAuthConfig.auth accepts one of the following:

  • http:BearerTokenConfig - a bearer token, e.g. {auth: {token: accessToken}}
  • http:OAuth2ClientCredentialsGrantConfig - OAuth2 client credentials, e.g. {auth: {tokenUrl, clientId, clientSecret}}
  • integration:ApiKeyConfig - a WSO2 Cloud gateway API key. The key is sent in the X-API-Key request header by default; set headerName if the gateway API is configured to read it from a different header.
Copy
configurable string serviceUrl = ?;
configurable string apiKey = ?;

integration:CloudKnowledgeBase knowledgeBase = check new (
    serviceUrl,
    {auth: {apiKey}}
);

// Or, with a custom gateway header:
// {auth: {apiKey, headerName: "X-Custom-Api-Key"}}

The implementation supports retrieval. Ingestion and deletion are not currently supported.

Import

import ballerinax/ai.wso2.integration;Copy

Other versions

Metadata

Released date: about 18 hours ago

Version: 1.2.0

License: Apache-2.0


Security

No known vulnerabilities in libraries

Checked on 2026-11-11 via OSV.dev


Compatibility

Platform: java21

Ballerina version: 2201.13.6

GraalVM compatible: Yes


Pull count

Total: 130

Current verison: 6


Weekly downloads


Source repository


Keywords

Vendor/WSO2

Area/AI & Machine Learning

Type/Connector

Type/Knowledge Base

Name/WSO2 Integration Platform


Contributors