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

qb-ai-core

Package Overview
Dependencies
Maintainers
2
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.1 to 0.1.2

1

dist/index.d.ts

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

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

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

@@ -7,3 +7,2 @@ "use strict";

exports.QBAICore = exports.AIModel = exports.AIException = exports.ApiVersion = exports.Role = void 0;
require("isomorphic-fetch");
var AIModel_1 = require("./AIModel");

@@ -10,0 +9,0 @@ Object.defineProperty(exports, "AIModel", { enumerable: true, get: function () { return AIModel_1.AIModel; } });

20

dist/QBAICore.js

@@ -38,3 +38,7 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var node_fetch_1 = __importDefault(require("node-fetch"));
var QBAICore = /** @class */ (function () {

@@ -44,7 +48,7 @@ function QBAICore() {

QBAICore.sendPromptToProxy = function (apiKey, context, model, temperature, apiEndpoint) {
var _a;
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var requestOptions, response, data, outputMessage;
return __generator(this, function (_b) {
switch (_b.label) {
return __generator(this, function (_d) {
switch (_d.label) {
case 0:

@@ -64,9 +68,9 @@ requestOptions = {

};
return [4 /*yield*/, fetch(apiEndpoint, requestOptions)];
return [4 /*yield*/, (0, node_fetch_1.default)(apiEndpoint, requestOptions)];
case 1:
response = _b.sent();
response = _d.sent();
return [4 /*yield*/, response.json()];
case 2:
data = _b.sent();
outputMessage = ((_a = data.choices[0].message) === null || _a === void 0 ? void 0 : _a.content) || '';
data = _d.sent();
outputMessage = ((_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.choices) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.content) || '';
return [2 /*return*/, outputMessage];

@@ -111,3 +115,3 @@ }

: requestOptions;
return [4 /*yield*/, fetch(apiEndpoint, workOptions)];
return [4 /*yield*/, (0, node_fetch_1.default)(apiEndpoint, workOptions)];
case 1:

@@ -114,0 +118,0 @@ response = _b.sent();

{
"name": "qb-ai-core",
"version": "0.1.1",
"version": "0.1.2",
"description": "AI Core library for Quickblox AI Features",

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

"dependencies": {
"isomorphic-fetch": "^3.0.0"
"node-fetch": "^2.7.0"
},

@@ -16,2 +16,3 @@ "devDependencies": {

"@types/node": "^16.18.6",
"@types/node-fetch": "^2.6.9",
"@typescript-eslint/eslint-plugin-tslint": "^5.45.1",

@@ -18,0 +19,0 @@ "@typescript-eslint/parser": "^5.45.1",

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

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

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

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

import fetch from 'node-fetch'
import ChatMessage from './ChatMessage';

@@ -33,5 +34,4 @@

const data = await response.json();
const outputMessage = data?.choices?.[0]?.message?.content || '';
const outputMessage = data.choices[0].message?.content || '';
return outputMessage;

@@ -38,0 +38,0 @@ }

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