com.botscrew:bot-framework-nlp-spring-boot-starter

Module for work with nlp providers

Лицензия

Лицензия

Категории

Категории

Spring Boot Контейнер Микросервисы
Группа

Группа

com.botscrew
Идентификатор

Идентификатор

bot-framework-nlp-spring-boot-starter
Последняя версия

Последняя версия

1.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

com.botscrew:bot-framework-nlp-spring-boot-starter
Module for work with nlp providers
Ссылка на сайт

Ссылка на сайт

https://github.com/botscrew/bot-framework-nlp
Система контроля версий

Система контроля версий

https://github.com/botscrew/bot-framework-nlp

Скачать bot-framework-nlp-spring-boot-starter

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.botscrew/bot-framework-nlp-spring-boot-starter/ -->
<dependency>
    <groupId>com.botscrew</groupId>
    <artifactId>bot-framework-nlp-spring-boot-starter</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.botscrew/bot-framework-nlp-spring-boot-starter/
implementation 'com.botscrew:bot-framework-nlp-spring-boot-starter:1.2.0'
// https://jarcasting.com/artifacts/com.botscrew/bot-framework-nlp-spring-boot-starter/
implementation ("com.botscrew:bot-framework-nlp-spring-boot-starter:1.2.0")
'com.botscrew:bot-framework-nlp-spring-boot-starter:jar:1.2.0'
<dependency org="com.botscrew" name="bot-framework-nlp-spring-boot-starter" rev="1.2.0">
  <artifact name="bot-framework-nlp-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.botscrew', module='bot-framework-nlp-spring-boot-starter', version='1.2.0')
)
libraryDependencies += "com.botscrew" % "bot-framework-nlp-spring-boot-starter" % "1.2.0"
[com.botscrew/bot-framework-nlp-spring-boot-starter "1.2.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
ai.api : libai jar 1.6.12
com.botscrew : bot-framework-core-spring-boot-starter jar 1.0.3

provided (3)

Идентификатор библиотеки Тип Версия
org.springframework.boot : spring-boot-starter-web jar
org.springframework.boot : spring-boot-configuration-processor Необязательный jar
org.projectlombok : lombok jar

test (1)

Идентификатор библиотеки Тип Версия
org.springframework.boot : spring-boot-starter-test jar

Модули Проекта

Данный проект не имеет модулей.

NLP Client Spring Boot Starter

NLP Client project provides integration with various nlp clients (only dialog-flow for now). It is based on Bot Framework. It uses IntentContainer from Bot Framework. To read more about it, check the link below:

https://github.com/botscrew-projects/bot-framework-core

Getting Started

  • Add NLP Client dependency
<dependency>
    <groupId>com.botscrew</groupId>
    <artifactId>bot-framework-nlp-spring-boot-starter</artifactId>
    <version>1.1.2</version>
</dependency>

NLP Client already depends on the Bot Framework so you don't need to add it to project by yourself.

Usage

To send query to the nlp provider you need to autowire NlpClient and call NlpClient#query() method

public class TextHandler {
    @Autowired
    private NlpClient nlpClient;
    
    @Text
    public void handleText(User user, @Text String text) {
        nlpClient.query(user, text);
    }
}

You will be able to get an answer in your Intent handling method:

@Intent
public void handleIntent(User user, @Text String originalQuery) {
    // ...
}

You can get entities from the nlp provider as parameters in your handling method:

@Intent("name")
public void handleNameIntent(User user, @Param("name") String name) {
    // ...
}

If you need to get any complex objects you can define your own model and get them as parameters:

public class Age {
    private String unit;
    private Integer amount;
}

// ...

@Intent("age")
public void handleAgeIntent(@Param("age") Age age) {}

IntentContainer supports user states so, you will be able to define different intent handlers for different user states:

@Intent(value = "PHONE_NUMBER", states = {"DEFAULT"})
public void handlePhoneNumberIntent(User user, @Param("number") String number) {
    // ...
}

@Intent(value = "PHONE_NUMBER", states = {"ONBOARDING"})
public void handlePhoneNumberInOnboarding(User user, @Param("number") String number) {
    // ...
}

Providers

  • DialogFlow APIv1

To work with DialogFlow API you need define the following properties: nlp.provider.dialog-flow.v1.client-token

If you need get some specific data from the original DialogFlow response, you can get it by using the @NlpResponse annotation:

@Intent
public void intent(@NlpResponse AiResponse aiResponse) {
    // ...
}

Версии библиотеки

Версия
1.2.0
1.1.2
1.1.1
1.1.0