aristech-nlp-client 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aristech_nlp_client-1.0.0/PKG-INFO +76 -0
- aristech_nlp_client-1.0.0/README.md +57 -0
- aristech_nlp_client-1.0.0/pyproject.toml +24 -0
- aristech_nlp_client-1.0.0/setup.cfg +4 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/__init__.py +30 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/client.py +219 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/__init__.py +0 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/intents_pb2.py +69 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/intents_pb2.pyi +474 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/intents_pb2_grpc.py +24 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/nlp_server_pb2.py +47 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/nlp_server_pb2.pyi +109 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/nlp_server_pb2_grpc.py +589 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/projects_pb2.py +61 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/projects_pb2.pyi +323 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client/proto/projects_pb2_grpc.py +24 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client.egg-info/PKG-INFO +76 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client.egg-info/SOURCES.txt +19 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client.egg-info/dependency_links.txt +1 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client.egg-info/requires.txt +7 -0
- aristech_nlp_client-1.0.0/src/aristech_nlp_client.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aristech-nlp-client
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A Python client library for the Aristech Natural-Language-Processing API.
|
|
5
|
+
Author-email: Martin Mende <speech@aristech.de>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: Homepage, https://github.com/aristech-de/nlp-clients/tree/main/python
|
|
8
|
+
Project-URL: Issues, https://github.com/aristech-de/nlp-clients/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
Requires-Dist: grpcio
|
|
14
|
+
Requires-Dist: protobuf
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: grpcio-tools; extra == "dev"
|
|
17
|
+
Requires-Dist: mypy-protobuf; extra == "dev"
|
|
18
|
+
Requires-Dist: python-dotenv; extra == "dev"
|
|
19
|
+
|
|
20
|
+
# Aristech NLP-Client for Python
|
|
21
|
+
|
|
22
|
+
This is the Python client implementation for the Aristech NLP-Server.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
The package is not published to PyPI yet but will be soon.
|
|
27
|
+
|
|
28
|
+
<!-- ```bash
|
|
29
|
+
pip install aristech-nlp-client
|
|
30
|
+
``` -->
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from aristech_nlp_client import NlpClient
|
|
36
|
+
|
|
37
|
+
client = NlpClient(host='nlp.example.com')
|
|
38
|
+
data = client.synthesize(SpeechRequest(
|
|
39
|
+
text='Hello, world!',
|
|
40
|
+
options=SpeechRequestOption(
|
|
41
|
+
voice_id='some-voice-id'
|
|
42
|
+
)
|
|
43
|
+
))
|
|
44
|
+
with open('output.wav', 'wb') as f:
|
|
45
|
+
f.write(data)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
There are several examples in the [examples](.) directory:
|
|
49
|
+
|
|
50
|
+
- [functions.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/models.py): Demonstrates how to list the available functions.
|
|
51
|
+
- [process.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/process.py): Demonstrates how to perform NLP processing on a text.
|
|
52
|
+
- [projects.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/projects.py): Demonstrates how to list the available projects.
|
|
53
|
+
- [intents.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/intents.py): Demonstrates how to list intents for a project.
|
|
54
|
+
- [scoreLimits.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/scoreLimits.py): Demonstrates how to use score limits to figure out good thresholds for intents.
|
|
55
|
+
- [content.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/content.py): Demonstrates how to search content for a given prompt.
|
|
56
|
+
|
|
57
|
+
You can run the examples directly using `python` like this:
|
|
58
|
+
|
|
59
|
+
1. Create a `.env` file in the [python](.) directory:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
HOST=nlp.example.com
|
|
63
|
+
# The credentials are optional but probably required for most servers:
|
|
64
|
+
TOKEN=your-token
|
|
65
|
+
SECRET=your-secret
|
|
66
|
+
|
|
67
|
+
# The following are optional:
|
|
68
|
+
# ROOT_CERT=your-root-cert.pem # If the server uses a self-signed certificate
|
|
69
|
+
# PROJECT_ID=some-project-id # Required for some examples
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
2. Run the examples, e.g.:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
python examples/functions.py
|
|
76
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Aristech NLP-Client for Python
|
|
2
|
+
|
|
3
|
+
This is the Python client implementation for the Aristech NLP-Server.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
The package is not published to PyPI yet but will be soon.
|
|
8
|
+
|
|
9
|
+
<!-- ```bash
|
|
10
|
+
pip install aristech-nlp-client
|
|
11
|
+
``` -->
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from aristech_nlp_client import NlpClient
|
|
17
|
+
|
|
18
|
+
client = NlpClient(host='nlp.example.com')
|
|
19
|
+
data = client.synthesize(SpeechRequest(
|
|
20
|
+
text='Hello, world!',
|
|
21
|
+
options=SpeechRequestOption(
|
|
22
|
+
voice_id='some-voice-id'
|
|
23
|
+
)
|
|
24
|
+
))
|
|
25
|
+
with open('output.wav', 'wb') as f:
|
|
26
|
+
f.write(data)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
There are several examples in the [examples](.) directory:
|
|
30
|
+
|
|
31
|
+
- [functions.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/models.py): Demonstrates how to list the available functions.
|
|
32
|
+
- [process.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/process.py): Demonstrates how to perform NLP processing on a text.
|
|
33
|
+
- [projects.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/projects.py): Demonstrates how to list the available projects.
|
|
34
|
+
- [intents.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/intents.py): Demonstrates how to list intents for a project.
|
|
35
|
+
- [scoreLimits.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/scoreLimits.py): Demonstrates how to use score limits to figure out good thresholds for intents.
|
|
36
|
+
- [content.py](https://github.com/aristech-de/nlp-clients/blob/main/python/examples/content.py): Demonstrates how to search content for a given prompt.
|
|
37
|
+
|
|
38
|
+
You can run the examples directly using `python` like this:
|
|
39
|
+
|
|
40
|
+
1. Create a `.env` file in the [python](.) directory:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
HOST=nlp.example.com
|
|
44
|
+
# The credentials are optional but probably required for most servers:
|
|
45
|
+
TOKEN=your-token
|
|
46
|
+
SECRET=your-secret
|
|
47
|
+
|
|
48
|
+
# The following are optional:
|
|
49
|
+
# ROOT_CERT=your-root-cert.pem # If the server uses a self-signed certificate
|
|
50
|
+
# PROJECT_ID=some-project-id # Required for some examples
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. Run the examples, e.g.:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
python examples/functions.py
|
|
57
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=75.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "aristech-nlp-client"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "A Python client library for the Aristech Natural-Language-Processing API."
|
|
9
|
+
authors = [{ name = "Martin Mende", email = "speech@aristech.de" }]
|
|
10
|
+
dependencies = ["grpcio", "protobuf"]
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
]
|
|
17
|
+
license = { text = "MIT License" }
|
|
18
|
+
|
|
19
|
+
[project.optional-dependencies]
|
|
20
|
+
dev = ["grpcio-tools", "mypy-protobuf", "python-dotenv"]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://github.com/aristech-de/nlp-clients/tree/main/python"
|
|
24
|
+
Issues = "https://github.com/aristech-de/nlp-clients/issues"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from .client import NlpClient
|
|
2
|
+
from .proto.nlp_server_pb2_grpc import *
|
|
3
|
+
from .proto.nlp_server_pb2 import *
|
|
4
|
+
from .proto.projects_pb2_grpc import *
|
|
5
|
+
from .proto.projects_pb2 import *
|
|
6
|
+
from .proto.intents_pb2_grpc import *
|
|
7
|
+
from .proto.intents_pb2 import *
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"NlpClient",
|
|
11
|
+
"FunctionRequest",
|
|
12
|
+
"Function",
|
|
13
|
+
"GetProjectsRequest",
|
|
14
|
+
"Project",
|
|
15
|
+
"GetIntentsRequest",
|
|
16
|
+
"Intent",
|
|
17
|
+
"RunFunctionsRequest",
|
|
18
|
+
"RunFunctionsResponse",
|
|
19
|
+
"GetScoreLimitsRequest",
|
|
20
|
+
"GetContentRequest",
|
|
21
|
+
"GetContentResponse",
|
|
22
|
+
"UpdateContentRequest",
|
|
23
|
+
"UpdateContentResponse",
|
|
24
|
+
"RemoveContentRequest",
|
|
25
|
+
"RemoveContentResponse",
|
|
26
|
+
"ContentMetaData",
|
|
27
|
+
"ContentData",
|
|
28
|
+
"DescriptionMapping",
|
|
29
|
+
"Output",
|
|
30
|
+
]
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import grpc
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
from typing import Iterable
|
|
5
|
+
|
|
6
|
+
from .proto.nlp_server_pb2_grpc import *
|
|
7
|
+
from .proto.nlp_server_pb2 import *
|
|
8
|
+
from .proto.projects_pb2_grpc import *
|
|
9
|
+
from .proto.projects_pb2 import *
|
|
10
|
+
from .proto.intents_pb2_grpc import *
|
|
11
|
+
from .proto.intents_pb2 import *
|
|
12
|
+
|
|
13
|
+
class NlpClient:
|
|
14
|
+
host: str
|
|
15
|
+
ssl: bool
|
|
16
|
+
rootCert: bytes
|
|
17
|
+
auth_token: str
|
|
18
|
+
auth_secret: str
|
|
19
|
+
channel: grpc.Channel
|
|
20
|
+
|
|
21
|
+
def __init__(self, host: str, ssl=None, root_cert=b"", auth_token="", auth_secret=""):
|
|
22
|
+
"""
|
|
23
|
+
Initializes the client with the given connection parameters.
|
|
24
|
+
|
|
25
|
+
Args:
|
|
26
|
+
host (str): The host to connect to. Can include the port, e.g. "localhost:8524".
|
|
27
|
+
ssl (bool): Whether to use SSL. If not explicitly set, the client will try to guess based on the remaining parameters.
|
|
28
|
+
root_cert (bytes): The root certificate to use for SSL (e.g. when connecting to a server that uses a self-signed certificate).
|
|
29
|
+
auth_token (str): The auth token to use for authentication.
|
|
30
|
+
auth_secret (str): The auth secret to use for authentication.
|
|
31
|
+
"""
|
|
32
|
+
# When ssl or rootCert are not explicitly set, we check if the host includes the port 9424 or 9423.
|
|
33
|
+
# If host does not include the port, we assume ssl is True and the port is 9424 therefore.
|
|
34
|
+
defaultSsl = (ssl is None and len(root_cert) == 0) or (ssl is True or len(root_cert) != 0)
|
|
35
|
+
(h, p) = self._get_host_port(host, defaultSsl)
|
|
36
|
+
self.host = h + ":" + p
|
|
37
|
+
self.ssl = ssl is True or len(root_cert) != 0 or p == "8524"
|
|
38
|
+
self.rootCert = root_cert
|
|
39
|
+
self.auth_token = auth_token
|
|
40
|
+
self.auth_secret = auth_secret
|
|
41
|
+
if self.ssl or self.rootCert:
|
|
42
|
+
self.channel = self._create_secure_channel()
|
|
43
|
+
else:
|
|
44
|
+
self.channel = grpc.insecure_channel(self.host)
|
|
45
|
+
|
|
46
|
+
def _get_host_port(self, host, defaultSsl):
|
|
47
|
+
portRe = r"^(?P<host>[^:]+):(?P<port>[0-9]+)$"
|
|
48
|
+
matches = re.search(portRe, host)
|
|
49
|
+
defaultPort = defaultSsl and "8524" or "8523"
|
|
50
|
+
return (host, defaultPort) if matches is None else (matches.group("host"), matches.group("port"))
|
|
51
|
+
|
|
52
|
+
def _metadata_callback(self, context, callback):
|
|
53
|
+
callback([('token', self.auth_token), ('secret', self.auth_secret)], None)
|
|
54
|
+
|
|
55
|
+
def _create_secure_channel(self):
|
|
56
|
+
if len(self.rootCert) != 0:
|
|
57
|
+
cert_creds = grpc.ssl_channel_credentials(root_certificates=self.rootCert)
|
|
58
|
+
else:
|
|
59
|
+
cert_creds = grpc.ssl_channel_credentials()
|
|
60
|
+
auth_creds = grpc.metadata_call_credentials(self._metadata_callback)
|
|
61
|
+
combined_creds = grpc.composite_channel_credentials(cert_creds, auth_creds)
|
|
62
|
+
channel = grpc.secure_channel(target=self.host, credentials=combined_creds)
|
|
63
|
+
return channel
|
|
64
|
+
|
|
65
|
+
def list_functions(self, request=FunctionRequest()) -> Iterable[Function]:
|
|
66
|
+
"""
|
|
67
|
+
Lists the available functions.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
request (FunctionRequest): The request to send. Defaults to an empty request.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Iterable[Function]: The functions available.
|
|
74
|
+
"""
|
|
75
|
+
stub = NLPServerStub(self.channel)
|
|
76
|
+
return stub.GetFunctions(request)
|
|
77
|
+
|
|
78
|
+
def list_projects(self, request=GetProjectsRequest()) -> Iterable[Project]:
|
|
79
|
+
"""
|
|
80
|
+
Lists the available projects.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
request (GetProjectsRequest): The request to send. Defaults to an empty request.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
Iterable[Project]: The projects available.
|
|
87
|
+
"""
|
|
88
|
+
stub = NLPServerStub(self.channel)
|
|
89
|
+
return stub.GetProjects(request)
|
|
90
|
+
|
|
91
|
+
def list_intents(self, request: GetIntentsRequest) -> Iterable[Intent]:
|
|
92
|
+
"""
|
|
93
|
+
Lists the available intents for a given project.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
request (GetIntentsRequest): The request to send.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
Iterable[GetIntentsResponse]: The intents available.
|
|
100
|
+
"""
|
|
101
|
+
stub = NLPServerStub(self.channel)
|
|
102
|
+
return stub.GetIntents(request)
|
|
103
|
+
|
|
104
|
+
def list_embedding_models(self, request=GetEmbeddingModelsRequest) -> Iterable[EmbeddingModel]:
|
|
105
|
+
"""
|
|
106
|
+
Lists the available embedding models.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
request (GetEmbeddingModelsRequest): The request to send.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Iterable[EmbeddingModel]: The embedding models available.
|
|
113
|
+
"""
|
|
114
|
+
stub = NLPServerStub(self.channel)
|
|
115
|
+
return stub.RemoveContent(request)
|
|
116
|
+
|
|
117
|
+
def run_functions(self, request: RunFunctionsRequest) -> RunFunctionsResponse:
|
|
118
|
+
"""
|
|
119
|
+
Processes a raw text.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
request (RunFunctionsRequest): The request to send.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
Iterable[RunFunctionsResponse]: The responses with the processed text.
|
|
126
|
+
"""
|
|
127
|
+
stub = NLPServerStub(self.channel)
|
|
128
|
+
return stub.RunFunctions(request)
|
|
129
|
+
|
|
130
|
+
def score_limits(self, request: GetScoreLimitsRequest) -> GetScoreLimitsResponse:
|
|
131
|
+
"""
|
|
132
|
+
Gets the score limits for a given project.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
request (GetScoreLimitsRequest): The request to send.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
GetScoreLimitsResponse: The score limits.
|
|
139
|
+
"""
|
|
140
|
+
stub = NLPServerStub(self.channel)
|
|
141
|
+
return stub.GetScoreLimits(request)
|
|
142
|
+
|
|
143
|
+
def get_content(self, request: GetContentRequest) -> Iterable[GetContentResponse]:
|
|
144
|
+
"""
|
|
145
|
+
Gets the content for a given project.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
request (GetContentRequest): The request to send.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Iterable[GetContentResponse]: The content available.
|
|
152
|
+
"""
|
|
153
|
+
stub = NLPServerStub(self.channel)
|
|
154
|
+
return stub.GetContent(request)
|
|
155
|
+
|
|
156
|
+
def update_content(self, request: UpdateContentRequest) -> UpdateContentResponse:
|
|
157
|
+
"""
|
|
158
|
+
Updates the content that matches the given request.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
request (UpdateContentRequest): The request to send.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
UpdateContentResponse: The response.
|
|
165
|
+
"""
|
|
166
|
+
stub = NLPServerStub(self.channel)
|
|
167
|
+
return stub.UpdateContent(request)
|
|
168
|
+
|
|
169
|
+
def remove_content(self, request: RemoveContentRequest) -> RemoveContentResponse:
|
|
170
|
+
"""
|
|
171
|
+
Removes the content that matches the given request.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
request (RemoveContentRequest): The request to send.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
RemoveContentResponse: The response.
|
|
178
|
+
"""
|
|
179
|
+
stub = NLPServerStub(self.channel)
|
|
180
|
+
return stub.RemoveContent(request)
|
|
181
|
+
|
|
182
|
+
def update_project(self, request: UpdateProjectRequest) -> UpdateProjectResponse:
|
|
183
|
+
"""
|
|
184
|
+
Updates the project that matches the given request.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
request (UpdateContentRequest): The request to send.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
UpdateProjectResponse: The response.
|
|
191
|
+
"""
|
|
192
|
+
stub = NLPServerStub(self.channel)
|
|
193
|
+
return stub.UpdateProject(request)
|
|
194
|
+
|
|
195
|
+
def remove_project(self, request: RemoveProjectRequest) -> RemoveProjectResponse:
|
|
196
|
+
"""
|
|
197
|
+
Removes the project that matches the given request.
|
|
198
|
+
|
|
199
|
+
Args:
|
|
200
|
+
request (RemoveProjectRequest): The request to send.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
RemoveProjectResponse: The response.
|
|
204
|
+
"""
|
|
205
|
+
stub = NLPServerStub(self.channel)
|
|
206
|
+
return stub.RemoveProject(request)
|
|
207
|
+
|
|
208
|
+
def add_projects(self, request: AddProjectRequest) -> AddProjectResponse:
|
|
209
|
+
"""
|
|
210
|
+
Adds a project with the given request.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
request (AddProjectRequest): The request to send.
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
AddProjectReponse: The response.
|
|
217
|
+
"""
|
|
218
|
+
stub = NLPServerStub(self.channel)
|
|
219
|
+
return stub.AddProject(request)
|
|
File without changes
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: intents.proto
|
|
5
|
+
# Protobuf Python Version: 5.28.1
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
5,
|
|
15
|
+
28,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'intents.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rintents.proto\x12\x0c\x61ristech.nlp\"\xad\x03\n\x06Intent\x12\n\n\x02id\x18\x01 \x01(\t\x12\x12\n\nproject_id\x18\x02 \x01(\t\x12\x0e\n\x06locale\x18\x03 \x01(\t\x12\r\n\x05topic\x18\x04 \x01(\t\x12)\n\x06inputs\x18\x05 \x03(\x0b\x32\x19.aristech.nlp.IntentInput\x12\x13\n\x0boutput_chat\x18\x06 \x03(\t\x12\x14\n\x0coutput_voice\x18\x07 \x03(\t\x12\x14\n\x0coutput_email\x18\x08 \x03(\t\x12*\n\nrelated_to\x18\t \x03(\x0b\x32\x16.aristech.nlp.Relation\x12\x11\n\tpublished\x18\n \x01(\x08\x12,\n\x04type\x18\x0b \x01(\x0e\x32\x1e.aristech.nlp.Intent.InputType\x12\"\n\x1a\x65xclude_output_from_search\x18\x0c \x01(\x08\x12\'\n\x08keywords\x18\r \x03(\x0b\x32\x15.aristech.nlp.Keyword\x12\x12\n\ncreator_id\x18\x0e \x01(\t\"*\n\tInputType\x12\x08\n\x04\x43HAT\x10\x00\x12\x08\n\x04MAIL\x10\x01\x12\t\n\x05VOICE\x10\x02\"*\n\x0bIntentInput\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\r\n\x05input\x18\x02 \x01(\t\"<\n\x08Relation\x12\x0f\n\x07parents\x18\x01 \x03(\t\x12\x10\n\x08\x63hildren\x18\x02 \x03(\t\x12\r\n\x05peers\x18\x03 \x03(\t\",\n\x07Keyword\x12\x0f\n\x07keyword\x18\x01 \x01(\t\x12\x10\n\x08priority\x18\x02 \x01(\x05\"=\n\x14UpdateContentRequest\x12%\n\x07intents\x18\x01 \x03(\x0b\x32\x14.aristech.nlp.Intent\"+\n\x15UpdateContentResponse\x12\x12\n\nintent_ids\x18\x01 \x03(\t\"6\n\x14RemoveContentRequest\x12\n\n\x02id\x18\x01 \x03(\t\x12\x12\n\nproject_id\x18\x02 \x01(\t\"\x17\n\x15RemoveContentResponse\"\x9e\x01\n\x11GetContentRequest\x12\x0e\n\x06prompt\x18\x01 \x01(\t\x12\x12\n\nproject_id\x18\x02 \x01(\t\x12\x13\n\x0bnum_results\x18\x03 \x01(\x05\x12\x11\n\tthreshold\x18\x04 \x01(\x02\x12,\n\x07\x66ilters\x18\x05 \x03(\x0b\x32\x1b.aristech.nlp.ContentFilter\x12\x0f\n\x07\x63hat_id\x18\x07 \x01(\t\"W\n\x12GetContentResponse\x12\x30\n\x05items\x18\x01 \x03(\x0b\x32!.aristech.nlp.ContentResponseItem\x12\x0f\n\x07\x63hat_id\x18\x02 \x01(\t\"N\n\rContentFilter\x12\r\n\x05\x66ield\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\x12\x10\n\x08operator\x18\x03 \x01(\t\x12\r\n\x05label\x18\x04 \x03(\t\"p\n\x13\x43ontentResponseItem\x12\n\n\x02id\x18\x01 \x01(\t\x12\r\n\x05score\x18\x02 \x01(\x02\x12$\n\x06intent\x18\x03 \x01(\x0b\x32\x14.aristech.nlp.Intent\x12\x18\n\x10\x66\x61llback_message\x18\x04 \x01(\t\"\'\n\x11GetIntentsRequest\x12\x12\n\nproject_id\x18\x01 \x01(\t\":\n\x12GetIntentsResponse\x12$\n\x06intent\x18\x01 \x03(\x0b\x32\x14.aristech.nlp.Intent\"s\n\x15GetScoreLimitsRequest\x12\x12\n\nproject_id\x18\x01 \x01(\t\x12\"\n\x1atest_sentences_upper_limit\x18\x02 \x03(\t\x12\"\n\x1atest_sentences_lower_limit\x18\x03 \x03(\t\"F\n\x16GetScoreLimitsResponse\x12\x15\n\rmin_threshold\x18\x01 \x01(\x02\x12\x15\n\rmax_threshold\x18\x02 \x01(\x02\x42\x08P\x01\xa2\x02\x03\x41TSb\x06proto3')
|
|
28
|
+
|
|
29
|
+
_globals = globals()
|
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'intents_pb2', _globals)
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'P\001\242\002\003ATS'
|
|
35
|
+
_globals['_INTENT']._serialized_start=32
|
|
36
|
+
_globals['_INTENT']._serialized_end=461
|
|
37
|
+
_globals['_INTENT_INPUTTYPE']._serialized_start=419
|
|
38
|
+
_globals['_INTENT_INPUTTYPE']._serialized_end=461
|
|
39
|
+
_globals['_INTENTINPUT']._serialized_start=463
|
|
40
|
+
_globals['_INTENTINPUT']._serialized_end=505
|
|
41
|
+
_globals['_RELATION']._serialized_start=507
|
|
42
|
+
_globals['_RELATION']._serialized_end=567
|
|
43
|
+
_globals['_KEYWORD']._serialized_start=569
|
|
44
|
+
_globals['_KEYWORD']._serialized_end=613
|
|
45
|
+
_globals['_UPDATECONTENTREQUEST']._serialized_start=615
|
|
46
|
+
_globals['_UPDATECONTENTREQUEST']._serialized_end=676
|
|
47
|
+
_globals['_UPDATECONTENTRESPONSE']._serialized_start=678
|
|
48
|
+
_globals['_UPDATECONTENTRESPONSE']._serialized_end=721
|
|
49
|
+
_globals['_REMOVECONTENTREQUEST']._serialized_start=723
|
|
50
|
+
_globals['_REMOVECONTENTREQUEST']._serialized_end=777
|
|
51
|
+
_globals['_REMOVECONTENTRESPONSE']._serialized_start=779
|
|
52
|
+
_globals['_REMOVECONTENTRESPONSE']._serialized_end=802
|
|
53
|
+
_globals['_GETCONTENTREQUEST']._serialized_start=805
|
|
54
|
+
_globals['_GETCONTENTREQUEST']._serialized_end=963
|
|
55
|
+
_globals['_GETCONTENTRESPONSE']._serialized_start=965
|
|
56
|
+
_globals['_GETCONTENTRESPONSE']._serialized_end=1052
|
|
57
|
+
_globals['_CONTENTFILTER']._serialized_start=1054
|
|
58
|
+
_globals['_CONTENTFILTER']._serialized_end=1132
|
|
59
|
+
_globals['_CONTENTRESPONSEITEM']._serialized_start=1134
|
|
60
|
+
_globals['_CONTENTRESPONSEITEM']._serialized_end=1246
|
|
61
|
+
_globals['_GETINTENTSREQUEST']._serialized_start=1248
|
|
62
|
+
_globals['_GETINTENTSREQUEST']._serialized_end=1287
|
|
63
|
+
_globals['_GETINTENTSRESPONSE']._serialized_start=1289
|
|
64
|
+
_globals['_GETINTENTSRESPONSE']._serialized_end=1347
|
|
65
|
+
_globals['_GETSCORELIMITSREQUEST']._serialized_start=1349
|
|
66
|
+
_globals['_GETSCORELIMITSREQUEST']._serialized_end=1464
|
|
67
|
+
_globals['_GETSCORELIMITSRESPONSE']._serialized_start=1466
|
|
68
|
+
_globals['_GETSCORELIMITSRESPONSE']._serialized_end=1536
|
|
69
|
+
# @@protoc_insertion_point(module_scope)
|