Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions weaviate/collections/classes/config_named_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,7 @@ def text2vec_palm(
modelId=model_id,
vectorizeClassName=vectorize_collection_name,
titleProperty=title_property,
taskType=None,
),
vector_index_config=vector_index_config,
)
Expand Down Expand Up @@ -1026,6 +1027,7 @@ def text2vec_google(
modelId=model_id,
vectorizeClassName=vectorize_collection_name,
titleProperty=title_property,
taskType=None,
),
vector_index_config=vector_index_config,
)
Expand Down Expand Up @@ -1067,6 +1069,7 @@ def text2vec_google_aistudio(
modelId=model_id,
vectorizeClassName=vectorize_collection_name,
titleProperty=title_property,
taskType=None,
),
vector_index_config=vector_index_config,
)
Expand Down
4 changes: 4 additions & 0 deletions weaviate/collections/classes/config_vectorizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ class _Text2VecGoogleConfig(_VectorizerConfigCreate):
modelId: Optional[str]
vectorizeClassName: bool
titleProperty: Optional[str]
taskType: Optional[str]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can set a default here with taskType: Optional[str] = None and then you don't have to set it for every config manually :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense. I do see one benefit of this which is that the default is visible on the tooltip.

I'll leave it for now, but add a todo comment to consider making this change, since the whole file is like this.



class _Text2VecTransformersConfig(_VectorizerConfigCreate):
Expand Down Expand Up @@ -1149,6 +1150,7 @@ def text2vec_palm(
modelId=model_id,
vectorizeClassName=vectorize_collection_name,
titleProperty=title_property,
taskType=None,
)

@staticmethod
Expand Down Expand Up @@ -1177,6 +1179,7 @@ def text2vec_google_aistudio(
modelId=model_id,
vectorizeClassName=vectorize_collection_name,
titleProperty=title_property,
taskType=None,
)

@staticmethod
Expand Down Expand Up @@ -1210,6 +1213,7 @@ def text2vec_google(
modelId=model_id,
vectorizeClassName=vectorize_collection_name,
titleProperty=title_property,
taskType=None,
)

@staticmethod
Expand Down
7 changes: 7 additions & 0 deletions weaviate/collections/classes/config_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def multi(
return _IndexWrappers.single(vector_index_config, quantizer)


# TODO: Consider refactoring to move the default values to the pydantic classes themselves (e.g. _VectorConfigCreate, _Text2VecCohereConfig, etc.)
class _MultiVectors:
@staticmethod
def self_provided(
Expand Down Expand Up @@ -1188,6 +1189,7 @@ def text2vec_google(
model: Optional[str] = None,
project_id: str,
title_property: Optional[str] = None,
task_type: Optional[str] = None,
source_properties: Optional[List[str]] = None,
vector_index_config: Optional[_VectorIndexConfigCreate] = None,
vectorize_collection_name: bool = True,
Expand All @@ -1205,6 +1207,7 @@ def text2vec_google(
model: The model to use. Defaults to `None`, which uses the server-defined default.
project_id: The project ID to use, REQUIRED.
title_property: The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title.
task_type: The task type to use (e.g. `RETRIEVAL_QUERY`, `RETRIEVAL_DOCUMENT`). Defaults to `None`, which uses the server-defined default.
source_properties: Which properties should be included when vectorizing. By default all text properties are included.
vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default.
vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`.
Expand All @@ -1222,6 +1225,7 @@ def text2vec_google(
modelId=model,
vectorizeClassName=vectorize_collection_name,
titleProperty=title_property,
taskType=task_type,
),
vector_index_config=_IndexWrappers.single(vector_index_config, quantizer),
)
Expand All @@ -1234,6 +1238,7 @@ def text2vec_google_aistudio(
dimensions: Optional[int] = None,
model: Optional[str] = None,
title_property: Optional[str] = None,
task_type: Optional[str] = None,
source_properties: Optional[List[str]] = None,
vector_index_config: Optional[_VectorIndexConfigCreate] = None,
vectorize_collection_name: bool = True,
Expand All @@ -1249,6 +1254,7 @@ def text2vec_google_aistudio(
dimenions: The dimensionality of the vectors. Defaults to `None`, which uses the server-defined default.
model: The model to use. Defaults to `None`, which uses the server-defined default.
title_property: The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title.
task_type: The task type to use (e.g. `RETRIEVAL_QUERY`, `RETRIEVAL_DOCUMENT`). Defaults to `None`, which uses the server-defined default.
source_properties: Which properties should be included when vectorizing. By default all text properties are included.
vector_index_config: The configuration for Weaviate's vector index. Use `wvc.config.Configure.VectorIndex` to create a vector index configuration. None by default
vectorize_collection_name: Whether to vectorize the collection name. Defaults to `True`.
Expand All @@ -1266,6 +1272,7 @@ def text2vec_google_aistudio(
modelId=model,
vectorizeClassName=vectorize_collection_name,
titleProperty=title_property,
taskType=task_type,
),
vector_index_config=_IndexWrappers.single(vector_index_config, quantizer),
)
Expand Down