@huggingface/inference 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/tasks/nlp/conversational.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -579,7 +579,7 @@ async function zeroShotImageClassification(args, options) {
|
|
|
579
579
|
// src/tasks/nlp/conversational.ts
|
|
580
580
|
async function conversational(args, options) {
|
|
581
581
|
const res = await request(args, { ...options, taskHint: "conversational" });
|
|
582
|
-
const isValidOutput = Array.isArray(res.conversation.generated_responses) && res.conversation.generated_responses.every((x) => typeof x === "string") && Array.isArray(res.conversation.past_user_inputs) && res.conversation.past_user_inputs.every((x) => typeof x === "string") && typeof res.generated_text === "string" && Array.isArray(res.warnings) && res.warnings.every((x) => typeof x === "string");
|
|
582
|
+
const isValidOutput = Array.isArray(res.conversation.generated_responses) && res.conversation.generated_responses.every((x) => typeof x === "string") && Array.isArray(res.conversation.past_user_inputs) && res.conversation.past_user_inputs.every((x) => typeof x === "string") && typeof res.generated_text === "string" && (typeof res.warnings === "undefined" || Array.isArray(res.warnings) && res.warnings.every((x) => typeof x === "string"));
|
|
583
583
|
if (!isValidOutput) {
|
|
584
584
|
throw new InferenceOutputError(
|
|
585
585
|
"Expected {conversation: {generated_responses: string[], past_user_inputs: string[]}, generated_text: string, warnings: string[]}"
|
package/dist/index.mjs
CHANGED
|
@@ -527,7 +527,7 @@ async function zeroShotImageClassification(args, options) {
|
|
|
527
527
|
// src/tasks/nlp/conversational.ts
|
|
528
528
|
async function conversational(args, options) {
|
|
529
529
|
const res = await request(args, { ...options, taskHint: "conversational" });
|
|
530
|
-
const isValidOutput = Array.isArray(res.conversation.generated_responses) && res.conversation.generated_responses.every((x) => typeof x === "string") && Array.isArray(res.conversation.past_user_inputs) && res.conversation.past_user_inputs.every((x) => typeof x === "string") && typeof res.generated_text === "string" && Array.isArray(res.warnings) && res.warnings.every((x) => typeof x === "string");
|
|
530
|
+
const isValidOutput = Array.isArray(res.conversation.generated_responses) && res.conversation.generated_responses.every((x) => typeof x === "string") && Array.isArray(res.conversation.past_user_inputs) && res.conversation.past_user_inputs.every((x) => typeof x === "string") && typeof res.generated_text === "string" && (typeof res.warnings === "undefined" || Array.isArray(res.warnings) && res.warnings.every((x) => typeof x === "string"));
|
|
531
531
|
if (!isValidOutput) {
|
|
532
532
|
throw new InferenceOutputError(
|
|
533
533
|
"Expected {conversation: {generated_responses: string[], past_user_inputs: string[]}, generated_text: string, warnings: string[]}"
|
package/package.json
CHANGED
|
@@ -70,8 +70,8 @@ export async function conversational(args: ConversationalArgs, options?: Options
|
|
|
70
70
|
Array.isArray(res.conversation.past_user_inputs) &&
|
|
71
71
|
res.conversation.past_user_inputs.every((x) => typeof x === "string") &&
|
|
72
72
|
typeof res.generated_text === "string" &&
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
(typeof res.warnings === "undefined" ||
|
|
74
|
+
(Array.isArray(res.warnings) && res.warnings.every((x) => typeof x === "string")));
|
|
75
75
|
if (!isValidOutput) {
|
|
76
76
|
throw new InferenceOutputError(
|
|
77
77
|
"Expected {conversation: {generated_responses: string[], past_user_inputs: string[]}, generated_text: string, warnings: string[]}"
|