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

@langchain/google-common

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@langchain/google-common - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

1

dist/utils/common.js

@@ -10,2 +10,3 @@ import { isModelGemini, validateGeminiParams } from "./gemini.js";

model ?? options?.modelName ?? params?.modelName ?? target.modelName;
ret.model = model;
ret.temperature =

@@ -12,0 +13,0 @@ options?.temperature ?? params?.temperature ?? target.temperature;

@@ -5,2 +5,11 @@ import { v4 as uuidv4 } from "uuid";

import { GoogleAISafetyError } from "./safety.js";
const extractMimeType = (str) => {
if (str.startsWith("data:")) {
return {
mimeType: str.split(":")[1].split(";")[0],
data: str.split(",")[1],
};
}
return null;
};
function messageContentText(content) {

@@ -23,8 +32,6 @@ if (content?.text && content?.text.length > 0) {

}
if (url.startsWith("data:")) {
const mineTypeAndData = extractMimeType(url);
if (mineTypeAndData) {
return {
inlineData: {
mimeType: url.split(":")[1].split(";")[0],
data: url.split(",")[1],
},
inlineData: mineTypeAndData,
};

@@ -42,2 +49,23 @@ }

}
function messageContentMedia(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
content) {
if ("mimeType" in content && "data" in content) {
return {
inlineData: {
mimeType: content.mimeType,
data: content.data,
},
};
}
else if ("mimeType" in content && "fileUri" in content) {
return {
fileData: {
mimeType: content.mimeType,
fileUri: content.fileUri,
},
};
}
throw new Error("Invalid media content");
}
export function messageContentToParts(content) {

@@ -68,2 +96,4 @@ // Convert a string to a text type MessageContent if needed

break;
case "media":
return messageContentMedia(content);
default:

@@ -70,0 +100,0 @@ throw new Error(`Unsupported type received while converting message to message parts`);

2

package.json
{
"name": "@langchain/google-common",
"version": "0.0.5",
"version": "0.0.6",
"description": "Core types and classes for Google services.",

@@ -5,0 +5,0 @@ "type": "module",

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