dotCMS / dotCMS/core

[EPIC] AI JavaScript SDK

Open
#33,556 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale Team : Scout
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

Vision

Enable JavaScript developers to seamlessly integrate dotCMS's AI capabilities (dotAI) into their headless applications through familiar SDK patterns, accelerating AI-powered content experiences while maintaining the same developer experience standards as existing dotCMS SDKs.

Problem

dotCMS has powerful AI functionality through dotAI that exposes comprehensive REST endpoints for text generation, image generation, content search, embeddings, and completions. However, JavaScript developers building headless applications currently have no SDK-level access to these capabilities. They must:

  • Manually implement HTTP calls to dotAI REST endpoints
  • Handle authentication, error handling, and type safety themselves
  • Learn new API patterns separate from existing dotCMS SDK conventions
  • Miss out on the streamlined developer experience provided by @dotcms/client, @dotcms/uve, etc.

This creates friction for developers wanting to integrate AI features and limits adoption of dotCMS's AI capabilities in headless implementations.

Solution

Add AI functionality directly to the existing @dotcms/client SDK, providing developers with:

  • Unified dotAI API experience - all dotCMS features accessible through single client instance
  • Type-safe AI operations with full TypeScript support
  • Seamless authentication using existing client configuration
  • Comprehensive AI functionality covering text generation, image generation, search, embeddings, and completions
  • Familiar patterns following established SDK conventions
Proposed API Structure
const client = createDotCMSClient(config);

// Existing functionality unchanged
const page = await client.page.get('/about');
const content = await client.content.getCollection('Blog');

// New AI functionality  
const textResult = await client.ai.text.generate('Write about vacation');
const imageResult = await client.ai.image.generate('A sunset beach');
const searchResults = await client.ai.search('tropical destinations');
const completion = await client.ai.completions.create({
  prompt: 'Best vacation spots?',
  indexName: 'blogIndex'
});
Technical Specification

API Coverage (11 Total Endpoints):

Category Endpoints SDK Methods
Generation text/generate, image/generate client.ai.text.generate(), client.ai.image.generate()
Search search, search/related client.ai.search(), client.ai.search.related()
Completions completions, completions/rawPrompt, completions/config client.ai.completions.create(), client.ai.completions.raw(), client.ai.completions.getConfig()
Embeddings embeddings, embeddings/db, embeddings/indexCount client.ai.embeddings.create(), client.ai.embeddings.delete(), client.ai.embeddings.deleteAll(), client.ai.embeddings.listIndexes()

Core TypeScript Interfaces:

  • Complete type safety for all AI operations
  • Standard OpenAI-compatible response formats
  • Full support for streaming responses and error handling
  • Integration with existing dotCMS authentication patterns

Links

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing @dotcms/client SDK and the linked dotAI REST API documentation to understand its conventions, authentication, and endpoint coverage. Done means adding the proposed typed methods for all 11 endpoints, including streaming and error handling, while preserving existing client functionality.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api, backend-api-design, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.