1
- import { ICommonObject , INode , INodeData , INodeParams } from '../../../src/Interface' ;
2
- import { RetrievalQAChain } from 'langchain/chains' ;
3
- import { getBaseClasses } from '../../../src/utils' ;
4
- import { ConsoleCallbackHandler , additionalCallbacks } from '../../../src/handler' ;
1
+ import { ICommonObject , INode , INodeData , INodeParams } from '../../../src/Interface'
2
+ import { RetrievalQAChain } from 'langchain/chains'
3
+ import { getBaseClasses } from '../../../src/utils'
4
+ import { ConsoleCallbackHandler , additionalCallbacks } from '../../../src/handler'
5
5
6
6
class ImageConversationChain_Chains implements INode {
7
- label : string ;
8
- name : string ;
9
- version : number ;
10
- type : string ;
11
- icon : string ;
12
- category : string ;
13
- baseClasses : string [ ] ;
14
- description : string ;
15
- inputs : INodeParams [ ] ;
7
+ label : string
8
+ name : string
9
+ version : number
10
+ type : string
11
+ icon : string
12
+ category : string
13
+ baseClasses : string [ ]
14
+ description : string
15
+ inputs : INodeParams [ ]
16
16
17
17
constructor ( ) {
18
- this . label = 'Image Conversation Chain' ;
19
- this . name = 'imageConversationChain' ;
20
- this . version = 1.0 ;
21
- this . type = 'ImageConversationChain' ;
22
- this . icon = 'image.png' ;
23
- this . category = 'Chains' ;
24
- this . description = 'QA chain to answer a question based on the retrieved images' ;
25
- this . baseClasses = [ this . type , ...getBaseClasses ( RetrievalQAChain ) ] ;
18
+ this . label = 'Image Conversation Chain'
19
+ this . name = 'imageConversationChain'
20
+ this . version = 1.0
21
+ this . type = 'ImageConversationChain'
22
+ this . icon = 'image.png'
23
+ this . category = 'Chains'
24
+ this . description = 'QA chain to answer a question based on the retrieved images'
25
+ this . baseClasses = [ this . type , ...getBaseClasses ( RetrievalQAChain ) ]
26
26
this . inputs = [
27
27
{
28
28
label : 'Image Description' ,
29
29
name : 'imageDescription' ,
30
30
type : 'description'
31
31
}
32
- ] ;
32
+ ]
33
33
}
34
34
35
35
async init ( nodeData : INodeData ) : Promise < any > {
@@ -38,15 +38,15 @@ class ImageConversationChain_Chains implements INode {
38
38
}
39
39
40
40
async run ( nodeData : INodeData , input : string , options : ICommonObject ) : Promise < string > {
41
- const imageDescription = nodeData . inputs ?. imageDescription as string ;
42
- const loggerHandler = new ConsoleCallbackHandler ( options . logger ) ;
43
- const callbacks = await additionalCallbacks ( nodeData , options ) ;
41
+ const imageDescription = nodeData . inputs ?. imageDescription as string
42
+ const loggerHandler = new ConsoleCallbackHandler ( options . logger )
43
+ const callbacks = await additionalCallbacks ( nodeData , options )
44
44
45
45
// TODO: Any logic or operations you want to do with the image description can go here
46
46
// For now, it simply returns the description
47
47
48
- return imageDescription ;
48
+ return imageDescription
49
49
}
50
50
}
51
51
52
- module . exports = { nodeClass : ImageConversationChain_Chains } ;
52
+ module . exports = { nodeClass : ImageConversationChain_Chains }
0 commit comments