mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
ResponsibleAI - Input Moderation - Renaming of files for better clarity and alignment to functionality
This commit is contained in:
@@ -7,7 +7,7 @@ import { BaseOutputParser } from 'langchain/schema/output_parser'
|
||||
import { formatResponse, injectOutputParser } from '../../outputparsers/OutputParserHelpers'
|
||||
import { BaseLLMOutputParser } from 'langchain/schema/output_parser'
|
||||
import { OutputFixingParser } from 'langchain/output_parsers'
|
||||
import { checkInputs, Moderation, streamResponse } from '../../responsibleAI/ResponsibleAI'
|
||||
import { checkInputs, Moderation, streamResponse } from '../../moderation/Moderation'
|
||||
|
||||
class LLMChain_Chains implements INode {
|
||||
label: string
|
||||
|
||||
+1
-3
@@ -1,9 +1,7 @@
|
||||
import { BaseLanguageModel } from 'langchain/base_language'
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
export abstract class ResponsibleAI {}
|
||||
|
||||
export abstract class Moderation extends ResponsibleAI {
|
||||
export abstract class Moderation {
|
||||
abstract checkForViolations(llm: BaseLanguageModel, input: string): Promise<string>
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src'
|
||||
import { Moderation } from '../ResponsibleAI'
|
||||
import { Moderation } from '../Moderation'
|
||||
import { OpenAIModerationRunner } from './OpenAIModerationRunner'
|
||||
|
||||
class OpenAIModeration implements INode {
|
||||
@@ -20,7 +20,7 @@ class OpenAIModeration implements INode {
|
||||
this.version = 1.0
|
||||
this.type = 'Moderation'
|
||||
this.icon = 'openai-moderation.png'
|
||||
this.category = 'Responsible AI'
|
||||
this.category = 'Moderation'
|
||||
this.description = 'Check whether content complies with OpenAI usage policies.'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(Moderation)]
|
||||
this.inputs = [
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Moderation } from '../ResponsibleAI'
|
||||
import { Moderation } from '../Moderation'
|
||||
import { BaseLanguageModel } from 'langchain/base_language'
|
||||
import { OpenAIModerationChain } from 'langchain/chains'
|
||||
|
||||
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src'
|
||||
import { Moderation } from '../ResponsibleAI'
|
||||
import { Moderation } from '../Moderation'
|
||||
import { SimplePromptModerationRunner } from './SimplePromptModerationRunner'
|
||||
|
||||
class SimplePromptModeration implements INode {
|
||||
@@ -20,7 +20,7 @@ class SimplePromptModeration implements INode {
|
||||
this.version = 1.0
|
||||
this.type = 'Moderation'
|
||||
this.icon = 'simple_moderation.png'
|
||||
this.category = 'Responsible AI'
|
||||
this.category = 'Moderation'
|
||||
this.description = 'Check whether input consists of any text from Deny list, and prevent being sent to LLM'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(Moderation)]
|
||||
this.inputs = [
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Moderation } from '../ResponsibleAI'
|
||||
import { Moderation } from '../Moderation'
|
||||
import { BaseLanguageModel } from 'langchain/base_language'
|
||||
|
||||
export class SimplePromptModerationRunner implements Moderation {
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Reference in New Issue
Block a user