Skip to content

Commit 5bf5d08

Browse files
vsct-jburetPazuzzu
authored andcommitted
resolves #1881 NLP: add healthcheck for Sagemaker classifiers
1 parent c38bb69 commit 5bf5d08

File tree

24 files changed

+140
-93
lines changed

24 files changed

+140
-93
lines changed

.idea/runConfigurations/NlpService.xml

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs/en/dev/bot-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ For example in a [Maven](https://maven.apache.org/) project:
4949
<dependency>
5050
<groupId>ai.tock</groupId>
5151
<artifactId>tock-bot-api-websocket</artifactId>
52-
<version>24.9.8</version>
52+
<version>25.3.1</version>
5353
</dependency>
5454
```
5555

5656
Or in a [Gradle](https://gradle.org/) project:
5757

5858
```groovy
59-
compile 'ai.tock:tock-bot-api-websocket:24.9.8'
59+
compile 'ai.tock:tock-bot-api-websocket:25.3.1'
6060
```
6161

6262
### Enable WebHook mode
@@ -69,14 +69,14 @@ For example in a [Maven](https://maven.apache.org/) project:
6969
<dependency>
7070
<groupId>ai.tock</groupId>
7171
<artifactId>tock-bot-api-webhook</artifactId>
72-
<version>24.9.8</version>
72+
<version>25.3.1</version>
7373
</dependency>
7474
```
7575

7676
Or in a [Gradle](https://gradle.org/) project:
7777

7878
```groovy
79-
compile 'ai.tock:tock-bot-api-webhook:24.9.8'
79+
compile 'ai.tock:tock-bot-api-webhook:25.3.1'
8080
```
8181

8282
In this case, unlike in _WebSocket_ mode, the application/bot started must be reachable by the

docs/docs/en/dev/bot-integre.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ For example in a [Maven](https://maven.apache.org/) project:
4343
<dependency>
4444
<groupId>ai.tock</groupId>
4545
<artifactId>bot-toolkit</artifactId>
46-
<version>24.9.8</version>
46+
<version>25.3.1</version>
4747
</dependency>
4848
```
4949

5050
Or in a [Gradle](https://gradle.org/) project:
5151

5252
```groovy
53-
compile 'ai.tock:bot-toolkit:24.9.8'
53+
compile 'ai.tock:bot-toolkit:25.3.1'
5454
```
5555

5656
### A bot is a set of stories

docs/docs/en/dev/test.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ With Maven:
1414
<dependency>
1515
<groupId>ai.tock</groupId>
1616
<artifactId>bot-test</artifactId>
17-
<version>24.9.8</version>
17+
<version>25.3.1</version>
1818
<scope>test</scope>
1919
</dependency>
2020
```
2121

2222
Or gradle :
2323

2424
```groovy
25-
testCompile 'ai.tock:bot-test:24.9.8'
25+
testCompile 'ai.tock:bot-test:25.3.1'
2626
```
2727

2828
This entire framework is documented in KDoc format [here](https://doc.tock.ai/tock/dokka/tock/ai.tock.bot.test).

docs/docs/fr/dev/bot-api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ Par exemple dans un projet [Maven](https://maven.apache.org/) :
5454
<dependency>
5555
<groupId>ai.tock</groupId>
5656
<artifactId>tock-bot-api-websocket</artifactId>
57-
<version>24.9.8</version>
57+
<version>25.3.1</version>
5858
</dependency>
5959
```
6060

6161
Ou dans un projet [Gradle](https://gradle.org/) :
6262

6363
```groovy
64-
compile 'ai.tock:tock-bot-api-websocket:24.9.8'
64+
compile 'ai.tock:tock-bot-api-websocket:25.3.1'
6565
```
6666

6767
### Activer le mode WebHook
@@ -74,14 +74,14 @@ Par exemple dans un projet [Maven](https://maven.apache.org/) :
7474
<dependency>
7575
<groupId>ai.tock</groupId>
7676
<artifactId>tock-bot-api-webhook</artifactId>
77-
<version>24.9.8</version>
77+
<version>25.3.1</version>
7878
</dependency>
7979
```
8080

8181
Ou dans un projet [Gradle](https://gradle.org/) :
8282

8383
```groovy
84-
compile 'ai.tock:tock-bot-api-webhook:24.9.8'
84+
compile 'ai.tock:tock-bot-api-webhook:25.3.1'
8585
```
8686

8787
Dans ce cas, contrairement au mode _WebSocket_, il faut que l'application/bot démarrée soit joignable par la

docs/docs/fr/dev/bot-integre.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ Par exemple dans un projet [Maven](https://maven.apache.org/) :
4343
<dependency>
4444
<groupId>ai.tock</groupId>
4545
<artifactId>bot-toolkit</artifactId>
46-
<version>24.9.8</version>
46+
<version>25.3.1</version>
4747
</dependency>
4848
```
4949

5050
Ou dans un projet [Gradle](https://gradle.org/) :
5151

5252
```groovy
53-
compile 'ai.tock:bot-toolkit:24.9.8'
53+
compile 'ai.tock:bot-toolkit:25.3.1'
5454
```
5555

5656
### Un bot est un ensemble de parcours (stories)

docs/docs/fr/dev/test.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Avec Maven :
1414
<dependency>
1515
<groupId>ai.tock</groupId>
1616
<artifactId>bot-test</artifactId>
17-
<version>24.9.8</version>
17+
<version>25.3.1</version>
1818
<scope>test</scope>
1919
</dependency>
2020
```
2121

2222
ou Gradle :
2323

2424
```groovy
25-
testCompile 'ai.tock:bot-test:24.9.8'
25+
testCompile 'ai.tock:bot-test:25.3.1'
2626
```
2727

2828
L'ensemble de ce framework est documenté au format KDoc [ici](https://doc.tock.ai/tock/dokka/tock/ai.tock.bot.test).

docs/docs/fr/guides/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ la dépendance `tock-bot-api-websocket` incluse :
7777
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
7878
<plugin.kotlin.version>1.3.41</plugin.kotlin.version>
7979
<plugin.source.version>3.1.0</plugin.source.version>
80-
<lib.tock.version>24.9.8</lib.tock.version>
80+
<lib.tock.version>25.3.1</lib.tock.version>
8181
</properties>
8282

8383
<dependencies>

nlp/api/service/src/main/kotlin/NlpVerticle.kt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
package ai.tock.nlp.api
1818

19+
/**
20+
*
21+
*/
22+
// Add this import at the top with the other imports
1923
import ai.tock.nlp.front.client.FrontClient
2024
import ai.tock.nlp.front.service.UnknownApplicationException
2125
import ai.tock.nlp.front.shared.codec.ApplicationDump
@@ -28,13 +32,8 @@ import ai.tock.nlp.front.shared.merge.ValuesMergeQuery
2832
import ai.tock.nlp.front.shared.monitoring.MarkAsUnknownQuery
2933
import ai.tock.nlp.front.shared.monitoring.ParseRequestLogCountQuery
3034
import ai.tock.nlp.front.shared.parser.ParseQuery
31-
import ai.tock.shared.Executor
32-
import ai.tock.shared.TOCK_FRONT_DATABASE
33-
import ai.tock.shared.TOCK_MODEL_DATABASE
34-
import ai.tock.shared.injector
35-
import ai.tock.shared.namespace
36-
import ai.tock.shared.pingMongoDatabase
37-
import ai.tock.shared.property
35+
import ai.tock.nlp.model.service.NlpClassifierService
36+
import ai.tock.shared.*
3837
import ai.tock.shared.security.auth.TockAuthProvider
3938
import ai.tock.shared.security.initEncryptor
4039
import ai.tock.shared.vertx.WebVerticle
@@ -44,11 +43,8 @@ import io.vertx.ext.web.RoutingContext
4443
import mu.KLogger
4544
import mu.KotlinLogging
4645
import org.litote.kmongo.Id
47-
import java.util.Locale
46+
import java.util.*
4847

49-
/**
50-
*
51-
*/
5248
class NlpVerticle : WebVerticle() {
5349

5450
private val protectPath = verticleBooleanProperty("tock_nlp_protect_path", false)
@@ -59,6 +55,9 @@ class NlpVerticle : WebVerticle() {
5955

6056
private val executor: Executor by injector.instance()
6157

58+
// Add this line to access NlpClassifierService
59+
private val nlpClassifierService = NlpClassifierService
60+
6261
override val logger: KLogger = KotlinLogging.logger {}
6362

6463
override fun authProvider(): TockAuthProvider? {
@@ -232,7 +231,7 @@ class NlpVerticle : WebVerticle() {
232231
Pair("duckling_service", { FrontClient.healthcheck() }),
233232
Pair("tock_front_database", { pingMongoDatabase(TOCK_FRONT_DATABASE) }),
234233
Pair("tock_model_database", { pingMongoDatabase(TOCK_MODEL_DATABASE) })
235-
)
234+
) + NlpClassifierService.healthcheck()
236235
)
237236
}
238237

nlp/core/service/src/main/kotlin/NlpCoreService.kt

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,18 @@
1616

1717
package ai.tock.nlp.core.service
1818

19-
import ai.tock.nlp.core.CallContext
20-
import ai.tock.nlp.core.Entity
21-
import ai.tock.nlp.core.EntityRecognition
22-
import ai.tock.nlp.core.EntityType
23-
import ai.tock.nlp.core.Intent
19+
import ai.tock.nlp.core.*
2420
import ai.tock.nlp.core.Intent.Companion.UNKNOWN_INTENT_NAME
25-
import ai.tock.nlp.core.IntentClassification
26-
import ai.tock.nlp.core.IntentSelector
27-
import ai.tock.nlp.core.NlpCore
28-
import ai.tock.nlp.core.NlpEngineType
29-
import ai.tock.nlp.core.ParsingResult
3021
import ai.tock.nlp.core.merge.ValueDescriptor
3122
import ai.tock.nlp.core.quality.TestContext
3223
import ai.tock.nlp.core.service.entity.EntityCore
3324
import ai.tock.nlp.core.service.entity.EntityCoreService
3425
import ai.tock.nlp.core.service.entity.EntityMerge
35-
import ai.tock.nlp.model.EntityCallContextForEntity
36-
import ai.tock.nlp.model.EntityCallContextForIntent
37-
import ai.tock.nlp.model.IntentContext
38-
import ai.tock.nlp.model.ModelHolder
39-
import ai.tock.nlp.model.ModelNotInitializedException
40-
import ai.tock.nlp.model.NlpClassifier
26+
import ai.tock.nlp.model.*
4127
import ai.tock.shared.checkMaxLengthAllowed
4228
import ai.tock.shared.error
43-
import ai.tock.shared.normalize
4429
import ai.tock.shared.injector
30+
import ai.tock.shared.normalize
4531
import com.github.salomonbrys.kodein.instance
4632
import mu.KotlinLogging
4733

0 commit comments

Comments
 (0)