AI
The AI Adapter provides a flexible interface for integrating AI models into the application, supporting OpenAI, Gemini and Claude.
How It Works:
Set up API key: Ensure
AI_API_KEYis configured in the.envvariables.Choose AI provider: Define whether OpenAI or Claude is used in the app config.
Call AI functions:
generateResponse- standard function to get the entire AI response at once.streamResponse- streaming function to receive incremental responses dynamically.generateImage- generate 1024x1024 image and provides an URLestimateTokens- returns estimate tokens countsummarizeText- summarizes given textmoderateContent- returns boolean whether the content is flagged as inappropriate
This adapter simplifies AI integration, making it easy to incorporate intelligent responses and conversational AI into your application.
Last updated