naas-abi-core 1.1.1__py3-none-any.whl → 1.1.3.dev1__py3-none-any.whl

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.
@@ -1,4 +1,3 @@
1
- import json
2
1
  import subprocess
3
2
  from uuid import uuid4
4
3
 
@@ -103,6 +102,7 @@ class NaasDeployer:
103
102
  image_name: str
104
103
 
105
104
  naas_api_client: NaasAPIClient
105
+ configuration: EngineConfiguration
106
106
 
107
107
  def __init__(self, configuration: EngineConfiguration):
108
108
  self.configuration = configuration
@@ -119,6 +119,14 @@ class NaasDeployer:
119
119
  return {env_var.split("=", 1)[0]: env_var.split("=", 1)[1] for env_var in env}
120
120
 
121
121
  def deploy(self, env: list[str]):
122
+ if self.configuration.deploy is None:
123
+ logger.error(
124
+ "Deploy configuration not found in the yaml configuration file. Please add a deploy section to the configuration file."
125
+ )
126
+ raise ValueError(
127
+ "Deploy configuration not found in the yaml configuration file. Please add a deploy section to the configuration file."
128
+ )
129
+
122
130
  registry = self.naas_api_client.create_registry(
123
131
  self.configuration.deploy.space_name
124
132
  )
@@ -148,7 +156,6 @@ class NaasDeployer:
148
156
 
149
157
  image_name_with_sha = f"{image_name.replace(':' + uid, '')}@{image_sha}"
150
158
 
151
-
152
159
  self.naas_api_client.create_space(
153
160
  Space(
154
161
  name=self.configuration.deploy.space_name,
@@ -159,16 +166,17 @@ class NaasDeployer:
159
166
  port=9879,
160
167
  cpu="1",
161
168
  memory="1Gi",
162
- env=self.env_list_to_dict(env) | {
163
- "NAAS_API_KEY": self.configuration.deploy.naas_api_key,
164
- "ENV": "prod",
165
- },
169
+ # env=self.env_list_to_dict(env) | {
170
+ # "NAAS_API_KEY": self.configuration.deploy.naas_api_key,
171
+ # "ENV": "prod",
172
+ # },
173
+ env=self.configuration.deploy.env | self.env_list_to_dict(env),
166
174
  )
167
175
  ],
168
176
  )
169
177
  )
170
178
 
171
- space = self.naas_api_client.get_space(self.configuration.deploy.space_name)
179
+ self.naas_api_client.get_space(self.configuration.deploy.space_name)
172
180
 
173
181
  Console().print(
174
182
  Markdown(f"""
@@ -183,7 +191,12 @@ class NaasDeployer:
183
191
 
184
192
 
185
193
  @deploy.command("naas")
186
- @click.option("-e", "--env", multiple=True, help="Environment variables to set (e.g. -e FOO=BAR -e BAZ=QUX)")
194
+ @click.option(
195
+ "-e",
196
+ "--env",
197
+ multiple=True,
198
+ help="Environment variables to set (e.g. -e FOO=BAR -e BAZ=QUX)",
199
+ )
187
200
  def naas(env: list[str]):
188
201
  configuration: EngineConfiguration = EngineConfiguration.load_configuration()
189
202
 
@@ -5,6 +5,9 @@ from typing import List
5
5
  import yaml
6
6
  from jinja2 import Template
7
7
  from naas_abi_core import logger
8
+ from naas_abi_core.engine.engine_configuration.EngineConfiguration_Deploy import (
9
+ DeployConfiguration,
10
+ )
8
11
  from naas_abi_core.engine.engine_configuration.EngineConfiguration_ObjectStorageService import (
9
12
  ObjectStorageServiceConfiguration,
10
13
  )
@@ -20,7 +23,7 @@ from naas_abi_core.engine.engine_configuration.EngineConfiguration_VectorStoreSe
20
23
  from naas_abi_core.services.secret.Secret import Secret
21
24
  from pydantic import BaseModel, model_validator
22
25
  from typing_extensions import Literal
23
- from naas_abi_core.engine.engine_configuration.EngineConfiguration_Deploy import DeployConfiguration
26
+
24
27
 
25
28
  class ServicesConfiguration(BaseModel):
26
29
  object_storage: ObjectStorageServiceConfiguration
@@ -80,7 +83,7 @@ class GlobalConfig(BaseModel):
80
83
 
81
84
  class EngineConfiguration(BaseModel):
82
85
  api: ApiConfiguration
83
-
86
+
84
87
  deploy: DeployConfiguration | None = None
85
88
 
86
89
  services: ServicesConfiguration
@@ -4,3 +4,4 @@ class DeployConfiguration(BaseModel):
4
4
  workspace_id: str
5
5
  space_name: str
6
6
  naas_api_key: str
7
+ env: dict[str, str] = {}
@@ -20,11 +20,29 @@ if TYPE_CHECKING:
20
20
 
21
21
 
22
22
  class OxigraphAdapterConfiguration(BaseModel):
23
+ """Oxigraph adapter configuration.
24
+
25
+ triple_store_adapter:
26
+ adapter: "oxigraph"
27
+ config:
28
+ oxigraph_url: "http://localhost:7878"
29
+ timeout: 60
30
+ """
23
31
  oxigraph_url: str = "http://localhost:7878"
24
32
  timeout: int = 60
25
33
 
26
34
 
27
35
  class AWSNeptuneAdapterConfiguration(BaseModel):
36
+ """AWS Neptune adapter configuration.
37
+
38
+ triple_store_adapter:
39
+ adapter: "aws_neptune"
40
+ config:
41
+ aws_region_name: "eu-west-3"
42
+ aws_access_key_id: "{{ secret.AWS_ACCESS_KEY_ID }}"
43
+ aws_secret_access_key: "{{ secret.AWS_SECRET_ACCESS_KEY }}"
44
+ db_instance_identifier: "{{ secret.DB_INSTANCE_IDENTIFIER }}"
45
+ """
28
46
  aws_region_name: str
29
47
  aws_access_key_id: str
30
48
  aws_secret_access_key: str
@@ -32,6 +50,20 @@ class AWSNeptuneAdapterConfiguration(BaseModel):
32
50
 
33
51
 
34
52
  class AWSNeptuneSSHTunnelAdapterConfiguration(AWSNeptuneAdapterConfiguration):
53
+ """AWS Neptune SSH tunnel adapter configuration.
54
+
55
+ triple_store_adapter:
56
+ adapter: "aws_neptune_sshtunnel"
57
+ config:
58
+ aws_region_name: "eu-west-3"
59
+ aws_access_key_id: "{{ secret.AWS_ACCESS_KEY_ID }}"
60
+ aws_secret_access_key: "{{ secret.AWS_SECRET_ACCESS_KEY }}"
61
+ db_instance_identifier: "{{ secret.DB_INSTANCE_IDENTIFIER }}"
62
+ bastion_host: "bastion.example.com"
63
+ bastion_port: 22
64
+ bastion_user: "ubuntu"
65
+ bastion_private_key: "{{ secret.BASTION_PRIVATE_KEY }}"
66
+ """
35
67
  bastion_host: str
36
68
  bastion_port: int
37
69
  bastion_user: str
@@ -39,11 +71,27 @@ class AWSNeptuneSSHTunnelAdapterConfiguration(AWSNeptuneAdapterConfiguration):
39
71
 
40
72
 
41
73
  class TripleStoreAdapterFilesystemConfiguration(BaseModel):
74
+ """Filesystem adapter configuration.
75
+
76
+ triple_store_adapter:
77
+ adapter: "fs"
78
+ config:
79
+ store_path: "storage/triplestore"
80
+ triples_path: "triples"
81
+ """
42
82
  store_path: str
43
83
  triples_path: str = "triples"
44
84
 
45
85
 
46
86
  class TripleStoreAdapterObjectStorageConfiguration(BaseModel):
87
+ """Object storage adapter configuration.
88
+
89
+ triple_store_adapter:
90
+ adapter: "object_storage"
91
+ config:
92
+ object_storage_service: *object_storage_service
93
+ triples_prefix: "triples"
94
+ """
47
95
  object_storage_service: ObjectStorageServiceConfiguration
48
96
  triples_prefix: str = "triples"
49
97
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: naas-abi-core
3
- Version: 1.1.1
3
+ Version: 1.1.3.dev1
4
4
  Summary: Abi framework allowing you to build your AI system.
5
5
  Author-email: Maxime Jublou <maxime@naas.ai>, Florent Ravenel <florent@naas.ai>, Jeremy Ravenel <jeremy@naas.ai>
6
6
  Requires-Python: <4,>=3.10
@@ -11,7 +11,7 @@ naas_abi_core/cli/__init__.py,sha256=P89Ihofvv_pQf2wsfYL-PjLJMl6KRj3fNNIZDB77Qy0
11
11
  naas_abi_core/cli/agent.py,sha256=fMdbC7HsrOfZSf5zVRHWSmyrejI5mUdRlAT5v5YHXzk,658
12
12
  naas_abi_core/cli/chat.py,sha256=3t_TJ7vqCNs0MIIXOtlSke3nzy4rMSEJtB3P6pKItMo,856
13
13
  naas_abi_core/cli/config.py,sha256=CcdDX6HKCP32NjRhbVsCOwLUC9LmaqTm2sv8W5rOt00,1484
14
- naas_abi_core/cli/deploy.py,sha256=Vmjsf44qYvDkWYGFJHhPaoKipt56FEZcfv4Mswys574,5976
14
+ naas_abi_core/cli/deploy.py,sha256=GN2Hyz1xT4lzURPv9_vLHQI1yWP5MleqLZ34HFVFB1k,6512
15
15
  naas_abi_core/cli/init.py,sha256=Pcy2-hy-FvpXf3UOKMP6agWyFrCl9z-KP5ktEWltPy0,220
16
16
  naas_abi_core/cli/module.py,sha256=TBl-SpeGUcy1Rrp40Irbt34yQS00xJcNje-OijNE4Hk,717
17
17
  naas_abi_core/cli/new.py,sha256=aFhKbTHwqYkPdzrd7r8i_h9dfzXNjI03t8qVeqME8w8,262
@@ -21,13 +21,13 @@ naas_abi_core/engine/EngineProxy.py,sha256=o-D8LlP-PjQ_Yct4JWrDZw7mA7yporxb2XrJF
21
21
  naas_abi_core/engine/Engine_test.py,sha256=8eLZEnkL0IR4VAr6LF8fJ_fxZzi9s1mXCLgTVOIsR3E,161
22
22
  naas_abi_core/engine/IEngine.py,sha256=u-m-Qrvt3SP3gYKWPFPVjV8rs05D6NGnzO3XA0FInnw,2865
23
23
  naas_abi_core/engine/conftest.py,sha256=Al-SRVLrEdbTrX8sxQ3bBK4w1bbzE4GoBkzoBK-aXlg,932
24
- naas_abi_core/engine/engine_configuration/EngineConfiguration.py,sha256=12rKgF1LaLC_YMhKEABFSdU_Fb04qGpW4tft3eVCnPI,5529
25
- naas_abi_core/engine/engine_configuration/EngineConfiguration_Deploy.py,sha256=NbPMxiNt9C4zfNF70fs7a8prELpd3QAHbZlvHfwcbxs,134
24
+ naas_abi_core/engine/engine_configuration/EngineConfiguration.py,sha256=OgJJW_iHQjnMOQpxwZR-Iwup6p6mqjCbHgsjR6lxf0k,5535
25
+ naas_abi_core/engine/engine_configuration/EngineConfiguration_Deploy.py,sha256=7nqOnXWcNbQAp9G3afc3y58BrxCaIrrTpUz7yBngy14,163
26
26
  naas_abi_core/engine/engine_configuration/EngineConfiguration_GenericLoader.py,sha256=KK2TQx6cNmoqFcwr9En00NKrX4ckkZl4ecv9QCUwPyc,1995
27
27
  naas_abi_core/engine/engine_configuration/EngineConfiguration_ObjectStorageService.py,sha256=cPZBs5-2dqX-piIZ7KTqiOce6O6GbnDDwjPGcfDN_U4,4736
28
28
  naas_abi_core/engine/engine_configuration/EngineConfiguration_ObjectStorageService_test.py,sha256=h1PdIbMTJWi_lG83YgpI6zg8gRo0WEWvGSE6R4uKQp4,1063
29
29
  naas_abi_core/engine/engine_configuration/EngineConfiguration_SecretService.py,sha256=nqQ7XmfZZIx4kUvSO_FkBsSf9mcrRdwpsF_vkEdKqgU,4064
30
- naas_abi_core/engine/engine_configuration/EngineConfiguration_TripleStoreService.py,sha256=XCyn1DO3oW7xPlrfmD1lo3GPymDCVDPI-QXw-lbzzIQ,6278
30
+ naas_abi_core/engine/engine_configuration/EngineConfiguration_TripleStoreService.py,sha256=Wy4866k9JykcMf9ZDqBZfIVFLp98oU3_NwIaDPHrykI,7756
31
31
  naas_abi_core/engine/engine_configuration/EngineConfiguration_VectorStoreService.py,sha256=aoO-cmC1dfaXT4gqFivrO1ntB0xK8rjFoWmruf-I67U,2210
32
32
  naas_abi_core/engine/engine_configuration/EngineConfiguration_test.py,sha256=PL4A4Dawq6tfyHsiIkqbHhovc7wkIHcVZra6llRI-CY,286
33
33
  naas_abi_core/engine/engine_configuration/utils/PydanticModelValidator.py,sha256=jZzLqLvR8HawpyGYiUJEng3NlebLHiN3mVFOzNDSWs8,504
@@ -123,7 +123,7 @@ naas_abi_core/utils/onto2py/tests/ttl2py_test.py,sha256=5OZqSxPffjJYiX9T4rT1mV0P
123
123
  naas_abi_core/workflow/__init__.py,sha256=hZD58mCB1PApxITqftP_xgjxL7NeLvOfI-rJENg1ENs,250
124
124
  naas_abi_core/workflow/workflow.py,sha256=ZufSS073JztVl0OQRTqNyK7FepFvv7gXlc4j5FAEZCI,1216
125
125
  assets/favicon.ico,sha256=nWk8wrHZiJV3DeuWrP2MqilXxCuoNWKGtMZfYmEVQLw,666
126
- naas_abi_core-1.1.1.dist-info/METADATA,sha256=N_uONUiksIeNE7DwwW1hWeFUTNDYehPFo2d9LsEHtuE,3897
127
- naas_abi_core-1.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
128
- naas_abi_core-1.1.1.dist-info/entry_points.txt,sha256=q68PvlGw_rozZ0nl6mUg6l1l2IhxaTOKlf5K9goRDu0,99
129
- naas_abi_core-1.1.1.dist-info/RECORD,,
126
+ naas_abi_core-1.1.3.dev1.dist-info/METADATA,sha256=CkhEkz14FB3RCMqWAcUmqwXDRdUNS3-JSmiatOtetyA,3902
127
+ naas_abi_core-1.1.3.dev1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
128
+ naas_abi_core-1.1.3.dev1.dist-info/entry_points.txt,sha256=q68PvlGw_rozZ0nl6mUg6l1l2IhxaTOKlf5K9goRDu0,99
129
+ naas_abi_core-1.1.3.dev1.dist-info/RECORD,,