rapida-python 0.1.2a0__tar.gz → 0.1.4a0__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.
- {rapida-python-0.1.2a0/rapida_python.egg-info → rapida_python-0.1.4a0}/PKG-INFO +3 -2
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/client/rapida_bridge.py +126 -64
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/constants.py +1 -1
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/rapida_client.py +150 -58
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/rapida_source.py +36 -3
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/values.py +54 -2
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/version.py +1 -1
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0/rapida_python.egg-info}/PKG-INFO +2 -1
- rapida_python-0.1.4a0/rapida_python.egg-info/requires.txt +42 -0
- rapida_python-0.1.4a0/setup.py +74 -0
- rapida-python-0.1.2a0/rapida_python.egg-info/requires.txt +0 -6
- rapida-python-0.1.2a0/setup.py +0 -44
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/README.md +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/bin/__init__.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/__init__.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/artifacts/__init__.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/client/__init__.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/client/grpc_bridge.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/client/response_wrapper.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/exceptions/__init__.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/exceptions/exceptions.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/rapida_client_options.py +1 -1
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/rapida_environment.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/rapida_region.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/tests/__init__.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/tests/test_rapida_client.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/tests/test_rapida_client_options.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida/tests/test_values.py +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida_python.egg-info/SOURCES.txt +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida_python.egg-info/dependency_links.txt +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/rapida_python.egg-info/top_level.txt +0 -0
- {rapida-python-0.1.2a0 → rapida_python-0.1.4a0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.1.
|
|
2
|
+
Name: rapida_python
|
|
3
|
+
Version: 0.1.4a0
|
|
4
4
|
Summary: rapidaAi sdk to integrate rapida.ai api's
|
|
5
5
|
Home-page: https://github.com/rapidaai/rapida-python
|
|
6
6
|
Author-email: code@rapida.ai
|
|
@@ -12,6 +12,7 @@ Classifier: Environment :: Web Environment
|
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Requires-Python: >=3.9
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
+
Provides-Extra: dev
|
|
15
16
|
Provides-Extra: grpcio-tools
|
|
16
17
|
|
|
17
18
|
## Table Of Contents
|
|
@@ -22,32 +22,35 @@
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
import logging
|
|
25
|
-
from typing import AsyncIterator, Dict, List, Optional, Mapping
|
|
25
|
+
from typing import AsyncIterator, Dict, List, Optional, Mapping, Iterable
|
|
26
26
|
from google.protobuf.json_format import ParseDict
|
|
27
27
|
from google.protobuf.any_pb2 import Any
|
|
28
28
|
from google.protobuf.struct_pb2 import Struct
|
|
29
|
+
|
|
29
30
|
from rapida.client.response_wrapper import InvokeResponseWrapper
|
|
30
31
|
from rapida.artifacts.protos import (
|
|
31
32
|
common_pb2,
|
|
32
33
|
integration_api_pb2,
|
|
33
34
|
integration_api_pb2_grpc,
|
|
34
35
|
invoker_api_pb2,
|
|
35
|
-
invoker_api_pb2_grpc,
|
|
36
|
+
invoker_api_pb2_grpc, talk_api_pb2_grpc,
|
|
37
|
+
talk_api_pb2
|
|
36
38
|
)
|
|
37
39
|
from rapida.client.grpc_bridge import GRPCBridge
|
|
40
|
+
from rapida.values import StringValue
|
|
38
41
|
|
|
39
42
|
_log = logging.getLogger("rapida.client.rapida_bridge")
|
|
40
43
|
|
|
41
44
|
|
|
42
45
|
class RapidaBridge(GRPCBridge):
|
|
43
46
|
def __init__(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
self,
|
|
48
|
+
service_url: str,
|
|
49
|
+
rapida_api_key: str,
|
|
50
|
+
rapida_region: str,
|
|
51
|
+
rapida_environment: str,
|
|
52
|
+
rapida_source: str,
|
|
53
|
+
rapida_is_secure: bool,
|
|
51
54
|
):
|
|
52
55
|
"""
|
|
53
56
|
|
|
@@ -67,12 +70,12 @@ class RapidaBridge(GRPCBridge):
|
|
|
67
70
|
)
|
|
68
71
|
|
|
69
72
|
async def make_invoke_call(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
self,
|
|
74
|
+
endpoint_id: int,
|
|
75
|
+
version: str,
|
|
76
|
+
body_params: Mapping[str, Any],
|
|
77
|
+
metadata: Optional[Dict[str, str]],
|
|
78
|
+
override_options: Optional[Dict[str, str]],
|
|
76
79
|
) -> InvokeResponseWrapper:
|
|
77
80
|
"""
|
|
78
81
|
Endpoint request to the rapida api endpoint servers
|
|
@@ -105,7 +108,7 @@ class RapidaBridge(GRPCBridge):
|
|
|
105
108
|
)
|
|
106
109
|
|
|
107
110
|
async def make_probe_call(
|
|
108
|
-
|
|
111
|
+
self, rapida_audit_id: int
|
|
109
112
|
) -> invoker_api_pb2.ProbeResponse:
|
|
110
113
|
"""
|
|
111
114
|
To get details about the request for given request id
|
|
@@ -126,7 +129,7 @@ class RapidaBridge(GRPCBridge):
|
|
|
126
129
|
)
|
|
127
130
|
|
|
128
131
|
async def make_update_call(
|
|
129
|
-
|
|
132
|
+
self, rapida_audit_id: int, rapida_metadata: Optional[Dict[str, str]]
|
|
130
133
|
) -> invoker_api_pb2.UpdateResponse:
|
|
131
134
|
"""
|
|
132
135
|
Provide an interface to update the metadata for executed request
|
|
@@ -152,15 +155,15 @@ class RapidaBridge(GRPCBridge):
|
|
|
152
155
|
response, invoker_api_pb2.UpdateResponse(), ignore_unknown_fields=True
|
|
153
156
|
)
|
|
154
157
|
|
|
155
|
-
async def
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
async def make_chat_call(
|
|
159
|
+
self,
|
|
160
|
+
cred: Dict,
|
|
161
|
+
provider: str,
|
|
162
|
+
model: str,
|
|
163
|
+
conversations: List[common_pb2.Message],
|
|
164
|
+
tool_definitions: List[integration_api_pb2.ToolDefinition],
|
|
165
|
+
model_parameters: List[integration_api_pb2.ModelParameter],
|
|
166
|
+
meta: Mapping[str, str] = None,
|
|
164
167
|
) -> integration_api_pb2.ChatResponse:
|
|
165
168
|
"""
|
|
166
169
|
Asynchronously initiates a chat interaction with the Rapida service.
|
|
@@ -216,15 +219,15 @@ class RapidaBridge(GRPCBridge):
|
|
|
216
219
|
response, integration_api_pb2.ChatResponse(), ignore_unknown_fields=True
|
|
217
220
|
)
|
|
218
221
|
|
|
219
|
-
async def
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
222
|
+
async def make_generate_call(
|
|
223
|
+
self,
|
|
224
|
+
cred: Dict,
|
|
225
|
+
provider: str,
|
|
226
|
+
model: str,
|
|
227
|
+
system_prompt: str,
|
|
228
|
+
prompt: str,
|
|
229
|
+
model_parameters: Mapping[str, str] = None,
|
|
230
|
+
meta: Mapping[str, str] = None,
|
|
228
231
|
) -> integration_api_pb2.GenerateResponse:
|
|
229
232
|
"""
|
|
230
233
|
Prepares and sends a generation request to the Rapida service.
|
|
@@ -278,14 +281,14 @@ class RapidaBridge(GRPCBridge):
|
|
|
278
281
|
response, integration_api_pb2.GenerateResponse(), ignore_unknown_fields=True
|
|
279
282
|
)
|
|
280
283
|
|
|
281
|
-
async def
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
async def make_embedding_call(
|
|
285
|
+
self,
|
|
286
|
+
cred: Dict,
|
|
287
|
+
provider: str,
|
|
288
|
+
model: str,
|
|
289
|
+
contents: List[str],
|
|
290
|
+
model_parameters: Mapping[str, str] = None,
|
|
291
|
+
meta: Mapping[str, str] = None,
|
|
289
292
|
) -> integration_api_pb2.EmbeddingResponse:
|
|
290
293
|
|
|
291
294
|
credentials = Struct()
|
|
@@ -297,7 +300,7 @@ class RapidaBridge(GRPCBridge):
|
|
|
297
300
|
args.append(
|
|
298
301
|
integration_api_pb2.ModelParameter(
|
|
299
302
|
key=k,
|
|
300
|
-
value=v,
|
|
303
|
+
value=StringValue(v),
|
|
301
304
|
)
|
|
302
305
|
)
|
|
303
306
|
|
|
@@ -324,15 +327,15 @@ class RapidaBridge(GRPCBridge):
|
|
|
324
327
|
ignore_unknown_fields=True,
|
|
325
328
|
)
|
|
326
329
|
|
|
327
|
-
async def
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
330
|
+
async def make_chat_stream(
|
|
331
|
+
self,
|
|
332
|
+
cred: Dict,
|
|
333
|
+
provider: str,
|
|
334
|
+
model: str,
|
|
335
|
+
conversations: List[common_pb2.Message],
|
|
336
|
+
tool_definitions: List[integration_api_pb2.ToolDefinition],
|
|
337
|
+
model_parameters: List[integration_api_pb2.ModelParameter],
|
|
338
|
+
meta: Mapping[str, str] = None,
|
|
336
339
|
) -> AsyncIterator[integration_api_pb2.ChatResponse]:
|
|
337
340
|
"""
|
|
338
341
|
Asynchronously initiates a chat interaction with the Rapida service and streams the responses.
|
|
@@ -372,18 +375,77 @@ class RapidaBridge(GRPCBridge):
|
|
|
372
375
|
|
|
373
376
|
# Stream the chat response from the gRPC server
|
|
374
377
|
async for response in self.fetch_stream(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
378
|
+
stub=integration_api_pb2_grpc.RapidaServiceStub,
|
|
379
|
+
attr="StreamChat",
|
|
380
|
+
message_type=integration_api_pb2.ChatRequest(
|
|
381
|
+
credential=integration_api_pb2.Credential(value=credentials),
|
|
382
|
+
model=f"{provider}/{model}",
|
|
383
|
+
conversations=conversations,
|
|
384
|
+
toolDefinitions=tool_definitions,
|
|
385
|
+
modelParameters=model_parameters,
|
|
386
|
+
additionalData=meta,
|
|
387
|
+
),
|
|
388
|
+
preserving_proto_field_name=True,
|
|
386
389
|
):
|
|
387
390
|
yield ParseDict(
|
|
388
391
|
response, integration_api_pb2.ChatResponse(), ignore_unknown_fields=True
|
|
389
392
|
)
|
|
393
|
+
|
|
394
|
+
async def make_initiate_assistant_talk(self,
|
|
395
|
+
assistant_id: int, version: str,
|
|
396
|
+
source: common_pb2.Source,
|
|
397
|
+
params: Mapping[str, Any],
|
|
398
|
+
args: Mapping[str, Any],
|
|
399
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
400
|
+
options: Optional[Dict[str, str]] = None
|
|
401
|
+
) -> talk_api_pb2.InitiateAssistantTalkResponse:
|
|
402
|
+
response = await self.fetch(
|
|
403
|
+
stub=talk_api_pb2_grpc.TalkServiceStub,
|
|
404
|
+
attr="InitiateAssistantTalk",
|
|
405
|
+
message_type=talk_api_pb2.InitiateAssistantTalkRequest(
|
|
406
|
+
assistant=talk_api_pb2.AssistantDefinition(
|
|
407
|
+
assistantId=assistant_id, version=version
|
|
408
|
+
),
|
|
409
|
+
source=source,
|
|
410
|
+
params=talk_api_pb2.InitiateAssistantTalkParameter(items=params),
|
|
411
|
+
args=args,
|
|
412
|
+
metadata=metadata,
|
|
413
|
+
options=options,
|
|
414
|
+
),
|
|
415
|
+
preserving_proto_field_name=True,
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
return ParseDict(
|
|
419
|
+
response,
|
|
420
|
+
talk_api_pb2.InitiateAssistantTalkResponse(),
|
|
421
|
+
ignore_unknown_fields=True,
|
|
422
|
+
)
|
|
423
|
+
|
|
424
|
+
async def make_initiate_bulk_assistant_talk(self,
|
|
425
|
+
assistant_id: int, version: str,
|
|
426
|
+
source: common_pb2.Source,
|
|
427
|
+
params: Iterable[Mapping[str, Any]],
|
|
428
|
+
args: Mapping[str, Any],
|
|
429
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
430
|
+
options: Optional[Dict[str, str]] = None
|
|
431
|
+
) -> talk_api_pb2.InitiateBulkAssistantTalkResponse:
|
|
432
|
+
response = await self.fetch(
|
|
433
|
+
stub=talk_api_pb2_grpc.TalkServiceStub,
|
|
434
|
+
attr="InitiateBulkAssistantTalk",
|
|
435
|
+
message_type=talk_api_pb2.InitiateBulkAssistantTalkRequest(
|
|
436
|
+
assistant=talk_api_pb2.AssistantDefinition(
|
|
437
|
+
assistantId=assistant_id, version=version
|
|
438
|
+
),
|
|
439
|
+
source=source,
|
|
440
|
+
params=[talk_api_pb2.InitiateAssistantTalkParameter(items=p) for p in params],
|
|
441
|
+
args=args,
|
|
442
|
+
metadata=metadata,
|
|
443
|
+
options=options,
|
|
444
|
+
),
|
|
445
|
+
preserving_proto_field_name=True,
|
|
446
|
+
)
|
|
447
|
+
return ParseDict(
|
|
448
|
+
response,
|
|
449
|
+
talk_api_pb2.InitiateBulkAssistantTalkResponse(),
|
|
450
|
+
ignore_unknown_fields=True,
|
|
451
|
+
)
|
|
@@ -22,9 +22,12 @@
|
|
|
22
22
|
|
|
23
23
|
import warnings
|
|
24
24
|
from typing import AsyncIterator, Dict, List, Union, Optional, Tuple, Mapping
|
|
25
|
+
|
|
26
|
+
from google.protobuf.json_format import ParseDict, MessageToDict
|
|
27
|
+
|
|
28
|
+
from rapida.rapida_source import RapidaSource
|
|
25
29
|
from rapida.client.rapida_bridge import RapidaBridge
|
|
26
30
|
from rapida.client.response_wrapper import (
|
|
27
|
-
ToolDefinition,
|
|
28
31
|
InvokeResponseWrapper,
|
|
29
32
|
Message,
|
|
30
33
|
ToolDefinition,
|
|
@@ -33,10 +36,12 @@ from rapida.rapida_client_options import RapidaClientOptions
|
|
|
33
36
|
from rapida.exceptions import RapidaException
|
|
34
37
|
from rapida.exceptions.exceptions import handle_request_exception
|
|
35
38
|
from rapida.exceptions.exceptions import RapidaConfigurationException
|
|
36
|
-
from rapida.artifacts.protos import common_pb2, integration_api_pb2
|
|
39
|
+
from rapida.artifacts.protos import common_pb2, integration_api_pb2, talk_api_pb2
|
|
37
40
|
from rapida.artifacts.protos.invoker_api_pb2 import InvokerError
|
|
38
41
|
from google.protobuf.any_pb2 import Any
|
|
39
42
|
|
|
43
|
+
from rapida.values import MapToDict
|
|
44
|
+
|
|
40
45
|
|
|
41
46
|
class RapidaClient:
|
|
42
47
|
# an client/bridge of rapida endpoint
|
|
@@ -85,18 +90,18 @@ class RapidaEndpointClient(RapidaClient):
|
|
|
85
90
|
)
|
|
86
91
|
|
|
87
92
|
def _endpoint_params(
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
self,
|
|
94
|
+
endpoint: Tuple[int, Union[str, None]],
|
|
90
95
|
) -> Tuple[int, str]:
|
|
91
96
|
rapida_endpoint, rapida_endpoint_version = endpoint
|
|
92
97
|
if rapida_endpoint is None:
|
|
93
98
|
raise Exception(
|
|
94
|
-
"The endpoint
|
|
99
|
+
"The endpoint id is required. Please provide a endpoint id.",
|
|
95
100
|
)
|
|
96
101
|
|
|
97
102
|
if rapida_endpoint_version is None:
|
|
98
103
|
warnings.warn(
|
|
99
|
-
"The version is
|
|
104
|
+
"The version is optional. Default latest will be used.",
|
|
100
105
|
)
|
|
101
106
|
return rapida_endpoint, "latest"
|
|
102
107
|
return rapida_endpoint, rapida_endpoint_version
|
|
@@ -122,17 +127,17 @@ class RapidaEndpointClient(RapidaClient):
|
|
|
122
127
|
return _extras
|
|
123
128
|
|
|
124
129
|
async def invoke(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
) -> InvokeResponseWrapper:
|
|
130
|
+
self,
|
|
131
|
+
endpoint: Tuple[int, Union[str, None]],
|
|
132
|
+
arguments: Mapping[str, Any],
|
|
133
|
+
metadata: Optional[Dict[str, str]] = None,
|
|
134
|
+
options: Optional[Dict[str, Any]] = None,
|
|
135
|
+
) -> InvokeResponseWrapper | None:
|
|
131
136
|
"""
|
|
132
137
|
Invokes a deployment with the specified key.
|
|
133
138
|
|
|
134
139
|
Args:
|
|
135
|
-
|
|
140
|
+
arguments: Dictionary of input parameters for the prompts
|
|
136
141
|
metadata: Dictionary of metadata for the current execution
|
|
137
142
|
options: Dictionary of options for the override parameters for the model
|
|
138
143
|
endpoint (int, str): The endpoint key.
|
|
@@ -147,15 +152,15 @@ class RapidaEndpointClient(RapidaClient):
|
|
|
147
152
|
response = await self.rapida_bridge.make_invoke_call(
|
|
148
153
|
endpoint_id,
|
|
149
154
|
endpoint_version,
|
|
150
|
-
|
|
155
|
+
arguments,
|
|
151
156
|
metadata,
|
|
152
157
|
options,
|
|
153
158
|
)
|
|
154
159
|
|
|
155
160
|
if response.is_success():
|
|
156
161
|
return response
|
|
157
|
-
|
|
158
162
|
self.handle_deployment_exception(response.error)
|
|
163
|
+
return None
|
|
159
164
|
|
|
160
165
|
async def update_metadata(self, rapida_audit_id: int, rapida_metadata: Dict):
|
|
161
166
|
"""
|
|
@@ -178,18 +183,20 @@ class RapidaEndpointClient(RapidaClient):
|
|
|
178
183
|
if response.success:
|
|
179
184
|
return response
|
|
180
185
|
self.handle_deployment_exception(response.error)
|
|
186
|
+
return None
|
|
181
187
|
|
|
182
188
|
async def probe(self, rapida_audit_id: int):
|
|
183
189
|
"""
|
|
184
190
|
Probe request for given endpoint audit id
|
|
185
191
|
Args:
|
|
186
|
-
|
|
192
|
+
rapida_audit_id: request id for probe
|
|
187
193
|
|
|
188
194
|
"""
|
|
189
195
|
response = await self.rapida_bridge.make_probe_call(rapida_audit_id)
|
|
190
196
|
if response.success:
|
|
191
197
|
return response
|
|
192
198
|
self.handle_deployment_exception(response.error)
|
|
199
|
+
return None
|
|
193
200
|
|
|
194
201
|
def handle_deployment_exception(self, error: Union[None, InvokerError]):
|
|
195
202
|
"""
|
|
@@ -227,14 +234,14 @@ class RapidaGatewayClient(RapidaClient):
|
|
|
227
234
|
)
|
|
228
235
|
|
|
229
236
|
async def chat(
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
237
|
+
self,
|
|
238
|
+
credentials: Dict,
|
|
239
|
+
provider: str,
|
|
240
|
+
model: str,
|
|
241
|
+
conversations: List[Message],
|
|
242
|
+
tools: List[ToolDefinition] = None,
|
|
243
|
+
model_parameters: Mapping[str, Any] = None,
|
|
244
|
+
meta: Mapping[str, str] = None,
|
|
238
245
|
) -> integration_api_pb2.ChatResponse:
|
|
239
246
|
|
|
240
247
|
conv: List[common_pb2.Message] = []
|
|
@@ -255,7 +262,7 @@ class RapidaGatewayClient(RapidaClient):
|
|
|
255
262
|
for v in tools:
|
|
256
263
|
tool_definitions.append(v.to_tool_definition())
|
|
257
264
|
|
|
258
|
-
return await self.rapida_bridge.
|
|
265
|
+
return await self.rapida_bridge.make_chat_call(
|
|
259
266
|
cred=credentials,
|
|
260
267
|
provider=provider,
|
|
261
268
|
model=model,
|
|
@@ -266,14 +273,14 @@ class RapidaGatewayClient(RapidaClient):
|
|
|
266
273
|
)
|
|
267
274
|
|
|
268
275
|
async def chat_stream(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
276
|
+
self,
|
|
277
|
+
credentials: Dict,
|
|
278
|
+
provider: str,
|
|
279
|
+
model: str,
|
|
280
|
+
conversations: List[Message],
|
|
281
|
+
tools: List[ToolDefinition] = None,
|
|
282
|
+
model_parameters: Mapping[str, Any] = None,
|
|
283
|
+
meta: Mapping[str, str] = None,
|
|
277
284
|
) -> AsyncIterator[integration_api_pb2.ChatResponse]:
|
|
278
285
|
|
|
279
286
|
conv: List[common_pb2.Message] = []
|
|
@@ -294,29 +301,29 @@ class RapidaGatewayClient(RapidaClient):
|
|
|
294
301
|
for v in tools:
|
|
295
302
|
tool_definitions.append(v.to_tool_definition())
|
|
296
303
|
|
|
297
|
-
async for response in self.rapida_bridge.
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
304
|
+
async for response in self.rapida_bridge.make_chat_stream(
|
|
305
|
+
cred=credentials,
|
|
306
|
+
provider=provider,
|
|
307
|
+
model=model,
|
|
308
|
+
conversations=conv,
|
|
309
|
+
tool_definitions=tool_definitions,
|
|
310
|
+
model_parameters=args,
|
|
311
|
+
meta=meta,
|
|
305
312
|
):
|
|
306
313
|
yield response
|
|
307
314
|
|
|
308
315
|
async def generate(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
316
|
+
self,
|
|
317
|
+
cred: Dict,
|
|
318
|
+
provider: str,
|
|
319
|
+
model: str,
|
|
320
|
+
system_prompt: str,
|
|
321
|
+
prompt: str,
|
|
322
|
+
model_parameters: Mapping[str, str],
|
|
323
|
+
meta: Mapping[str, str],
|
|
317
324
|
):
|
|
318
325
|
|
|
319
|
-
return await self.rapida_bridge.
|
|
326
|
+
return await self.rapida_bridge.make_generate_call(
|
|
320
327
|
cred=cred,
|
|
321
328
|
provider=provider,
|
|
322
329
|
model=model,
|
|
@@ -327,15 +334,15 @@ class RapidaGatewayClient(RapidaClient):
|
|
|
327
334
|
)
|
|
328
335
|
|
|
329
336
|
async def embedding(
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
self,
|
|
338
|
+
cred: Dict,
|
|
339
|
+
provider: str,
|
|
340
|
+
model: str,
|
|
341
|
+
contents: List[str],
|
|
342
|
+
model_parameters: Mapping[str, str],
|
|
343
|
+
meta: Mapping[str, str],
|
|
337
344
|
):
|
|
338
|
-
return await self.rapida_bridge.
|
|
345
|
+
return await self.rapida_bridge.make_embedding_call(
|
|
339
346
|
cred=cred,
|
|
340
347
|
provider=provider,
|
|
341
348
|
model=model,
|
|
@@ -360,4 +367,89 @@ class RapidaAssistantClient(RapidaClient):
|
|
|
360
367
|
rapida_region=options.rapida_region.get(),
|
|
361
368
|
rapida_environment=options.rapida_environment.get(),
|
|
362
369
|
rapida_is_secure=options.is_secure,
|
|
370
|
+
rapida_source=options.rapida_source.get(),
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
def _assistant_params(
|
|
374
|
+
self,
|
|
375
|
+
assistant: Tuple[int, Union[str, None]],
|
|
376
|
+
) -> Tuple[int, str]:
|
|
377
|
+
assistant_id, assistant_version = assistant
|
|
378
|
+
if assistant_id is None:
|
|
379
|
+
raise Exception(
|
|
380
|
+
"The assistant id is required. Please provide a assistant id.",
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
if assistant_version is None:
|
|
384
|
+
warnings.warn(
|
|
385
|
+
"The version is optional. Default latest will be used.",
|
|
386
|
+
)
|
|
387
|
+
return assistant_id, "latest"
|
|
388
|
+
return assistant_id, assistant_version
|
|
389
|
+
|
|
390
|
+
async def initiate_assistant_deployment(self,
|
|
391
|
+
assistant: Tuple[int, Union[str, None]],
|
|
392
|
+
source: RapidaSource,
|
|
393
|
+
params: Mapping[str, Any],
|
|
394
|
+
arguments: Optional[Mapping[str, Any]] = None,
|
|
395
|
+
metadata: Optional[Mapping[str, Any]] = None,
|
|
396
|
+
options: Optional[Mapping[
|
|
397
|
+
str, Any]] = None) -> Dict | None:
|
|
398
|
+
assistant_id, version = self._assistant_params(assistant)
|
|
399
|
+
response = await self.rapida_bridge.make_initiate_assistant_talk(
|
|
400
|
+
assistant_id,
|
|
401
|
+
version,
|
|
402
|
+
source.source(),
|
|
403
|
+
params,
|
|
404
|
+
arguments,
|
|
405
|
+
metadata,
|
|
406
|
+
options,
|
|
407
|
+
|
|
408
|
+
)
|
|
409
|
+
if response.success:
|
|
410
|
+
return MapToDict(response.data.items)
|
|
411
|
+
self.handle_assistant_exception(response.error)
|
|
412
|
+
return None
|
|
413
|
+
|
|
414
|
+
async def initiate_bulk_assistant_deployment(self,
|
|
415
|
+
assistant: Tuple[int, Union[str, None]],
|
|
416
|
+
source: RapidaSource,
|
|
417
|
+
params: List[Dict[str, Any]],
|
|
418
|
+
arguments: Optional[Dict[str, Any]] = None,
|
|
419
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
420
|
+
options: Optional[Dict[str, Any]] = None) -> List[Dict] | None:
|
|
421
|
+
assistant_id, version = self._assistant_params(assistant)
|
|
422
|
+
response = await self.rapida_bridge.make_initiate_bulk_assistant_talk(
|
|
423
|
+
assistant_id,
|
|
424
|
+
version,
|
|
425
|
+
source.source(),
|
|
426
|
+
params,
|
|
427
|
+
arguments,
|
|
428
|
+
metadata,
|
|
429
|
+
options,
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
if response.success:
|
|
433
|
+
return [MapToDict(proto_map.items) for proto_map in response.data]
|
|
434
|
+
self.handle_assistant_exception(response.error)
|
|
435
|
+
return None
|
|
436
|
+
|
|
437
|
+
def handle_assistant_exception(self, error: Union[None, common_pb2.Error]):
|
|
438
|
+
"""
|
|
439
|
+
Handling exception for all the common endpoint error
|
|
440
|
+
Args:
|
|
441
|
+
error: An instance of invokeError if found in response
|
|
442
|
+
|
|
443
|
+
"""
|
|
444
|
+
|
|
445
|
+
if error is None:
|
|
446
|
+
raise RapidaException(
|
|
447
|
+
code=500,
|
|
448
|
+
message="An unknown error occurred.",
|
|
449
|
+
source="internal client error",
|
|
450
|
+
)
|
|
451
|
+
raise RapidaException(
|
|
452
|
+
code=500,
|
|
453
|
+
message=error.errorMessage,
|
|
454
|
+
source=error.humanMessage,
|
|
363
455
|
)
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
from enum import Enum
|
|
24
24
|
import logging
|
|
25
25
|
|
|
26
|
+
from rapida.artifacts.protos import common_pb2, common_pb2_grpc
|
|
27
|
+
|
|
26
28
|
|
|
27
29
|
class RapidaSource(Enum):
|
|
28
30
|
"""
|
|
@@ -32,21 +34,52 @@ class RapidaSource(Enum):
|
|
|
32
34
|
WEB_PLUGIN = "web-plugin"
|
|
33
35
|
RAPIDA_APP = "rapida-app"
|
|
34
36
|
DEBUGGER = "debugger"
|
|
37
|
+
|
|
38
|
+
# language SDKs
|
|
35
39
|
PYTHON_SDK = "python-sdk"
|
|
36
40
|
NODE_SDK = "node-sdk"
|
|
37
41
|
GO_SDK = "go-sdk"
|
|
38
|
-
TYPESCRIPT_SDK = "typescript-sdk"
|
|
39
42
|
JAVA_SDK = "java-sdk"
|
|
40
43
|
PHP_SDK = "php-sdk"
|
|
41
44
|
RUST_SDK = "rust-sdk"
|
|
45
|
+
REACT_SDK = "react-sdk"
|
|
46
|
+
|
|
47
|
+
# extensions
|
|
42
48
|
TWILIO_CALL = "twilio-call"
|
|
43
49
|
|
|
50
|
+
MAPPING = {
|
|
51
|
+
WEB_PLUGIN: common_pb2.Source.WEB_PLUGIN,
|
|
52
|
+
RAPIDA_APP: common_pb2.Source.RAPIDA_APP,
|
|
53
|
+
PYTHON_SDK: common_pb2.Source.PYTHON_SDK,
|
|
54
|
+
NODE_SDK: common_pb2.Source.NODE_SDK,
|
|
55
|
+
GO_SDK: common_pb2.Source.GO_SDK,
|
|
56
|
+
JAVA_SDK: common_pb2.Source.JAVA_SDK,
|
|
57
|
+
PHP_SDK: common_pb2.Source.PHP_SDK,
|
|
58
|
+
RUST_SDK: common_pb2.Source.RUST_SDK,
|
|
59
|
+
REACT_SDK: common_pb2.Source.REACT_SDK,
|
|
60
|
+
TWILIO_CALL: common_pb2.Source.TWILIO_CALL,
|
|
61
|
+
}
|
|
62
|
+
|
|
44
63
|
def get(self) -> str:
|
|
45
64
|
return str(self.value)
|
|
46
65
|
|
|
66
|
+
def source(self) -> common_pb2.Source:
|
|
67
|
+
mapping = {
|
|
68
|
+
RapidaSource.WEB_PLUGIN: common_pb2.Source.WEB_PLUGIN,
|
|
69
|
+
RapidaSource.RAPIDA_APP: common_pb2.Source.RAPIDA_APP,
|
|
70
|
+
RapidaSource.PYTHON_SDK: common_pb2.Source.PYTHON_SDK,
|
|
71
|
+
RapidaSource.NODE_SDK: common_pb2.Source.NODE_SDK,
|
|
72
|
+
RapidaSource.GO_SDK: common_pb2.Source.GO_SDK,
|
|
73
|
+
RapidaSource.JAVA_SDK: common_pb2.Source.JAVA_SDK,
|
|
74
|
+
RapidaSource.PHP_SDK: common_pb2.Source.PHP_SDK,
|
|
75
|
+
RapidaSource.RUST_SDK: common_pb2.Source.RUST_SDK,
|
|
76
|
+
RapidaSource.REACT_SDK: common_pb2.Source.REACT_SDK,
|
|
77
|
+
RapidaSource.TWILIO_CALL: common_pb2.Source.TWILIO_CALL,
|
|
78
|
+
}
|
|
79
|
+
return mapping.get(self)
|
|
80
|
+
|
|
47
81
|
@staticmethod
|
|
48
82
|
def from_str(label: str):
|
|
49
|
-
logging.info(f"Got the label {label}")
|
|
50
83
|
source_map = {
|
|
51
84
|
"web-plugin": RapidaSource.WEB_PLUGIN,
|
|
52
85
|
"rapida-app": RapidaSource.RAPIDA_APP,
|
|
@@ -54,7 +87,6 @@ class RapidaSource(Enum):
|
|
|
54
87
|
"python-sdk": RapidaSource.PYTHON_SDK,
|
|
55
88
|
"node-sdk": RapidaSource.NODE_SDK,
|
|
56
89
|
"go-sdk": RapidaSource.GO_SDK,
|
|
57
|
-
"typescript-sdk": RapidaSource.TYPESCRIPT_SDK,
|
|
58
90
|
"java-sdk": RapidaSource.JAVA_SDK,
|
|
59
91
|
"php-sdk": RapidaSource.PHP_SDK,
|
|
60
92
|
"rust-sdk": RapidaSource.RUST_SDK,
|
|
@@ -69,3 +101,4 @@ class RapidaSource(Enum):
|
|
|
69
101
|
"'go-sdk', 'typescript-sdk', 'java-sdk', 'php-sdk', 'rust-sdk', 'twilio-call'."
|
|
70
102
|
)
|
|
71
103
|
return result
|
|
104
|
+
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
|
|
23
23
|
import mimetypes
|
|
24
24
|
import re
|
|
25
|
+
import typing
|
|
25
26
|
|
|
26
|
-
from google.protobuf.any_pb2 import Any
|
|
27
27
|
from google.protobuf.wrappers_pb2 import (
|
|
28
28
|
StringValue as _StringValue,
|
|
29
29
|
BytesValue,
|
|
@@ -33,7 +33,9 @@ from google.protobuf.wrappers_pb2 import (
|
|
|
33
33
|
import os
|
|
34
34
|
from PIL import Image
|
|
35
35
|
|
|
36
|
-
from rapida import RapidaException
|
|
36
|
+
from rapida.exceptions.exceptions import RapidaException
|
|
37
|
+
from google.protobuf.any_pb2 import Any
|
|
38
|
+
from google.protobuf import wrappers_pb2, timestamp_pb2, duration_pb2, empty_pb2, struct_pb2, json_format
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
def StringValue(_in: str) -> Any:
|
|
@@ -317,3 +319,53 @@ def URLValue(url: str) -> Any:
|
|
|
317
319
|
any_message.Pack(string_value)
|
|
318
320
|
|
|
319
321
|
return any_message
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def AnyToValue(any_value: Any) -> typing.Any:
|
|
325
|
+
if not any_value or not getattr(any_value, "type_url", None):
|
|
326
|
+
return None
|
|
327
|
+
|
|
328
|
+
type_map: dict[str, typing.Type] = {
|
|
329
|
+
"type.googleapis.com/google.protobuf.StringValue": wrappers_pb2.StringValue,
|
|
330
|
+
"type.googleapis.com/google.protobuf.Int32Value": wrappers_pb2.Int32Value,
|
|
331
|
+
"type.googleapis.com/google.protobuf.Int64Value": wrappers_pb2.Int64Value,
|
|
332
|
+
"type.googleapis.com/google.protobuf.UInt32Value": wrappers_pb2.UInt32Value,
|
|
333
|
+
"type.googleapis.com/google.protobuf.UInt64Value": wrappers_pb2.UInt64Value,
|
|
334
|
+
"type.googleapis.com/google.protobuf.FloatValue": wrappers_pb2.FloatValue,
|
|
335
|
+
"type.googleapis.com/google.protobuf.DoubleValue": wrappers_pb2.DoubleValue,
|
|
336
|
+
"type.googleapis.com/google.protobuf.BoolValue": wrappers_pb2.BoolValue,
|
|
337
|
+
"type.googleapis.com/google.protobuf.BytesValue": wrappers_pb2.BytesValue,
|
|
338
|
+
"type.googleapis.com/google.protobuf.Timestamp": timestamp_pb2.Timestamp,
|
|
339
|
+
"type.googleapis.com/google.protobuf.Duration": duration_pb2.Duration,
|
|
340
|
+
"type.googleapis.com/google.protobuf.Empty": empty_pb2.Empty,
|
|
341
|
+
"type.googleapis.com/google.protobuf.Struct": struct_pb2.Struct,
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
msg_class = type_map.get(any_value.type_url)
|
|
345
|
+
if msg_class:
|
|
346
|
+
msg = msg_class()
|
|
347
|
+
any_value.Unpack(msg)
|
|
348
|
+
|
|
349
|
+
if isinstance(msg, timestamp_pb2.Timestamp):
|
|
350
|
+
return msg.ToDatetime()
|
|
351
|
+
elif isinstance(msg, duration_pb2.Duration):
|
|
352
|
+
return msg.ToTimedelta()
|
|
353
|
+
elif isinstance(msg, empty_pb2.Empty):
|
|
354
|
+
return None
|
|
355
|
+
elif isinstance(msg, struct_pb2.Struct):
|
|
356
|
+
return json_format.MessageToDict(msg)
|
|
357
|
+
elif hasattr(msg, "value"):
|
|
358
|
+
return msg.value
|
|
359
|
+
else:
|
|
360
|
+
return json_format.MessageToDict(msg)
|
|
361
|
+
else:
|
|
362
|
+
return json_format.MessageToJson(any_value)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def MapToDict(proto_map: typing.Mapping[str, Any]) -> dict[str, typing.Any]:
|
|
366
|
+
result: dict[str, typing.Any] = {}
|
|
367
|
+
|
|
368
|
+
for key, any_value in proto_map.items():
|
|
369
|
+
result[key] = AnyToValue(any_value)
|
|
370
|
+
|
|
371
|
+
return result
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rapida-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4a0
|
|
4
4
|
Summary: rapidaAi sdk to integrate rapida.ai api's
|
|
5
5
|
Home-page: https://github.com/rapidaai/rapida-python
|
|
6
6
|
Author-email: code@rapida.ai
|
|
@@ -12,6 +12,7 @@ Classifier: Environment :: Web Environment
|
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Requires-Python: >=3.9
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
|
+
Provides-Extra: dev
|
|
15
16
|
Provides-Extra: grpcio-tools
|
|
16
17
|
|
|
17
18
|
## Table Of Contents
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
[:python_version >= "3.6"]
|
|
3
|
+
idna==3.10
|
|
4
|
+
invoke==2.2.0
|
|
5
|
+
|
|
6
|
+
[:python_version >= "3.7" and python_version < "4.0"]
|
|
7
|
+
grpc-interceptor==0.15.4
|
|
8
|
+
|
|
9
|
+
[:python_version >= "3.8"]
|
|
10
|
+
annotated-types==0.7.0
|
|
11
|
+
attrs==25.3.0
|
|
12
|
+
|
|
13
|
+
[:python_version >= "3.9"]
|
|
14
|
+
aiohappyeyeballs==2.6.1
|
|
15
|
+
aiohttp==3.12.13
|
|
16
|
+
aiosignal==1.3.2
|
|
17
|
+
frozenlist==1.7.0
|
|
18
|
+
grpcio==1.72.1
|
|
19
|
+
grpcio-tools==1.72.1
|
|
20
|
+
multidict==6.5.0
|
|
21
|
+
pillow==11.2.1
|
|
22
|
+
propcache==0.3.2
|
|
23
|
+
protobuf==6.31.1
|
|
24
|
+
pydantic==2.11.7
|
|
25
|
+
pydantic-core==2.33.2
|
|
26
|
+
setuptools==80.9.0
|
|
27
|
+
types-protobuf==6.30.2.20250516
|
|
28
|
+
typing-extensions==4.14.0
|
|
29
|
+
typing-inspection==0.4.1
|
|
30
|
+
yarl==1.20.1
|
|
31
|
+
|
|
32
|
+
[dev]
|
|
33
|
+
pytest
|
|
34
|
+
pytest-cov
|
|
35
|
+
flake8
|
|
36
|
+
black
|
|
37
|
+
mypy
|
|
38
|
+
|
|
39
|
+
[grpcio-tools]
|
|
40
|
+
|
|
41
|
+
[grpcio-tools:python_version >= "3.9"]
|
|
42
|
+
grpcio-tools==1.72.1
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
import os.path
|
|
3
|
+
|
|
4
|
+
from setuptools import find_packages, setup
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def read(*parts):
|
|
8
|
+
with open(os.path.join(*parts)) as f:
|
|
9
|
+
return f.read().strip()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 5 - Production/Stable",
|
|
14
|
+
"Programming Language :: Python :: 3.9",
|
|
15
|
+
"Environment :: Web Environment",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
VERSION = {}
|
|
20
|
+
# version.py defines VERSION and VERSION_SHORT variables.
|
|
21
|
+
# We use exec here to read it so that we don't import scispacy
|
|
22
|
+
with open("rapida/version.py") as version_file:
|
|
23
|
+
exec(version_file.read(), VERSION)
|
|
24
|
+
|
|
25
|
+
setup(
|
|
26
|
+
name="rapida_python",
|
|
27
|
+
version=VERSION["VERSION"],
|
|
28
|
+
author_email="code@rapida.ai",
|
|
29
|
+
description="rapidaAi sdk to integrate rapida.ai api's",
|
|
30
|
+
long_description=read("README.md"),
|
|
31
|
+
long_description_content_type="text/markdown",
|
|
32
|
+
classifiers=classifiers,
|
|
33
|
+
platforms=["POSIX"],
|
|
34
|
+
url="https://github.com/rapidaai/rapida-python",
|
|
35
|
+
packages=find_packages(exclude=["examples", "*.proto"]),
|
|
36
|
+
install_requires=[
|
|
37
|
+
"aiohappyeyeballs==2.6.1; python_version >= '3.9'",
|
|
38
|
+
"aiohttp==3.12.13; python_version >= '3.9'",
|
|
39
|
+
"aiosignal==1.3.2; python_version >= '3.9'",
|
|
40
|
+
"annotated-types==0.7.0; python_version >= '3.8'",
|
|
41
|
+
"attrs==25.3.0; python_version >= '3.8'",
|
|
42
|
+
"frozenlist==1.7.0; python_version >= '3.9'",
|
|
43
|
+
"grpc-interceptor==0.15.4; python_version >= '3.7' and python_version < '4.0'",
|
|
44
|
+
"grpcio==1.72.1; python_version >= '3.9'",
|
|
45
|
+
"grpcio-tools==1.72.1; python_version >= '3.9'",
|
|
46
|
+
"idna==3.10; python_version >= '3.6'",
|
|
47
|
+
"invoke==2.2.0; python_version >= '3.6'",
|
|
48
|
+
"multidict==6.5.0; python_version >= '3.9'",
|
|
49
|
+
"pillow==11.2.1; python_version >= '3.9'",
|
|
50
|
+
"propcache==0.3.2; python_version >= '3.9'",
|
|
51
|
+
"protobuf==6.31.1; python_version >= '3.9'",
|
|
52
|
+
"pydantic==2.11.7; python_version >= '3.9'",
|
|
53
|
+
"pydantic-core==2.33.2; python_version >= '3.9'",
|
|
54
|
+
"setuptools==80.9.0; python_version >= '3.9'",
|
|
55
|
+
"types-protobuf==6.30.2.20250516; python_version >= '3.9'",
|
|
56
|
+
"typing-extensions==4.14.0; python_version >= '3.9'",
|
|
57
|
+
"typing-inspection==0.4.1; python_version >= '3.9'",
|
|
58
|
+
"yarl==1.20.1; python_version >= '3.9'",
|
|
59
|
+
],
|
|
60
|
+
extras_require={
|
|
61
|
+
"dev": [
|
|
62
|
+
"pytest",
|
|
63
|
+
"pytest-cov",
|
|
64
|
+
"flake8",
|
|
65
|
+
"black",
|
|
66
|
+
"mypy",
|
|
67
|
+
],
|
|
68
|
+
"grpcio-tools": ["grpcio-tools==1.72.1; python_version >= '3.9'"],
|
|
69
|
+
},
|
|
70
|
+
tests_require=["pytest", "pytest-cov", "flake8", "black", "mypy"],
|
|
71
|
+
package_data={"rapida-python": ["py.typed"]},
|
|
72
|
+
python_requires=">=3.9",
|
|
73
|
+
include_package_data=True,
|
|
74
|
+
)
|
rapida-python-0.1.2a0/setup.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
import os.path
|
|
3
|
-
|
|
4
|
-
from setuptools import find_packages, setup
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def read(*parts):
|
|
8
|
-
with open(os.path.join(*parts)) as f:
|
|
9
|
-
return f.read().strip()
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
classifiers = [
|
|
13
|
-
"Development Status :: 5 - Production/Stable",
|
|
14
|
-
"Programming Language :: Python :: 3.9",
|
|
15
|
-
"Environment :: Web Environment",
|
|
16
|
-
"Intended Audience :: Developers",
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
VERSION = {}
|
|
20
|
-
# version.py defines VERSION and VERSION_SHORT variables.
|
|
21
|
-
# We use exec here to read it so that we don't import scispacy
|
|
22
|
-
with open("rapida/version.py") as version_file:
|
|
23
|
-
exec(version_file.read(), VERSION)
|
|
24
|
-
|
|
25
|
-
setup(
|
|
26
|
-
name="rapida-python",
|
|
27
|
-
version=VERSION["VERSION"],
|
|
28
|
-
author_email="code@rapida.ai",
|
|
29
|
-
description="rapidaAi sdk to integrate rapida.ai api's",
|
|
30
|
-
long_description=read("README.md"),
|
|
31
|
-
long_description_content_type="text/markdown",
|
|
32
|
-
classifiers=classifiers,
|
|
33
|
-
platforms=["POSIX"],
|
|
34
|
-
url="https://github.com/rapidaai/rapida-python",
|
|
35
|
-
packages=find_packages(exclude=["examples", "*.proto"]),
|
|
36
|
-
install_requires=["grpcio==1.65.4", "protobuf==5.27.3", "pillow==10.4.0"],
|
|
37
|
-
extras_require={
|
|
38
|
-
"grpcio-tools": ["grpcio-tools==1.60.0"],
|
|
39
|
-
},
|
|
40
|
-
tests_require=["pytest", "pytest-cov", "flake8", "black", "mypy"],
|
|
41
|
-
package_data={"rapida-python": ["py.typed"]},
|
|
42
|
-
python_requires=">=3.9",
|
|
43
|
-
include_package_data=True,
|
|
44
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -46,10 +46,10 @@ class RapidaClientOptions:
|
|
|
46
46
|
def __init__(
|
|
47
47
|
self,
|
|
48
48
|
api_key: Optional[str] = None,
|
|
49
|
-
endpoint_url: Optional[str] = None,
|
|
50
49
|
environment: Optional[RapidaEnvironment] = RapidaEnvironment.PRODUCTION,
|
|
51
50
|
region: Optional[RapidaRegion] = RapidaRegion.ALL,
|
|
52
51
|
is_secure: bool = True,
|
|
52
|
+
endpoint_url: Optional[str] = None,
|
|
53
53
|
assistant_url: Optional[str] = None,
|
|
54
54
|
gateway_url: Optional[str] = None,
|
|
55
55
|
):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|