randydev commited on
Commit
52a9b55
·
verified ·
1 Parent(s): f836f2f

Update routes/googleGemini.js

Browse files
Files changed (1) hide show
  1. routes/googleGemini.js +44 -2
routes/googleGemini.js CHANGED
@@ -31,10 +31,52 @@ async function GeminiResponse(prompt, setModel) {
31
  * name: Gemini
32
  * description: Artificial intelligence endpoint to interact with AI, like chatting.
33
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  GeminiRoutes.get("/api/v1/google-gemini", async (req, res) => {
35
  try {
36
  const query = req.query.query;
37
- const setmodel = req.query.setmodel || "gemini-1.5-flash"
38
  const results = await GeminiResponse(query, setmodel);
39
  res.json({ message: results });
40
  } catch (e) {
@@ -42,4 +84,4 @@ GeminiRoutes.get("/api/v1/google-gemini", async (req, res) => {
42
  }
43
  });
44
 
45
- export { GeminiRoutes };
 
31
  * name: Gemini
32
  * description: Artificial intelligence endpoint to interact with AI, like chatting.
33
  */
34
+
35
+ /**
36
+ * @swagger
37
+ * /api/v1/google-gemini:
38
+ * get:
39
+ * summary: Get a response from Google Gemini API
40
+ * description: This endpoint interacts with the Google Gemini API to fetch a response based on the query and model.
41
+ * parameters:
42
+ * - in: query
43
+ * name: query
44
+ * required: true
45
+ * description: The query to be processed by the Google Gemini API.
46
+ * schema:
47
+ * type: string
48
+ * - in: query
49
+ * name: setmodel
50
+ * required: false
51
+ * description: The model version to use (default is "gemini-1.5-flash").
52
+ * schema:
53
+ * type: string
54
+ * responses:
55
+ * 200:
56
+ * description: A successful response containing the API result.
57
+ * content:
58
+ * application/json:
59
+ * schema:
60
+ * type: object
61
+ * properties:
62
+ * message:
63
+ * type: string
64
+ * description: The result from the Gemini API.
65
+ * 500:
66
+ * description: Internal server error.
67
+ * content:
68
+ * application/json:
69
+ * schema:
70
+ * type: object
71
+ * properties:
72
+ * error:
73
+ * type: string
74
+ * description: Error message.
75
+ */
76
  GeminiRoutes.get("/api/v1/google-gemini", async (req, res) => {
77
  try {
78
  const query = req.query.query;
79
+ const setmodel = req.query.setmodel || "gemini-1.5-flash";
80
  const results = await GeminiResponse(query, setmodel);
81
  res.json({ message: results });
82
  } catch (e) {
 
84
  }
85
  });
86
 
87
+ export { GeminiRoutes };