Skip to content

New ballerina/ai module support #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

rdulmina
Copy link
Contributor

@rdulmina rdulmina commented Jul 15, 2025

Purpose

Changes introduced

  1. Introduce new API (agentManager/getAgentOrg) to get ai module organization
  2. serviceDesign/getListenerModel now supports retrieving a listener given the organization name
  3. serviceDesign/getServiceModel now supports retrieving a service given the organization name
  4. agentManager/getAllAgents now supports retrieving all agents given the organization name
  5. agentManager/getAllMemoryManagers now supports retrieving all ai memory managers given the organization name
  6. agentManager/getAllModels now supports retrieving all ai models given the organization name
  7. Added tests to cover all the updated APIs
  8. Added tests for getNodeTemplate and getSourceCode for the new ai module

Part of wso2/product-ballerina-integrator#549

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

@rdulmina rdulmina requested a review from KavinduZoysa as a code owner July 15, 2025 11:00
@rdulmina rdulmina changed the title New ballerina/ai module support New ballerina/ai module support Jul 15, 2025
Copilot

This comment was marked as outdated.

Project project = this.workspaceManager.loadProject(projectPath);
BLangPackage bLangPackage =
PackageUtil.getCompilation(project.currentPackage()).defaultModuleBLangPackage();
response.setOrg(importExists(bLangPackage, BALLERINAX, AI_AGENT) ? BALLERINAX : BALLERINA);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using the BLangPackage? Can't we use the Module and SyntaxTree for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, but It complicates things. We have to loop each document by document and check the importExists

@rdulmina rdulmina requested a review from Copilot July 18, 2025 08:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for the new ballerina/ai module by extending the existing system to handle AI-related functionality. The primary purpose is to add comprehensive support for AI agents, models, and memory managers in the Ballerina service model generator.

Key changes include:

  • Added a new API (agentManager/getAgentOrg) to retrieve AI module organization information
  • Extended existing APIs to support organization-based queries for better module resolution
  • Added comprehensive test coverage for the new AI module functionality

Reviewed Changes

Copilot reviewed 81 out of 85 changed files in this pull request and generated 2 comments.

File Description
packages.json Adds configuration for the new "ai" module with agent service type definitions
ServiceDatabaseManager.java Updates database queries to support organization-based lookups for listeners and service declarations
CommonUtils.java Adds utility methods for AI module identification and import handling
Various test files Adds comprehensive test coverage for AI module functionality including agents, models, and memory managers

@rdulmina rdulmina force-pushed the new-ai-module-support branch from 2d3458d to d939ff1 Compare July 18, 2025 09:05
} else {
model.addProperty("symbol", objectOrFuncName);
}
model.addProperty("version", "1.0.0");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we hard-coding the version to "1.0.0"? Is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, getAllModels is hardcoded with the version. This is to prevent pulling all the ai model provider modules(currently 6) and building the semantic model.

Copy link
Contributor

@dulajdilshan dulajdilshan Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. Shouldn't we better consider extracting this to a constant (e.g. SUPPORTED_AI_VERSION = "1.0.0"). it will easy when updating the version to a new version.

@rdulmina rdulmina requested a review from dulajdilshan July 20, 2025 16:01
@rdulmina rdulmina force-pushed the new-ai-module-support branch from 9bb2311 to 5646b83 Compare July 20, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants