🤖 AI Integration
Add AI-powered features to your app. Chatbots, content generation, smart personalization — all with one line of code.
Overview
Gammal Tech AI provides access to powerful language models through a simple SDK. No API keys to manage, no usage tracking to implement — just call the methods and build amazing features.
No API Keys
Included with your Gammal Tech plan
Fast Responses
Optimized for low latency
Conversational
Maintains chat context
Customizable
System prompts & parameters
Quick Start
// Simple question/answer
const response = await GammalTech.ai.ask('What is the capital of France?');
console.log(response); // "The capital of France is Paris."
// Generate content
const description = await GammalTech.ai.ask('Write a product description for wireless earbuds');
// With conversation context (requires login)
const token = GammalTech.getToken();
const reply = await GammalTech.ai.chat(token, 'Tell me more about that');
Methods
Single-turn AI completion. Perfect for one-off questions, content generation, and transformations. No conversation history maintained.
| Parameter | Type | Description |
|---|---|---|
message |
string |
The prompt or question to send to the AI |
options.system |
string |
Optional system prompt to set AI behavior |
options.maxTokens |
number |
Maximum response length (default: 1000) |
// Simple question
const answer = await GammalTech.ai.ask('Explain quantum computing in simple terms');
// With system prompt
const poem = await GammalTech.ai.ask('Write about the ocean', {
system: 'You are a poet who writes in haiku format.'
});
// Content transformation
const summary = await GammalTech.ai.ask(
`Summarize this article in 3 bullet points: ${articleText}`
);
// Translation
const arabic = await GammalTech.ai.ask(
`Translate to Arabic: ${englishText}`
);
Multi-turn conversation with maintained context. The AI remembers previous messages in the session. Requires user authentication.
| Parameter | Type | Description |
|---|---|---|
token |
string |
User's auth token from GammalTech.getToken() |
message |
string |
The user's message |
options.system |
string |
System prompt (set once, persists in conversation) |
options.reset |
boolean |
Clear conversation history and start fresh |
const token = GammalTech.getToken();
// Start conversation with system prompt
let reply = await GammalTech.ai.chat(token, 'Hi! I need help planning a trip.', {
system: 'You are a helpful travel assistant.'
});
console.log(reply); // "Hello! I'd love to help you plan..."
// Continue conversation (context maintained)
reply = await GammalTech.ai.chat(token, 'I want to visit Japan in spring.');
console.log(reply); // "Spring in Japan is beautiful! The cherry..."
// AI remembers context
reply = await GammalTech.ai.chat(token, 'What should I pack?');
console.log(reply); // "For your spring trip to Japan, I recommend..."
// Reset conversation
reply = await GammalTech.ai.chat(token, 'New topic!', { reset: true });
What Can You Build?
Customer Support Bot
Answer FAQs, help users navigate your app, provide 24/7 support without human agents.
Build a Chatbot →Content Generator
Generate product descriptions, blog posts, social media content, emails.
Content Generator →Smart Personalization
Personalized recommendations, dynamic content, intelligent search.
Personalization →System Prompts
System prompts define the AI's personality, knowledge, and behavior. They're powerful tools for customizing responses.
// E-commerce assistant
const shopAssistant = {
system: `You are a shopping assistant for TechStore.
- Be friendly and helpful
- Recommend products based on user needs
- Always mention our 30-day return policy
- Prices are in EGP`
};
await GammalTech.ai.ask('I need a laptop for video editing', shopAssistant);
// Code reviewer
const codeReviewer = {
system: `You are a senior code reviewer.
- Focus on security issues first
- Suggest performance improvements
- Be constructive, not critical
- Provide code examples for fixes`
};
await GammalTech.ai.ask(`Review this code: ${userCode}`, codeReviewer);
// Language tutor
const arabicTutor = {
system: `You are an Arabic language tutor.
- Respond in both Arabic and English
- Correct mistakes gently
- Explain grammar rules when relevant
- Use Modern Standard Arabic`
};
await GammalTech.ai.chat(token, 'How do I say "good morning"?', arabicTutor);
• Be specific about the AI's role and personality
• Include any constraints or rules
• Mention the format you want responses in
• Keep it concise but comprehensive
Usage & Limits
AI usage is included with your Gammal Tech plan. There are fair usage limits to prevent abuse. For high-volume applications, contact us for enterprise plans.
| Limit | Value |
|---|---|
| Max input length | 4,000 characters |
| Max output tokens | 2,000 tokens (~1,500 words) |
| Conversation history | Last 10 messages retained |
| Rate limit | 60 requests/minute per user |
Related Documentation
AI Prompt for Vibe Coding
AI IntegrationCopy this prompt for help with AI integration: