@getalai/client v0.0.2
📘 Alai SDK – Usage Guide
This SDK provides convenient access to Alai's API methods for authentication, presentation management, slide generation, and theme retrieval.
🔐 Auth Module
alai.auth.Authenticate
Authenticates a user via email and password using Alai's password grant method.
Usage
import { alai } from '@getalai/client';
const token = await alai.auth.Authenticate({
email: "user@example.com",
password: "securePassword123"
});
Returns
Promise<IToken>
Throws
An error if authentication fails.
🖼️ Presentation Module
alai.presentation.CreateNewPresentation
Creates a new presentation with a title and a theme.
Usage
const presentation = await alai.presentation.CreateNewPresentation({
presentation_title: "Climate Change Overview",
theme_id: "theme_xyz"
});
Returns
Promise<IPresentation>
alai.presentation.MakePresentationShareable
Generates a public link for the specified presentation.
Usage
const { link } = await alai.presentation.MakePresentationShareable({
presentation_id: "presentation_123"
});
Returns
Promise<{ link: string }>
alai.presentation.UpdatePresentationTheme
Updates the theme of an existing presentation.
Usage
const updatedPresentation = await alai.presentation.UpdatePresentationTheme({
presentation_id: "presentation_123",
theme_id: "new_theme_id"
});
alai.presentation.UpdatePresentationTitle
Updates the title of a presentation.
Usage
await alai.presentation.UpdatePresentationTitle({
presentation_id: "presentation_123",
presentation_title: "New Title"
});
alai.presentation.GetPresentationQuestions
Fetches all questions linked to a given presentation.
Usage
const questions = await alai.presentation.GetPresentationQuestions({
presentation_id: "presentation_123"
});
Returns
Promise<IQuestion[]>
alai.presentation.CalibrateTone
Adjusts the tone of given text for a presentation.
Usage
const result = await alai.presentation.CalibrateTone({
presentation_id: "presentation_123",
original_text: "This is a sample paragraph.",
tone_type: "INSPIRATIONAL",
tone_instructions: null
});
Returns
Promise<{ sample_text: string }>
alai.presentation.CalibrateVerbosity
Adjusts the verbosity of text based on specified levels and tone.
Usage
const result = await alai.presentation.CalibrateVerbosity({
presentation_id: "presentation_123",
original_text: "This is a detailed explanation...",
verbosity_level: 2,
previous_verbosity_level: 4,
tone_type: "CASUAL",
tone_instructions: null
});
alai.presentation.GetThemes
Retrieves a list of all available presentation themes.
Usage
const themes = await alai.presentation.GetThemes();
Returns
Promise<ITheme[]>
🧩 Slides Module
alai.slides.GenerateSlidesOutline
Generates slide outlines using a WebSocket.
Usage
const result = await alai.slides.GenerateSlidesOutline({
presentation_id: "presentation_123",
slide_order: 1,
raw_context: "Climate change is a pressing issue...",
presentation_instructions: "Make it beginner-friendly",
slide_range: "1-5",
presentation_questions: []
});
alai.slides.CreateSlides
Creates slides and their variants using outline data.
Usage
const { presentation, slide, variants } = await alai.slides.CreateSlides({
presentation_id: "presentation_123",
presentation_instructions: "Explain with simple language",
raw_context: "Global warming trends...",
slide_id: "slide_001",
slide_outlines: [], // Populate with IOutline[]
starting_slide_order: 1,
update_tone_verbosity_calibration_status: true
});
alai.slides.SetActiveVariant
Sets a chosen variant as the active one for a slide.
Usage
await alai.slides.SetActiveVariant({
slide_id: "slide_001",
variant_id: "variant_456"
});
alai.slides.UpdateSlideEntity
Updates the content or metadata of a slide.
Usage
await alai.slides.UpdateSlideEntity({
id: "slide_001",
content: "Updated content here...",
order: 2
});
alai.slides.SetSlideStatus
Sets the status of a slide.
Usage
await alai.slides.SetSlideStatus({
slide_id: "slide_001",
slide_status: "DEFAULT"
});
alai.slides.PickSlideVariant
Manually pick a variant to be used for a slide.
Usage
await alai.slides.PickSlideVariant({
slide_id: "slide_001",
variant_id: "variant_456"
});
alai.slides.CreateAndStreamSlides
Creates and streams slide data and its variants over WebSocket.
Usage
const result = await alai.slides.CreateAndStreamSlides({
presentation_id: "presentation_123",
slide_id: "slide_001",
// additional parameters depending on implementation
});