select-ai 1.0.0rc2__tar.gz → 1.1.0rc1__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.

Potentially problematic release.


This version of select-ai might be problematic. Click here for more details.

Files changed (74) hide show
  1. {select_ai-1.0.0rc2/src/select_ai.egg-info → select_ai-1.1.0rc1}/PKG-INFO +1 -1
  2. select_ai-1.1.0rc1/samples/async/vector_index_get_attributes.py +35 -0
  3. select_ai-1.1.0rc1/samples/async/vector_index_update_attributes.py +42 -0
  4. select_ai-1.1.0rc1/samples/vector_index_get_attributes.py +29 -0
  5. select_ai-1.1.0rc1/samples/vector_index_update_attributes.py +34 -0
  6. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/async_profile.py +8 -4
  7. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/base_profile.py +9 -0
  8. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/profile.py +8 -4
  9. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/vector_index.py +106 -21
  10. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/version.py +1 -1
  11. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1/src/select_ai.egg-info}/PKG-INFO +1 -1
  12. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai.egg-info/SOURCES.txt +4 -0
  13. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/LICENSE.txt +0 -0
  14. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/MANIFEST.in +0 -0
  15. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/README.md +0 -0
  16. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/pyproject.toml +0 -0
  17. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/conversation_chat_session.py +0 -0
  18. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/conversations_list.py +0 -0
  19. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/create_ai_credential.py +0 -0
  20. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/delete_ai_credential.py +0 -0
  21. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/disable_ai_provider.py +0 -0
  22. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/enable_ai_provider.py +0 -0
  23. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_chat.py +0 -0
  24. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_create.py +0 -0
  25. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_explain_sql.py +0 -0
  26. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_gen_multi_table_synthetic_data.py +0 -0
  27. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_gen_single_table_synthetic_data.py +0 -0
  28. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_pipeline.py +0 -0
  29. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_run_sql.py +0 -0
  30. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_show_sql.py +0 -0
  31. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profile_sql_concurrent_tasks.py +0 -0
  32. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/profiles_list.py +0 -0
  33. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/vector_index_create.py +0 -0
  34. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/vector_index_delete.py +0 -0
  35. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/vector_index_list.py +0 -0
  36. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/async/vector_index_rag.py +0 -0
  37. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/conversation_chat_session.py +0 -0
  38. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/conversation_create.py +0 -0
  39. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/conversation_delete.py +0 -0
  40. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/conversations_list.py +0 -0
  41. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/create_ai_credential.py +0 -0
  42. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/delete_ai_credential.py +0 -0
  43. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/disable_ai_provider.py +0 -0
  44. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/enable_ai_provider.py +0 -0
  45. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_chat.py +0 -0
  46. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_create.py +0 -0
  47. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_delete.py +0 -0
  48. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_explain_sql.py +0 -0
  49. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_gen_multi_table_synthetic_data.py +0 -0
  50. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_gen_single_table_synthetic_data.py +0 -0
  51. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_narrate.py +0 -0
  52. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_run_sql.py +0 -0
  53. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profile_show_sql.py +0 -0
  54. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/profiles_list.py +0 -0
  55. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/vector_index_create.py +0 -0
  56. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/vector_index_delete.py +0 -0
  57. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/vector_index_list.py +0 -0
  58. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/samples/vector_index_rag.py +0 -0
  59. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/setup.cfg +0 -0
  60. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/__init__.py +0 -0
  61. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/_abc.py +0 -0
  62. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/_enums.py +0 -0
  63. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/_validations.py +0 -0
  64. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/action.py +0 -0
  65. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/conversation.py +0 -0
  66. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/credential.py +0 -0
  67. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/db.py +0 -0
  68. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/errors.py +0 -0
  69. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/provider.py +0 -0
  70. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/sql.py +0 -0
  71. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai/synthetic_data.py +0 -0
  72. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai.egg-info/dependency_links.txt +0 -0
  73. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai.egg-info/requires.txt +0 -0
  74. {select_ai-1.0.0rc2 → select_ai-1.1.0rc1}/src/select_ai.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: select_ai
3
- Version: 1.0.0rc2
3
+ Version: 1.1.0rc1
4
4
  Summary: Select AI for Python
5
5
  Author-email: Abhishek Singh <abhishek.o.singh@oracle.com>
6
6
  Maintainer-email: Abhishek Singh <abhishek.o.singh@oracle.com>
@@ -0,0 +1,35 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Copyright (c) 2025, Oracle and/or its affiliates.
3
+ #
4
+ # Licensed under the Universal Permissive License v 1.0 as shown at
5
+ # http://oss.oracle.com/licenses/upl.
6
+ # -----------------------------------------------------------------------------
7
+
8
+ # -----------------------------------------------------------------------------
9
+ # async/vector_index_get_attributes.py
10
+ #
11
+ # Get vector index attributes
12
+ # -----------------------------------------------------------------------------
13
+
14
+ import asyncio
15
+ import os
16
+
17
+ import select_ai
18
+
19
+ user = os.getenv("SELECT_AI_USER")
20
+ password = os.getenv("SELECT_AI_PASSWORD")
21
+ dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
22
+
23
+
24
+ async def main():
25
+ await select_ai.async_connect(user=user, password=password, dsn=dsn)
26
+
27
+ async_vector_index = select_ai.AsyncVectorIndex(
28
+ index_name="test_vector_index",
29
+ )
30
+ attributes = await async_vector_index.get_attributes()
31
+ print(attributes)
32
+ async_profile = await async_vector_index.get_profile()
33
+ print(async_profile)
34
+
35
+ asyncio.run(main())
@@ -0,0 +1,42 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Copyright (c) 2025, Oracle and/or its affiliates.
3
+ #
4
+ # Licensed under the Universal Permissive License v 1.0 as shown at
5
+ # http://oss.oracle.com/licenses/upl.
6
+ # -----------------------------------------------------------------------------
7
+
8
+ # -----------------------------------------------------------------------------
9
+ # async/vector_index_get_attributes.py
10
+ #
11
+ # Get vector index attributes
12
+ # -----------------------------------------------------------------------------
13
+
14
+ import asyncio
15
+ import os
16
+
17
+ import select_ai
18
+
19
+ user = os.getenv("SELECT_AI_USER")
20
+ password = os.getenv("SELECT_AI_PASSWORD")
21
+ dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
22
+
23
+
24
+ async def main():
25
+ await select_ai.async_connect(user=user, password=password, dsn=dsn)
26
+ async_vector_index = select_ai.AsyncVectorIndex(
27
+ index_name="test_vector_index",
28
+ )
29
+
30
+ # Use vector_index.set_attributes to update a multiple attributes
31
+ updated_attributes = select_ai.OracleVectorIndexAttributes(
32
+ refresh_rate=1450,
33
+ )
34
+ await async_vector_index.set_attributes(attributes=updated_attributes)
35
+
36
+ # Use vector_index.set_attribute to update a single attribute
37
+ await async_vector_index.set_attribute(attribute_name="similarity_threshold", attribute_value=0.5)
38
+ attributes = await async_vector_index.get_attributes()
39
+ print(attributes)
40
+
41
+
42
+ asyncio.run(main())
@@ -0,0 +1,29 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Copyright (c) 2025, Oracle and/or its affiliates.
3
+ #
4
+ # Licensed under the Universal Permissive License v 1.0 as shown at
5
+ # http://oss.oracle.com/licenses/upl.
6
+ # -----------------------------------------------------------------------------
7
+
8
+ # -----------------------------------------------------------------------------
9
+ # vector_index_get_attributes.py
10
+ #
11
+ # Gets attributes for a vector index
12
+ # -----------------------------------------------------------------------------
13
+
14
+ import os
15
+
16
+ import select_ai
17
+
18
+ user = os.getenv("SELECT_AI_USER")
19
+ password = os.getenv("SELECT_AI_PASSWORD")
20
+ dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
21
+
22
+ select_ai.connect(user=user, password=password, dsn=dsn)
23
+
24
+ vector_index = select_ai.VectorIndex(
25
+ index_name="test_vector_index",
26
+ )
27
+
28
+ print(vector_index.get_attributes())
29
+ print(vector_index.get_profile())
@@ -0,0 +1,34 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Copyright (c) 2025, Oracle and/or its affiliates.
3
+ #
4
+ # Licensed under the Universal Permissive License v 1.0 as shown at
5
+ # http://oss.oracle.com/licenses/upl.
6
+ # -----------------------------------------------------------------------------
7
+
8
+ # -----------------------------------------------------------------------------
9
+ # vector_index_get_attributes.py
10
+ #
11
+ # Gets attributes for a vector index
12
+ # -----------------------------------------------------------------------------
13
+
14
+ import os
15
+
16
+ import select_ai
17
+
18
+ user = os.getenv("SELECT_AI_USER")
19
+ password = os.getenv("SELECT_AI_PASSWORD")
20
+ dsn = os.getenv("SELECT_AI_DB_CONNECT_STRING")
21
+ select_ai.connect(user=user, password=password, dsn=dsn)
22
+ vector_index = select_ai.VectorIndex(
23
+ index_name="test_vector_index",
24
+ )
25
+
26
+ # Use vector_index.set_attributes to update a multiple attributes
27
+ updated_attributes = select_ai.OracleVectorIndexAttributes(
28
+ refresh_rate=1450,
29
+ )
30
+ vector_index.set_attributes(attributes=updated_attributes)
31
+
32
+ # Use vector_index.set_attribute to update a single attribute
33
+ vector_index.set_attribute(attribute_name="similarity_threshold", attribute_value=0.5)
34
+ print(vector_index.get_attributes())
@@ -21,7 +21,11 @@ import oracledb
21
21
  import pandas
22
22
 
23
23
  from select_ai.action import Action
24
- from select_ai.base_profile import BaseProfile, ProfileAttributes
24
+ from select_ai.base_profile import (
25
+ BaseProfile,
26
+ ProfileAttributes,
27
+ no_data_for_prompt
28
+ )
25
29
  from select_ai.conversation import AsyncConversation
26
30
  from select_ai.db import async_cursor, async_get_connection
27
31
  from select_ai.errors import ProfileExistsError, ProfileNotFoundError
@@ -347,10 +351,10 @@ class AsyncProfile(BaseProfile):
347
351
  result = await data.read()
348
352
  else:
349
353
  result = None
350
- if action == Action.RUNSQL and result:
354
+ if action == Action.RUNSQL:
355
+ if no_data_for_prompt(result): # empty dataframe
356
+ return pandas.DataFrame()
351
357
  return pandas.DataFrame(json.loads(result))
352
- elif action == Action.RUNSQL:
353
- return pandas.DataFrame()
354
358
  else:
355
359
  return result
356
360
 
@@ -59,6 +59,7 @@ class ProfileAttributes(SelectAIDataClass):
59
59
  constraints: Optional[str] = None
60
60
  conversation: Optional[bool] = None
61
61
  credential_name: Optional[str] = None
62
+ enable_custom_source_uri: Optional[bool] = None
62
63
  enable_sources: Optional[bool] = None
63
64
  enable_source_offsets: Optional[bool] = None
64
65
  enforce_object_list: Optional[bool] = None
@@ -182,3 +183,11 @@ class BaseProfile(ABC):
182
183
  f"{self.__class__.__name__}(profile_name={self.profile_name}, "
183
184
  f"attributes={self.attributes}, description={self.description})"
184
185
  )
186
+
187
+
188
+ def no_data_for_prompt(result) -> bool:
189
+ if result is None:
190
+ return True
191
+ if result == 'No data found for the prompt.':
192
+ return True
193
+ return False
@@ -15,7 +15,11 @@ import pandas
15
15
 
16
16
  from select_ai import Conversation
17
17
  from select_ai.action import Action
18
- from select_ai.base_profile import BaseProfile, ProfileAttributes
18
+ from select_ai.base_profile import (
19
+ BaseProfile,
20
+ ProfileAttributes,
21
+ no_data_for_prompt
22
+ )
19
23
  from select_ai.db import cursor
20
24
  from select_ai.errors import ProfileExistsError, ProfileNotFoundError
21
25
  from select_ai.provider import Provider
@@ -319,10 +323,10 @@ class Profile(BaseProfile):
319
323
  result = data.read()
320
324
  else:
321
325
  result = None
322
- if action == Action.RUNSQL and result:
326
+ if action == Action.RUNSQL:
327
+ if no_data_for_prompt(result): # empty dataframe
328
+ return pandas.DataFrame()
323
329
  return pandas.DataFrame(json.loads(result))
324
- elif action == Action.RUNSQL:
325
- return pandas.DataFrame()
326
330
  else:
327
331
  return result
328
332
 
@@ -17,7 +17,7 @@ from select_ai._abc import SelectAIDataClass
17
17
  from select_ai._enums import StrEnum
18
18
  from select_ai.async_profile import AsyncProfile
19
19
  from select_ai.db import async_cursor, cursor
20
- from select_ai.errors import VectorIndexNotFoundError
20
+ from select_ai.errors import VectorIndexNotFoundError, ProfileNotFoundError
21
21
  from select_ai.profile import Profile
22
22
  from select_ai.sql import (
23
23
  GET_USER_VECTOR_INDEX_ATTRIBUTES,
@@ -89,9 +89,16 @@ class VectorIndexAttributes(SelectAIDataClass):
89
89
  vector_table_name: Optional[str] = None
90
90
  pipeline_name: Optional[str] = None
91
91
 
92
- def json(self, exclude_null=True):
92
+ def json(self, exclude_null=True, for_update=False):
93
93
  attributes = self.dict(exclude_null=exclude_null)
94
94
  attributes.pop("pipeline_name", None)
95
+ # Currently, the following are unmodifiable
96
+ unmodifiable = ["location", "chunk_size", "chunk_overlap",
97
+ "vector_dimension", "vector_table_name",
98
+ "vector_distance_metric"]
99
+ if for_update:
100
+ for key in unmodifiable:
101
+ attributes.pop(key, None)
95
102
  return json.dumps(attributes)
96
103
 
97
104
  @classmethod
@@ -113,7 +120,7 @@ class _BaseVectorIndex(ABC):
113
120
 
114
121
  def __init__(
115
122
  self,
116
- profile: BaseProfile = None,
123
+ profile: Optional[BaseProfile] = None,
117
124
  index_name: Optional[str] = None,
118
125
  description: Optional[str] = None,
119
126
  attributes: Optional[VectorIndexAttributes] = None,
@@ -159,7 +166,7 @@ class VectorIndex(_BaseVectorIndex):
159
166
  :raises: VectorIndexNotFoundError
160
167
  """
161
168
  with cursor() as cr:
162
- cr.execute(GET_USER_VECTOR_INDEX_ATTRIBUTES, index_name=index_name)
169
+ cr.execute(GET_USER_VECTOR_INDEX_ATTRIBUTES, index_name=index_name.upper())
163
170
  attributes = cr.fetchall()
164
171
  if attributes:
165
172
  post_processed_attributes = {}
@@ -269,10 +276,36 @@ class VectorIndex(_BaseVectorIndex):
269
276
  keyword_parameters={"index_name": self.index_name},
270
277
  )
271
278
 
279
+ def set_attribute(
280
+ self,
281
+ attribute_name: str = None,
282
+ attribute_value: Union[str, int, float] = None
283
+ ):
284
+ """
285
+ This procedure updates an existing vector store index with a specified
286
+ value of the vector index attribute.
287
+
288
+ :param str attribute_name: Custom attribute name
289
+ :param Union[str, int, float] attribute_value: Attribute Value
290
+
291
+ """
292
+ setattr(self.attributes, attribute_name, attribute_value)
293
+ parameters = {
294
+ "index_name": self.index_name,
295
+ "attribute_name": attribute_name,
296
+ "attribute_value": attribute_value
297
+ }
298
+ with cursor() as cr:
299
+ cr.callproc(
300
+ "DBMS_CLOUD_AI.UPDATE_VECTOR_INDEX",
301
+ keyword_parameters=parameters,
302
+ )
303
+
304
+
272
305
  def set_attributes(
273
306
  self,
274
- attribute_name: str,
275
- attribute_value: Union[str, int, float],
307
+ attribute_name: Optional[str] = None,
308
+ attribute_value: Optional[Union[str, int, float]] = None,
276
309
  attributes: VectorIndexAttributes = None,
277
310
  ):
278
311
  """
@@ -283,8 +316,8 @@ class VectorIndex(_BaseVectorIndex):
283
316
 
284
317
  :param str attribute_name: Custom attribute name
285
318
  :param Union[str, int, float] attribute_value: Attribute Value
286
- :param VectorIndexAttributes attributes: Specify multiple attributes
287
- to update in a single API invocation
319
+ :param select_ai.VectorIndexAttributes attributes: Use this to
320
+ update multiple attribute values
288
321
  :return: None
289
322
  :raises: oracledb.DatabaseError
290
323
  """
@@ -297,12 +330,12 @@ class VectorIndex(_BaseVectorIndex):
297
330
 
298
331
  parameters = {"index_name": self.index_name}
299
332
  if attributes:
300
- parameters["attributes"] = attributes.json()
333
+ parameters["attributes"] = attributes.json(for_update=True)
301
334
  self.attributes = attributes
302
335
  else:
303
336
  setattr(self.attributes, attribute_name, attribute_value)
304
- parameters["attributes_name"] = attribute_name
305
- parameters["attributes_value"] = attribute_value
337
+ parameters["attribute_name"] = attribute_name
338
+ parameters["attribute_value"] = attribute_value
306
339
 
307
340
  with cursor() as cr:
308
341
  cr.callproc(
@@ -318,6 +351,16 @@ class VectorIndex(_BaseVectorIndex):
318
351
  """
319
352
  return self._get_attributes(self.index_name)
320
353
 
354
+ def get_profile(self) -> Profile:
355
+ """Get Profile object linked to this vector index
356
+
357
+ :return: select_ai.Profile
358
+ :raises: ProfileNotFoundError
359
+ """
360
+ attributes = self._get_attributes(index_name=self.index_name)
361
+ profile = Profile(profile_name=attributes.profile_name)
362
+ return profile
363
+
321
364
  @classmethod
322
365
  def list(cls, index_name_pattern: str = ".*") -> Iterator["VectorIndex"]:
323
366
  """List Vector Indexes
@@ -340,11 +383,15 @@ class VectorIndex(_BaseVectorIndex):
340
383
  else:
341
384
  description = None
342
385
  attributes = cls._get_attributes(index_name=index_name)
386
+ try:
387
+ profile = Profile(profile_name=attributes.profile_name)
388
+ except ProfileNotFoundError:
389
+ profile = None
343
390
  yield cls(
344
391
  index_name=index_name,
345
392
  description=description,
346
393
  attributes=attributes,
347
- profile=Profile(profile_name=attributes.profile_name),
394
+ profile=profile,
348
395
  )
349
396
 
350
397
 
@@ -368,7 +415,7 @@ class AsyncVectorIndex(_BaseVectorIndex):
368
415
  """
369
416
  async with async_cursor() as cr:
370
417
  await cr.execute(
371
- GET_USER_VECTOR_INDEX_ATTRIBUTES, index_name=index_name
418
+ GET_USER_VECTOR_INDEX_ATTRIBUTES, index_name=index_name.upper()
372
419
  )
373
420
  attributes = await cr.fetchall()
374
421
  if attributes:
@@ -478,10 +525,34 @@ class AsyncVectorIndex(_BaseVectorIndex):
478
525
  keyword_parameters={"index_name": self.index_name},
479
526
  )
480
527
 
528
+ async def set_attribute(
529
+ self,
530
+ attribute_name: str,
531
+ attribute_value: Union[str, int, float]
532
+ ) -> None:
533
+ """
534
+ This procedure updates an existing vector store index with a specified
535
+ value of the vector index attribute.
536
+
537
+ :param str attribute_name: Custom attribute name
538
+ :param Union[str, int, float] attribute_value: Attribute Value
539
+
540
+ """
541
+ parameters = {"index_name": self.index_name,
542
+ "attribute_name": attribute_name,
543
+ "attribute_value": attribute_value}
544
+ setattr(self.attributes, attribute_name, attribute_value)
545
+ async with async_cursor() as cr:
546
+ await cr.callproc(
547
+ "DBMS_CLOUD_AI.UPDATE_VECTOR_INDEX",
548
+ keyword_parameters=parameters,
549
+ )
550
+
551
+
481
552
  async def set_attributes(
482
553
  self,
483
- attribute_name: str,
484
- attribute_value: Union[str, int],
554
+ attribute_name: Optional[str] = None,
555
+ attribute_value: Optional[Union[str, int, float]] = None,
485
556
  attributes: VectorIndexAttributes = None,
486
557
  ) -> None:
487
558
  """
@@ -506,11 +577,11 @@ class AsyncVectorIndex(_BaseVectorIndex):
506
577
  parameters = {"index_name": self.index_name}
507
578
  if attributes:
508
579
  self.attributes = attributes
509
- parameters["attributes"] = attributes.json()
580
+ parameters["attributes"] = attributes.json(for_update=True)
510
581
  else:
511
582
  setattr(self.attributes, attribute_name, attribute_value)
512
- parameters["attributes_name"] = attribute_name
513
- parameters["attributes_value"] = attribute_value
583
+ parameters["attribute_name"] = attribute_name
584
+ parameters["attribute_value"] = attribute_value
514
585
 
515
586
  async with async_cursor() as cr:
516
587
  await cr.callproc(
@@ -526,6 +597,16 @@ class AsyncVectorIndex(_BaseVectorIndex):
526
597
  """
527
598
  return await self._get_attributes(index_name=self.index_name)
528
599
 
600
+ async def get_profile(self) -> AsyncProfile:
601
+ """Get AsyncProfile object linked to this vector index
602
+
603
+ :return: select_ai.AsyncProfile
604
+ :raises: ProfileNotFoundError
605
+ """
606
+ attributes = await self._get_attributes(index_name=self.index_name)
607
+ profile = await AsyncProfile(profile_name=attributes.profile_name)
608
+ return profile
609
+
529
610
  @classmethod
530
611
  async def list(
531
612
  cls, index_name_pattern: str = ".*"
@@ -552,11 +633,15 @@ class AsyncVectorIndex(_BaseVectorIndex):
552
633
  else:
553
634
  description = None
554
635
  attributes = await cls._get_attributes(index_name=index_name)
636
+ try:
637
+ profile = await AsyncProfile(
638
+ profile_name=attributes.profile_name,
639
+ )
640
+ except ProfileNotFoundError:
641
+ profile = None
555
642
  yield VectorIndex(
556
643
  index_name=index_name,
557
644
  description=description,
558
645
  attributes=attributes,
559
- profile=await AsyncProfile(
560
- profile_name=attributes.profile_name
561
- ),
646
+ profile=profile
562
647
  )
@@ -5,4 +5,4 @@
5
5
  # http://oss.oracle.com/licenses/upl.
6
6
  # -----------------------------------------------------------------------------
7
7
 
8
- __version__ = "1.0.0rc2"
8
+ __version__ = "1.1.0rc1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: select_ai
3
- Version: 1.0.0rc2
3
+ Version: 1.1.0rc1
4
4
  Summary: Select AI for Python
5
5
  Author-email: Abhishek Singh <abhishek.o.singh@oracle.com>
6
6
  Maintainer-email: Abhishek Singh <abhishek.o.singh@oracle.com>
@@ -22,8 +22,10 @@ samples/profile_show_sql.py
22
22
  samples/profiles_list.py
23
23
  samples/vector_index_create.py
24
24
  samples/vector_index_delete.py
25
+ samples/vector_index_get_attributes.py
25
26
  samples/vector_index_list.py
26
27
  samples/vector_index_rag.py
28
+ samples/vector_index_update_attributes.py
27
29
  samples/async/conversation_chat_session.py
28
30
  samples/async/conversations_list.py
29
31
  samples/async/create_ai_credential.py
@@ -42,8 +44,10 @@ samples/async/profile_sql_concurrent_tasks.py
42
44
  samples/async/profiles_list.py
43
45
  samples/async/vector_index_create.py
44
46
  samples/async/vector_index_delete.py
47
+ samples/async/vector_index_get_attributes.py
45
48
  samples/async/vector_index_list.py
46
49
  samples/async/vector_index_rag.py
50
+ samples/async/vector_index_update_attributes.py
47
51
  src/select_ai/__init__.py
48
52
  src/select_ai/_abc.py
49
53
  src/select_ai/_enums.py
File without changes
File without changes
File without changes
File without changes