Skip to content

Commit

Permalink
feat: add Vector Index API (#894)
Browse files Browse the repository at this point in the history
* chore: Update gapic-generator-python to v1.16.1

PiperOrigin-RevId: 618243632

Source-Link: googleapis/googleapis@078a38b

Source-Link: googleapis/googleapis-gen@7af768c
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2FmNzY4YzNmOGNlNTg5OTQ0ODIzNTBmNzQwMTE3MzMyOTk1MGEzMSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: add Vector Index API

PiperOrigin-RevId: 618867415

Source-Link: googleapis/googleapis@277145d

Source-Link: googleapis/googleapis-gen@adcd307
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWRjZDMwNzY3ODRiNWFlNGU1M2E3YjliZTE1ZDc3MjBjMmMwN2RlNyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Mar 26, 2024
1 parent fc7b906 commit c76f087
Show file tree
Hide file tree
Showing 3 changed files with 2,010 additions and 81 deletions.
46 changes: 46 additions & 0 deletions google/cloud/firestore_admin_v1/types/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ class IndexField(proto.Message):
Indicates that this field supports operations on
``array_value``\ s.
This field is a member of `oneof`_ ``value_mode``.
vector_config (google.cloud.firestore_admin_v1.types.Index.IndexField.VectorConfig):
Indicates that this field supports nearest
neighbors and distance operations on vector.
This field is a member of `oneof`_ ``value_mode``.
"""

Expand Down Expand Up @@ -211,6 +216,41 @@ class ArrayConfig(proto.Enum):
ARRAY_CONFIG_UNSPECIFIED = 0
CONTAINS = 1

class VectorConfig(proto.Message):
r"""The index configuration to support vector search operations
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
dimension (int):
Required. The vector dimension this
configuration applies to.
The resulting index will only include vectors of
this dimension, and can be used for vector
search with the same dimension.
flat (google.cloud.firestore_admin_v1.types.Index.IndexField.VectorConfig.FlatIndex):
Indicates the vector index is a flat index.
This field is a member of `oneof`_ ``type``.
"""

class FlatIndex(proto.Message):
r"""An index that stores vectors in a flat data structure, and
supports exhaustive search.
"""

dimension: int = proto.Field(
proto.INT32,
number=1,
)
flat: "Index.IndexField.VectorConfig.FlatIndex" = proto.Field(
proto.MESSAGE,
number=2,
oneof="type",
message="Index.IndexField.VectorConfig.FlatIndex",
)

field_path: str = proto.Field(
proto.STRING,
number=1,
Expand All @@ -227,6 +267,12 @@ class ArrayConfig(proto.Enum):
oneof="value_mode",
enum="Index.IndexField.ArrayConfig",
)
vector_config: "Index.IndexField.VectorConfig" = proto.Field(
proto.MESSAGE,
number=4,
oneof="value_mode",
message="Index.IndexField.VectorConfig",
)

name: str = proto.Field(
proto.STRING,
Expand Down
Loading

0 comments on commit c76f087

Please sign in to comment.