-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: main
Are you sure you want to change the base?
Conversation
Update getListenerModel API to return `ballerina/ai` if there is no `ballerinax/ai` import in the project and add test cases.
Add getNodeTemplate tests for new `ai` module and add support to `agentManager/getAllModels` to get the models given the orgName
ballerina/ai
module support
Project project = this.workspaceManager.loadProject(projectPath); | ||
BLangPackage bLangPackage = | ||
PackageUtil.getCompilation(project.currentPackage()).defaultModuleBLangPackage(); | ||
response.setOrg(importExists(bLangPackage, BALLERINAX, AI_AGENT) ? BALLERINAX : BALLERINA); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this 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 |
...low-model-generator-ls-extension/src/test/resources/module_nodes/config/new_agent_model.json
Show resolved
Hide resolved
...es/flow-model-generator-ls-extension/src/test/resources/module_nodes/config/agent_model.json
Show resolved
Hide resolved
...or-ls-extension/src/test/java/io/ballerina/flowmodelgenerator/extension/ModuleNodesTest.java
Show resolved
Hide resolved
...es/flow-model-generator-ls-extension/src/test/resources/module_nodes/config/agent_model.json
Show resolved
Hide resolved
2d3458d
to
d939ff1
Compare
...model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/AgentsGenerator.java
Outdated
Show resolved
Hide resolved
...-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/AgentsManagerService.java
Outdated
Show resolved
Hide resolved
...-extension/src/main/java/io/ballerina/flowmodelgenerator/extension/AgentsManagerService.java
Outdated
Show resolved
Hide resolved
...model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/AgentsGenerator.java
Outdated
Show resolved
Hide resolved
} else { | ||
model.addProperty("symbol", objectOrFuncName); | ||
} | ||
model.addProperty("version", "1.0.0"); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
...ow-model-generator-core/src/main/java/io/ballerina/flowmodelgenerator/core/CodeAnalyzer.java
Show resolved
Hide resolved
9bb2311
to
5646b83
Compare
Purpose
Changes introduced
serviceDesign/getListenerModel
now supports retrieving a listener given the organization nameserviceDesign/getServiceModel
now supports retrieving a service given the organization nameagentManager/getAllAgents
now supports retrieving all agents given the organization nameagentManager/getAllMemoryManagers
now supports retrieving all ai memory managers given the organization nameagentManager/getAllModels
now supports retrieving all ai models given the organization nameai
modulePart of wso2/product-ballerina-integrator#549
Goals