an API to transform blog posts into soclal media format
The index.ts file located in the functions/src/application/ path is responsible for setting up the Express application and defining several API endpoints to handle different requests. Below is a summary of its main functionalities:
-
Initialization and Setup:
- Utilizes
expressto create a new application instance. - Initializes Firebase application and Vertex AI service using
firebase/appandfirebase/vertexai. - Retrieves environment configuration from
../config.
- Utilizes
-
API Endpoints:
GET /: Responds with a simple message "Hello from GDG Taipei".POST /generateSocialMediaContent: Accepts an article and usesGenerateSocialMediaContentUseCaseto generate social media content.POST /translateSocialMediaContent: Accepts a title and description, usingTranslateSocialMediaContentUseCaseto translate social media content.POST /generateTags: Accepts an article and usesGenerateTagsUseCaseto generate tags.POST /generateSummary: Accepts an article and usesGenerateSummaryUseCaseto generate a summary.
-
Model Usage:
- Implements
LLMModelImplementas the language model, which operates based on the Vertex AI service. - Reference here for model support: https://firebase.google.com/docs/vertex-ai/models?hl=zh&authuser=0
- Implements
These functionalities collectively form an API capable of transforming blog posts into social media formats, providing translation, tag generation, and summary generation features.