fix: llm blu confidence

This commit is contained in:
hexastack
2025-04-24 17:02:26 +01:00
parent 5b2bfd0f46
commit 6229d5e0e0
2 changed files with 13 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Hexastack. All rights reserved.
* Copyright © 2025 Hexastack. All rights reserved.
*
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
@@ -168,7 +168,7 @@ export default class LlmNluHelper
traits.push({
entity: name,
value,
confidence: 100,
confidence: 1,
});
}

View File

@@ -6,6 +6,8 @@
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
*/
import { z } from 'zod';
import { SettingCreateDto } from '@/setting/dto/setting.dto';
import { HyphenToUnderscore } from '@/utils/types/extension';
@@ -15,13 +17,15 @@ import BaseNlpHelper from './lib/base-nlp-helper';
import BaseStorageHelper from './lib/base-storage-helper';
export namespace NLU {
export interface ParseEntity {
entity: string; // Entity name
value: string; // Value name
confidence: number;
start?: number;
end?: number;
}
const ParseEntitySchema = z.object({
entity: z.string(),
value: z.string(),
confidence: z.number().min(0).max(1),
start: z.number().optional(),
end: z.number().optional(),
});
export type ParseEntity = z.infer<typeof ParseEntitySchema>;
export interface ParseEntities {
entities: ParseEntity[];