# KBService | botserver

### Hierarchy

- KBService

## Index

### Constructors

- constructor

### Properties

- sequelize

### Methods

- addAnswer
- ask
- deployKb
- getAnswerById
- getAnswerByText
- getFaqBySubjectArray
- getSearchSchema
- getSubjectItems
- importKbPackage
- importKbTabularDirectory
- importKbTabularFile
- importSubjectFile
- sendAnswer
- undeployKbFromStorage
- getFormattedSubjectItems
- getSubjectItemsSeparatedBySpaces

## Constructors

### constructor

- new KBService(sequelize: Sequelize): KBService

- - Defined in deploy/kb.gbapp/services/KBService.ts:60

  #### Parameters

  - ##### sequelize: Sequelize

  #### Returns KBService

## Properties

### sequelize

sequelize: Sequelize

- Defined in deploy/kb.gbapp/services/KBService.ts:60

## Methods

### addAnswer

- addAnswer(obj: GuaribasAnswer ): Promise< GuaribasAnswer >

- - Defined in deploy/kb.gbapp/services/KBService.ts:111

  #### Parameters

  - ##### obj: GuaribasAnswer

  #### Returns Promise< GuaribasAnswer >

### ask

- ask(instance: IGBInstance, query: string, searchScore: number, subjects: GuaribasSubject []): Promise< KBServiceSearchResults >

- - Defined in deploy/kb.gbapp/services/KBService.ts:122

  #### Parameters

  - ##### instance: IGBInstance

  - ##### query: string

  - ##### searchScore: number

  - ##### subjects: GuaribasSubject []

  #### Returns Promise< KBServiceSearchResults >

### deployKb

- deployKb(core: IGBCoreService, deployer: GBDeployer, localPath: string): Promise<void>

- - Defined in deploy/kb.gbapp/services/KBService.ts:597

  Deploys a knowledge base to the storage using the .gbkb format.

  #### Parameters

  - ##### core: IGBCoreService

  - ##### deployer: GBDeployer

  - ##### localPath: string

    Path to the .gbkb folder.

  #### Returns Promise<void>

### getAnswerById

- getAnswerById(instanceId: number, answerId: number): Promise< GuaribasAnswer >

- - Defined in deploy/kb.gbapp/services/KBService.ts:66

  #### Parameters

  - ##### instanceId: number

  - ##### answerId: number

  #### Returns Promise< GuaribasAnswer >

### getAnswerByText

- getAnswerByText(instanceId: number, text: string): Promise<any>

- - Defined in deploy/kb.gbapp/services/KBService.ts:85

  #### Parameters

  - ##### instanceId: number

  - ##### text: string

  #### Returns Promise<any>

### getFaqBySubjectArray

- getFaqBySubjectArray(from: string, subjects: any): Promise< GuaribasQuestion []>

- - Defined in deploy/kb.gbapp/services/KBService.ts:318

  #### Parameters

  - ##### from: string

  - ##### subjects: any

  #### Returns Promise< GuaribasQuestion []>

### getSearchSchema

- getSearchSchema(indexName: any): object

- - Defined in deploy/kb.gbapp/services/KBService.ts:181

  #### Parameters

  - ##### indexName: any

  #### Returns object

  - ##### corsOptions: null

  - ##### defaultScoringProfile: null

  - ##### fields: object[]

  - ##### name: any

  - ##### scoringProfiles: undefined[]

### getSubjectItems

- getSubjectItems(instanceId: number, parentId: number): Promise< GuaribasSubject []>

- - Defined in deploy/kb.gbapp/services/KBService.ts:299

  #### Parameters

  - ##### instanceId: number

  - ##### parentId: number

  #### Returns Promise< GuaribasSubject []>

### importKbPackage

- importKbPackage(localPath: string, packageStorage: GuaribasPackage, instance: IGBInstance): Promise<any>

- - Defined in deploy/kb.gbapp/services/KBService.ts:493

  #### Parameters

  - ##### localPath: string

  - ##### packageStorage: GuaribasPackage

  - ##### instance: IGBInstance

  #### Returns Promise<any>

### importKbTabularDirectory

- importKbTabularDirectory(localPath: string, instance: IGBInstance, packageId: number): Promise<any>

- - Defined in deploy/kb.gbapp/services/KBService.ts:516

  #### Parameters

  - ##### localPath: string

  - ##### instance: IGBInstance

  - ##### packageId: number

  #### Returns Promise<any>

### importKbTabularFile

- importKbTabularFile(filePath: string, instanceId: number, packageId: number): Promise< GuaribasQuestion []>

- - Defined in deploy/kb.gbapp/services/KBService.ts:365

  #### Parameters

  - ##### filePath: string

  - ##### instanceId: number

  - ##### packageId: number

  #### Returns Promise< GuaribasQuestion []>

### importSubjectFile

- importSubjectFile(packageId: number, filename: string, instance: IGBInstance): Promise<any>

- - Defined in deploy/kb.gbapp/services/KBService.ts:535

  #### Parameters

  - ##### packageId: number

  - ##### filename: string

  - ##### instance: IGBInstance

  #### Returns Promise<any>

### sendAnswer

- sendAnswer(conversationalService: IGBConversationalService, dc: any, answer: GuaribasAnswer ): Promise<any>

- - Defined in deploy/kb.gbapp/services/KBService.ts:457

  #### Parameters

  - ##### conversationalService: IGBConversationalService

  - ##### dc: any

  - ##### answer: GuaribasAnswer

  #### Returns Promise<any>

### undeployKbFromStorage

- undeployKbFromStorage(instance: IGBInstance, packageId: number): Promise<void>

- - Defined in deploy/kb.gbapp/services/KBService.ts:570

  #### Parameters

  - ##### instance: IGBInstance

  - ##### packageId: number

  #### Returns Promise<void>

### Static getFormattedSubjectItems

- getFormattedSubjectItems(subjects: GuaribasSubject []): string

- - Defined in deploy/kb.gbapp/services/KBService.ts:282

  #### Parameters

  - ##### subjects: GuaribasSubject []

  #### Returns string

### Static getSubjectItemsSeparatedBySpaces

- getSubjectItemsSeparatedBySpaces(subjects: GuaribasSubject []): string

- - Defined in deploy/kb.gbapp/services/KBService.ts:291

  #### Parameters

  - ##### subjects: GuaribasSubject []

  #### Returns string

Generated using TypeDoc