Add bulk class embeddings endpoint for ontologies #985
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for bulk download of class embeddings for entire ontologies, addressing the need to retrieve all embeddings for an ontology at once rather than fetching them individually.
New API Endpoint
Added
GET /api/v2/ontologies/{onto}/classes/llm_embeddings
which returns all classes with embeddings for a specific ontology with pagination support.Parameters:
{onto}
- Ontology ID (path parameter)page
- Page number (optional, default: 0)size
- Page size (optional, default: 20)lang
- Language code (optional, default: "en")Example Usage:
Implementation Details
The endpoint follows the existing API patterns and includes:
isDefiningOntology:['true']
), and have embeddings availableSKIP
/LIMIT
with total count calculation for large ontologiesV2PagedResponse<V2Entity>
format like other endpointsTechnical Changes
getEmbeddingsByOntologyId()
method with Cypher query for bulk retrievalV2LLMController
following existing patternsThe underlying Neo4j query efficiently retrieves classes with embeddings:
This enables efficient bulk access to embeddings while maintaining good performance for large ontologies through proper pagination.
Fixes #984.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.