Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qb-ai-core

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qb-ai-core - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

dist/AIException.js

1

dist/index.d.ts

@@ -0,1 +1,2 @@

import "isomorphic-fetch";
import Settings from './Settings';

@@ -2,0 +3,0 @@ import ChatMessage from './ChatMessage';

165

dist/index.js

@@ -1,148 +0,17 @@

/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(self, function() {
return /******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/AIException.ts":
/*!****************************!*\
!*** ./src/AIException.ts ***!
\****************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AIException: function() { return /* binding */ AIException; }\n/* harmony export */ });\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar AIException = /** @class */ (function (_super) {\n __extends(AIException, _super);\n function AIException(message, code) {\n var _this = _super.call(this, message) || this;\n _this.message = message;\n _this.code = code;\n return _this;\n }\n return AIException;\n}(Error));\n\n\n\n//# sourceURL=webpack://qb-ai-core/./src/AIException.ts?");
/***/ }),
/***/ "./src/AIModel.ts":
/*!************************!*\
!*** ./src/AIModel.ts ***!
\************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AIModel: function() { return /* binding */ AIModel; }\n/* harmony export */ });\nvar AIModel = /** @class */ (function () {\n function AIModel() {\n }\n AIModel.gpt__3_5__turbo = \"gpt-3.5-turbo\";\n AIModel.gpt__3_5__turbo__0613 = \"gpt-3.5-turbo-0613\";\n AIModel.gpt__3_5__turbo__16k = \"gpt-3.5-turbo-16k\";\n AIModel.gpt__3_5__turbo__16k__0613 = \"gpt-3.5-turbo-16k-0613\";\n AIModel.gpt__4 = \"gpt-4\";\n AIModel.gpt__4__0613 = \"gpt-4-0613\";\n AIModel.gpt__4__32k = \"gpt-4-32k\";\n AIModel.gpt__4__32k__0613 = \"gpt-4-32k-0613\";\n return AIModel;\n}());\n\n\n\n//# sourceURL=webpack://qb-ai-core/./src/AIModel.ts?");
/***/ }),
/***/ "./src/ApiVersion.ts":
/*!***************************!*\
!*** ./src/ApiVersion.ts ***!
\***************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ApiVersion: function() { return /* binding */ ApiVersion; }\n/* harmony export */ });\nvar ApiVersion = /** @class */ (function () {\n function ApiVersion() {\n }\n ApiVersion.v1 = \"v1\";\n return ApiVersion;\n}());\n\n\n\n//# sourceURL=webpack://qb-ai-core/./src/ApiVersion.ts?");
/***/ }),
/***/ "./src/QBAICore.ts":
/*!*************************!*\
!*** ./src/QBAICore.ts ***!
\*************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar QBAICore = /** @class */ (function () {\n function QBAICore() {\n }\n QBAICore.sendPromptToProxy = function (apiKey, context, model, temperature, apiEndpoint) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var requestOptions, response, data, outputMessage;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n requestOptions = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'qb-token': apiKey,\n },\n body: JSON.stringify({\n // messages: [...dialogMessages, { role: 'user', content: prompt }],\n messages: context,\n model: model,\n temperature: temperature,\n }),\n };\n return [4 /*yield*/, fetch(apiEndpoint, requestOptions)];\n case 1:\n response = _b.sent();\n return [4 /*yield*/, response.json()];\n case 2:\n data = _b.sent();\n outputMessage = ((_a = data.choices[0].message) === null || _a === void 0 ? void 0 : _a.content) || '';\n return [2 /*return*/, outputMessage];\n }\n });\n });\n };\n QBAICore.sendPromptToOpenai = function (apiKey, context, model, temperature, organization, apiEndpoint) {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var requestOptions, requestOptionsWithOrganization, workOptions, response, data, outputMessage;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n requestOptions = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: \"Bearer \".concat(apiKey),\n },\n body: JSON.stringify({\n messages: context,\n model: model,\n temperature: temperature,\n }),\n };\n requestOptionsWithOrganization = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: \"Bearer \".concat(apiKey),\n 'OpenAI-Organization': \"\".concat(organization),\n },\n body: JSON.stringify({\n messages: context,\n temperature: temperature,\n }),\n };\n workOptions = organization && organization.length > 0\n ? requestOptionsWithOrganization\n : requestOptions;\n return [4 /*yield*/, fetch(apiEndpoint, workOptions)];\n case 1:\n response = _b.sent();\n return [4 /*yield*/, response.json()];\n case 2:\n data = _b.sent();\n outputMessage = ((_a = data.choices[0].message) === null || _a === void 0 ? void 0 : _a.content) || '';\n return [2 /*return*/, outputMessage];\n }\n });\n });\n };\n return QBAICore;\n}());\n/* harmony default export */ __webpack_exports__[\"default\"] = (QBAICore);\n\n\n//# sourceURL=webpack://qb-ai-core/./src/QBAICore.ts?");
/***/ }),
/***/ "./src/Role.ts":
/*!*********************!*\
!*** ./src/Role.ts ***!
\*********************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Role: function() { return /* binding */ Role; }\n/* harmony export */ });\nvar Role = /** @class */ (function () {\n function Role() {\n }\n Role.me = \"me\";\n Role.other = \"other\";\n return Role;\n}());\n\n;\n\n\n//# sourceURL=webpack://qb-ai-core/./src/Role.ts?");
/***/ }),
/***/ "./src/index.ts":
/*!**********************!*\
!*** ./src/index.ts ***!
\**********************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ AIException: function() { return /* reexport safe */ _AIException__WEBPACK_IMPORTED_MODULE_3__.AIException; },\n/* harmony export */ AIModel: function() { return /* reexport safe */ _AIModel__WEBPACK_IMPORTED_MODULE_0__.AIModel; },\n/* harmony export */ ApiVersion: function() { return /* reexport safe */ _ApiVersion__WEBPACK_IMPORTED_MODULE_1__.ApiVersion; },\n/* harmony export */ QBAICore: function() { return /* reexport safe */ _QBAICore__WEBPACK_IMPORTED_MODULE_4__[\"default\"]; },\n/* harmony export */ Role: function() { return /* reexport safe */ _Role__WEBPACK_IMPORTED_MODULE_2__.Role; }\n/* harmony export */ });\n/* harmony import */ var _AIModel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AIModel */ \"./src/AIModel.ts\");\n/* harmony import */ var _ApiVersion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ApiVersion */ \"./src/ApiVersion.ts\");\n/* harmony import */ var _Role__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Role */ \"./src/Role.ts\");\n/* harmony import */ var _AIException__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./AIException */ \"./src/AIException.ts\");\n/* harmony import */ var _QBAICore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./QBAICore */ \"./src/QBAICore.ts\");\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://qb-ai-core/./src/index.ts?");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ !function() {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = function(exports, definition) {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ }();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ !function() {
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ }();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ }();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
/******/
/******/ return __webpack_exports__;
/******/ })()
;
});
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.QBAICore = exports.AIModel = exports.AIException = exports.ApiVersion = exports.Role = void 0;
require("isomorphic-fetch");
var AIModel_1 = require("./AIModel");
Object.defineProperty(exports, "AIModel", { enumerable: true, get: function () { return AIModel_1.AIModel; } });
var ApiVersion_1 = require("./ApiVersion");
Object.defineProperty(exports, "ApiVersion", { enumerable: true, get: function () { return ApiVersion_1.ApiVersion; } });
var Role_1 = require("./Role");
Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return Role_1.Role; } });
var AIException_1 = require("./AIException");
Object.defineProperty(exports, "AIException", { enumerable: true, get: function () { return AIException_1.AIException; } });
var QBAICore_1 = __importDefault(require("./QBAICore"));
exports.QBAICore = QBAICore_1.default;
Copyright © 2023 QuickBlox
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{
"name": "qb-ai-core",
"version": "0.1.0",
"version": "0.1.1",
"description": "AI Core library for Quickblox AI Features",

@@ -8,6 +8,9 @@ "main": "dist/index.js",

"dependencies": {
"@types/node": "^16.18.6",
"typescript": "^4.9.3"
"isomorphic-fetch": "^3.0.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.6",
"@typescript-eslint/eslint-plugin-tslint": "^5.45.1",

@@ -28,6 +31,2 @@ "@typescript-eslint/parser": "^5.45.1",

"prettier": "^2.8.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.6",
"ts-loader": "^9.4.2",

@@ -40,3 +39,3 @@ "typedoc": "^0.23.22",

"scripts": {
"build": "webpack",
"build": "tsc",
"lint": "eslint ./src"

@@ -43,0 +42,0 @@ },

@@ -0,1 +1,2 @@

import "isomorphic-fetch";
import Settings from './Settings';

@@ -2,0 +3,0 @@ import ChatMessage from './ChatMessage';

{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"outDir": "./dist",
"declaration": true,

@@ -20,13 +19,11 @@ "target": "es5",

"noFallthroughCasesInSwitch": true,
"module": "esnext",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
},
"include": [
"src",
"src/**/*",
],
"exclude": ["node_modules", "dist"]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc