2Slides Logo
AI Presentation Agent बनाएं: संपूर्ण Developer गाइड
2Slides Team
6 min read

AI प्रेजेंटेशन एजेंट बनाएं: संपूर्ण डेवलपर गाइड

AI एजेंट सॉफ्टवेयर द्वारा कंटेंट बनाने के तरीके को बदल रहे हैं। एक AI प्रेजेंटेशन एजेंट स्वचालित वर्कफ़्लो के हिस्से के रूप में प्रोफेशनल स्लाइड डेक बना सकता है, कस्टमाइज़ कर सकता है और डिलीवर कर सकता है — CRM पाइपलाइन से लेकर इंटर्नल रिपोर्टिंग टूल्स तक।

यह गाइड आपको 2Slides API का उपयोग करके प्रोडक्शन-रेडी प्रेजेंटेशन एजेंट बनाने की प्रक्रिया से परिचित कराती है।

आर्किटेक्चर ओवरव्यू

एक प्रेजेंटेशन एजेंट आम तौर पर इस फ्लो का अनुसरण करता है:

User Request → Agent Logic → 2Slides API → Poll Job → Deliver Result Context Gathering (data, templates, brand assets)

मुख्य घटक

  1. Input Handler — प्रेजेंटेशन अनुरोध प्राप्त करता है (text, data, files)
  2. Context Builder — टेम्पलेट्स, ब्रांड जानकारी, डेटा के साथ अनुरोधों को समृद्ध करता है
  3. Generation Engine — स्लाइड बनाने के लिए 2Slides API को कॉल करता है
  4. Status Monitor — पूर्ण होने तक जॉब स्टेटस को पोल करता है
  5. Delivery Layer — डाउनलोड लिंक रिटर्न करता है, ईमेल के माध्यम से भेजता है, Slack पर पोस्ट करता है

शुरुआत करें

1. अपनी API Key प्राप्त करें

2slides.com पर साइन अप करें और 2slides.com/api पर API key बनाएं।

2. Dependencies इंस्टॉल करें

npm install node-fetch dotenv

3. बेसिक Agent Implementation

import fetch from 'node-fetch'; class PresentationAgent { constructor(apiKey) { this.apiKey = apiKey; this.baseUrl = 'https://2slides.com/api/v1'; } async generateSlides({ topic, themeId, language = 'en', resolution = '2K' }) { // चरण 1: जनरेशन शुरू करें const response = await fetch(`${this.baseUrl}/slides/generate`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ userInput: topic, themeId, responseLanguage: language, resolution, mode: 'async' }) }); const job = await response.json(); if (!response.ok) throw new Error(job.error || 'Generation failed'); // चरण 2: पूर्ण होने तक Poll करें return await this.waitForCompletion(job.jobId); } async waitForCompletion(jobId, maxWait = 300000) { const start = Date.now(); while (Date.now() - start < maxWait) { const response = await fetch(`${this.baseUrl}/jobs/${jobId}`, { headers: { 'Authorization': `Bearer ${this.apiKey}` } }); const status = await response.json(); if (status.status === 'success') return status; if (status.status === 'failed') throw new Error('Generation failed'); await new Promise(r => setTimeout(r, 3000)); } throw new Error('Generation timed out'); } async generateFromFile({ fileUrl, prompt, themeId }) { const response = await fetch(`${this.baseUrl}/slides/create-pdf-slides`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ fileUrl, userInput: prompt, themeId, mode: 'async' }) }); const job = await response.json(); return await this.waitForCompletion(job.jobId); } async generateWithDesign({ topic, referenceImageUrl, resolution = '2K' }) { const response = await fetch(`${this.baseUrl}/slides/create-like-this`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ userInput: topic, designStyle: { global: { referenceImageUrl } }, resolution, mode: 'async' }) }); const job = await response.json(); return await this.waitForCompletion(job.jobId); } async addNarration({ jobId, mode = 'single', voice = 'Charon' }) { const response = await fetch(`${this.baseUrl}/slides/generate-narration`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ jobId, mode, voice, contentMode: 'concise' }) }); return await response.json(); } } // उपयोग const agent = new PresentationAgent('sk-2slides-xxx'); const result = await agent.generateSlides({ topic: 'Q1 2026 व्यवसाय समीक्षा', themeId: 'mckinsey-theme-id', resolution: '2K' }); console.log('डाउनलोड करें:', result.downloadUrl);

Python Implementation

import requests import time class PresentationAgent: def __init__(self, api_key): self.api_key = api_key self.base_url = 'https://2slides.com/api/v1' self.headers = { 'Authorization': f'Bearer {api_key}', 'Content-Type': 'application/json' } def generate_slides(self, topic, theme_id=None, language='en', resolution='2K'): response = requests.post( f'{self.base_url}/slides/generate', headers=self.headers, json={ 'userInput': topic, 'themeId': theme_id, 'responseLanguage': language, 'resolution': resolution, 'mode': 'async' } ) response.raise_for_status() job = response.json() return self._wait_for_completion(job['jobId']) def generate_from_file(self, file_url, prompt, theme_id=None): response = requests.post( f'{self.base_url}/slides/create-pdf-slides', headers=self.headers, json={ 'fileUrl': file_url, 'userInput': prompt, 'themeId': theme_id, 'mode': 'async' } ) response.raise_for_status() job = response.json() return self._wait_for_completion(job['jobId']) def _wait_for_completion(self, job_id, max_wait=300): start = time.time() while time.time() - start < max_wait: response = requests.get( f'{self.base_url}/jobs/{job_id}', headers=self.headers ) status = response.json() if status['status'] == 'success': return status if status['status'] == 'failed': raise Exception('जनरेशन विफल रहा') time.sleep(3) raise TimeoutError('जनरेशन का समय समाप्त हो गया') # उपयोग agent = PresentationAgent('sk-2slides-xxx') result = agent.generate_slides('AI ट्रेंड्स 2026', resolution='4K') print(f"डाउनलोड करें: {result['downloadUrl']}")

उन्नत पैटर्न

पैटर्न 1: टेम्पलेट-आधारित जनरेशन

विभिन्न उपयोग के मामलों के लिए थीम्स को पूर्व-कॉन्फ़िगर करें:

const TEMPLATES = { 'pitch-deck': { themeId: 'apple-id', resolution: '2K' }, 'quarterly-review': { themeId: 'mckinsey-id', resolution: '2K' }, 'training': { themeId: 'corporate-id', resolution: '1K' }, 'social-media': { themeId: 'saul-bass-id', resolution: '4K', aspectRatio: '1:1' }, }; async function generateByType(type, topic) { const config = TEMPLATES[type]; return agent.generateSlides({ topic, ...config }); }

पैटर्न 2: डेटा पाइपलाइन इंटीग्रेशन

अपने डेटा स्रोतों से कनेक्ट करें:

async function weeklyReport(dataSource) { // 1. नवीनतम डेटा प्राप्त करें const data = await dataSource.getWeeklyMetrics(); // 2. प्रेजेंटेशन इनपुट के रूप में फॉर्मेट करें const topic = `Weekly Report: Revenue $${data.revenue}, Users ${data.users}, Churn ${data.churn}%`; // 3. स्लाइड्स जनरेट करें const result = await agent.generateSlides({ topic, themeId: 'mckinsey-id' }); // 4. डिलीवर करें await slackBot.postMessage('#team-updates', `Weekly report ready: ${result.downloadUrl}`); }

पैटर्न 3: मल्टी-फॉर्मेट आउटपुट

एक पाइपलाइन में स्लाइड्स + नैरेशन + वीडियो जनरेट करें:

async function fullPresentation(topic) { // 1. स्लाइड्स जनरेट करें const slides = await agent.generateSlides({ topic }); // 2. वॉयस नैरेशन जोड़ें await agent.addNarration({ jobId: slides.jobId, mode: 'multi', voice: 'Charon' }); // 3. ऑडियो के साथ डाउनलोड करें const download = await fetch(`${agent.baseUrl}/slides/download-slides-pages-voices`, { method: 'POST', headers: agent.headers, body: JSON.stringify({ jobId: slides.jobId }) }); return download.json(); }

प्रोडक्शन संबंधी विचार

रेट लिमिटिंग

  • डिफ़ॉल्ट: 60 रिक्वेस्ट/मिनट
  • एक्सपोनेंशियल बैकऑफ़ के साथ 429 रिस्पॉन्स को हैंडल करें
  • बैच ऑपरेशन्स के लिए async मोड का उपयोग करें

एरर हैंडलिंग

  • सभी API कॉल्स को try/catch में रैप करें
  • ट्रांज़िएंट फेल्योर के लिए रिट्राई लॉजिक लागू करें
  • डिबगिंग के लिए job IDs को लॉग करें

कॉस्ट मैनेजमेंट

  • प्रति जनरेशन क्रेडिट उपयोग को ट्रैक करें
  • अपने 2Slides डैशबोर्ड में बजट अलर्ट सेट करें
  • आंतरिक/ड्राफ्ट कंटेंट के लिए कम रेज़ोल्यूशन का उपयोग करें

सुरक्षा

  • API keys को एन्वायरनमेंट वेरिएबल्स में स्टोर करें, कभी भी कोड में नहीं
  • केवल सर्वर-साइड API कॉल्स का उपयोग करें — कभी भी क्लाइंट्स को keys एक्सपोज़ न करें
  • webhook callbacks के लिए रिक्वेस्ट साइनिंग लागू करें

अक्सर पूछे जाने वाले प्रश्न

क्या मैं 2Slides API के ऊपर एक SaaS प्रोडक्ट बना सकता हूं?

हां — API प्रोडक्शन उपयोग के लिए डिज़ाइन किया गया है। कमर्शियल एप्लिकेशन्स पर कोई प्रतिबंध नहीं है।

अधिकतम समवर्ती जनरेशन सीमा क्या है?

API रेट लिमिटिंग के माध्यम से समवर्ती रिक्वेस्ट को हैंडल करता है। उच्च-वॉल्यूम आवश्यकताओं के लिए, एंटरप्राइज़ लिमिट के लिए 2Slides टीम से संपर्क करें।

क्या job पूर्ण होने के लिए कोई webhook है?

वर्तमान में, jobs एंडपॉइंट के माध्यम से पोलिंग का उपयोग करें। Webhook समर्थन रोडमैप पर है।


अपना प्रेजेंटेशन एजेंट बनाएं — 2Slides पर अपनी API key प्राप्त करें और प्रोग्रामैटिक रूप से स्लाइड्स जनरेट करना शुरू करें।

About 2Slides

Create stunning AI-powered presentations in seconds. Transform your ideas into professional slides with 2slides AI Agent.

Try For Free