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

@memberjunction/ai-gemini

Package Overview
Dependencies
Maintainers
4
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@memberjunction/ai-gemini - npm Package Compare versions

Comparing version 0.9.18 to 0.9.19

2

dist/index.d.ts

@@ -6,3 +6,3 @@ import { InputContent } from "@google/generative-ai";

constructor(apiKey: string);
protected geminiMessageSpacing(messages: ChatMessage[]): ChatMessage[];
protected geminiMessageSpacing(messages: InputContent[]): InputContent[];
ChatCompletion(params: ChatParams): Promise<ChatResult>;

@@ -9,0 +9,0 @@ SummarizeText(params: SummarizeParams): Promise<SummarizeResult>;

@@ -27,9 +27,9 @@ "use strict";

const result = [];
let lastRole = "assistant";
let lastRole = "model";
for (let i = 0; i < messages.length; i++) {
if (messages[i].role === lastRole) {
result.push({
role: "assistant", // we are using the ChatMessage type from the MJ package, so we need to use the role "assistant" instead of "model"
role: "model", // we are using the ChatMessage type from the MJ package, so we need to use the role "assistant" instead of "model"
// later on the role will be converted to "model" in the MapMJMessageToGeminiHistoryEntry method
content: "OK"
parts: "OK"
});

@@ -50,6 +50,6 @@ }

const model = GeminiLLM_1._gemini.getGenerativeModel({ model: params.model || "gemini-pro", generationConfig: config });
const allMessagesButLast = params.messages; //.slice(0, -1);
const tempMessages = this.geminiMessageSpacing(allMessagesButLast);
const convertedMessages = params.messages.map(m => GeminiLLM_1.MapMJMessageToGeminiHistoryEntry(m));
const tempMessages = this.geminiMessageSpacing(convertedMessages);
const chat = model.startChat({
history: tempMessages.map(m => GeminiLLM_1.MapMJMessageToGeminiHistoryEntry(m))
history: tempMessages
});

@@ -56,0 +56,0 @@ const latestMessage = params.messages[params.messages.length - 1].content;

{
"name": "@memberjunction/ai-gemini",
"version": "0.9.18",
"version": "0.9.19",
"description": "MemberJunction Wrapper for Google Gemini AI Models",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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