New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@huggingface/inference

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huggingface/inference - npm Package Compare versions

Comparing version 2.7.0 to 2.7.1

26

dist/index.js

@@ -690,8 +690,18 @@ var __defProp = Object.defineProperty;

// src/utils/toArray.ts
function toArray(obj) {
if (Array.isArray(obj)) {
return obj;
}
return [obj];
}
// src/tasks/nlp/textGeneration.ts
async function textGeneration(args, options) {
const res = await request(args, {
...options,
taskHint: "text-generation"
});
const res = toArray(
await request(args, {
...options,
taskHint: "text-generation"
})
);
const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.generated_text === "string");

@@ -712,10 +722,2 @@ if (!isValidOutput) {

// src/utils/toArray.ts
function toArray(obj) {
if (Array.isArray(obj)) {
return obj;
}
return [obj];
}
// src/tasks/nlp/tokenClassification.ts

@@ -722,0 +724,0 @@ async function tokenClassification(args, options) {

{
"name": "@huggingface/inference",
"version": "2.7.0",
"version": "2.7.1",
"packageManager": "pnpm@8.10.5",

@@ -42,3 +42,3 @@ "license": "MIT",

"dependencies": {
"@huggingface/tasks": "^0.10.0"
"@huggingface/tasks": "^0.11.2"
},

@@ -45,0 +45,0 @@ "devDependencies": {

import type { TextGenerationInput, TextGenerationOutput } from "@huggingface/tasks";
import { InferenceOutputError } from "../../lib/InferenceOutputError";
import type { BaseArgs, Options } from "../../types";
import { toArray } from "../../utils/toArray";
import { request } from "../custom/request";

@@ -15,6 +16,8 @@

): Promise<TextGenerationOutput> {
const res = await request<TextGenerationOutput[]>(args, {
...options,
taskHint: "text-generation",
});
const res = toArray(
await request<TextGenerationOutput | TextGenerationOutput[]>(args, {
...options,
taskHint: "text-generation",
})
);
const isValidOutput = Array.isArray(res) && res.every((x) => typeof x?.generated_text === "string");

@@ -21,0 +24,0 @@ if (!isValidOutput) {

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