Update plugins/gptold.js
Browse files- plugins/gptold.js +34 -0
plugins/gptold.js
CHANGED
@@ -1,9 +1,43 @@
|
|
1 |
import express from 'express';
|
2 |
import { OpenaiRes } from '../lib/scrapper.js';
|
3 |
import { NvidiaTogether } from '../lib/@randydev/together/llama.js';
|
|
|
4 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
5 |
const GptRoutes = express.Router();
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
/**
|
8 |
* @swagger
|
9 |
* /api/v1/ai/nvidia/llama-31-70b:
|
|
|
1 |
import express from 'express';
|
2 |
import { OpenaiRes } from '../lib/scrapper.js';
|
3 |
import { NvidiaTogether } from '../lib/@randydev/together/llama.js';
|
4 |
+
import { CohereAI } from '../lib/@randydev/together/cohere.js';
|
5 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
6 |
const GptRoutes = express.Router();
|
7 |
|
8 |
+
/**
|
9 |
+
* @swagger
|
10 |
+
* /api/v1/ai/command-r+:
|
11 |
+
* get:
|
12 |
+
* summary: Cohere AI
|
13 |
+
* tags: [AI]
|
14 |
+
* parameters:
|
15 |
+
* - in: query
|
16 |
+
* name: query
|
17 |
+
* required: true
|
18 |
+
* description: null
|
19 |
+
* schema:
|
20 |
+
* type: string
|
21 |
+
* - in: header
|
22 |
+
* name: x-api-key
|
23 |
+
* required: true
|
24 |
+
* description: API key for authentication
|
25 |
+
* schema:
|
26 |
+
* type: string
|
27 |
+
* responses:
|
28 |
+
* 200:
|
29 |
+
* description: Success
|
30 |
+
*/
|
31 |
+
GptRoutes.get('/api/v1/ai/cohere/command-r+', authenticateApiKey, apiLimiter, async (req, res) => {
|
32 |
+
try {
|
33 |
+
const query = req.query.query;
|
34 |
+
const results = await CohereAI(query);
|
35 |
+
res.json({ results });
|
36 |
+
} catch (error) {
|
37 |
+
res.status(401).json({ error: error.message });
|
38 |
+
}
|
39 |
+
});
|
40 |
+
|
41 |
/**
|
42 |
* @swagger
|
43 |
* /api/v1/ai/nvidia/llama-31-70b:
|