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
19 changes: 19 additions & 0 deletions test/collection/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2373,6 +2373,25 @@ def test_config_with_named_vectors(
}
},
),
(
[
Configure.Vectors.text2vec_digitalocean(
name="test", source_properties=["prop"], model="qwen2"
)
],
{
"test": {
"vectorizer": {
"text2vec-digitalocean": {
"vectorizeClassName": True,
"properties": ["prop"],
"model": "qwen2",
}
},
"vectorIndexType": "hnsw",
}
},
),
(
[Configure.Vectors.text2vec_morph(name="test", source_properties=["prop"])],
{
Expand Down
16 changes: 16 additions & 0 deletions weaviate/collections/classes/config_vectorizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class Vectorizers(str, Enum):
TEXT2VEC_COHERE = "text2vec-cohere"
TEXT2VEC_CONTEXTIONARY = "text2vec-contextionary"
TEXT2VEC_DATABRICKS = "text2vec-databricks"
TEXT2VEC_DIGITALOCEAN = "text2vec-digitalocean"
TEXT2VEC_GPT4ALL = "text2vec-gpt4all"
TEXT2VEC_HUGGINGFACE = "text2vec-huggingface"
TEXT2VEC_MISTRAL = "text2vec-mistral"
Expand Down Expand Up @@ -286,6 +287,21 @@ def _to_dict(self) -> Dict[str, Any]:
return ret_dict


class _Text2VecDigitalOceanConfig(_VectorizerConfigCreate):
vectorizer: Union[Vectorizers, _EnumLikeStr] = Field(
default=Vectorizers.TEXT2VEC_DIGITALOCEAN, frozen=True, exclude=True
)
model: str
vectorizeClassName: bool
baseURL: Optional[AnyHttpUrl]

def _to_dict(self) -> Dict[str, Any]:
ret_dict = super()._to_dict()
if self.baseURL is not None:
ret_dict["baseURL"] = self.baseURL.unicode_string()
return ret_dict


class _Text2VecMorphConfig(_VectorizerConfigCreate):
vectorizer: Union[Vectorizers, _EnumLikeStr] = Field(
default=Vectorizers.TEXT2VEC_MORPH, frozen=True, exclude=True
Expand Down
37 changes: 37 additions & 0 deletions weaviate/collections/classes/config_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
_Text2VecCohereConfig,
_Text2VecContextionaryConfig,
_Text2VecDatabricksConfig,
_Text2VecDigitalOceanConfig,
_Text2VecGoogleConfig,
_Text2VecGPT4AllConfig,
_Text2VecHuggingFaceConfig,
Expand Down Expand Up @@ -620,6 +621,42 @@ def text2vec_mistral(
vector_index_config=_IndexWrappers.single(vector_index_config, quantizer),
)

@staticmethod
def text2vec_digitalocean(
*,
name: Optional[str] = None,
quantizer: Optional[_QuantizerConfigCreate] = None,
base_url: Optional[AnyHttpUrl] = None,
model: str,
source_properties: Optional[List[str]] = None,
vector_index_config: Optional[_VectorIndexConfigCreate] = None,
vectorize_collection_name: bool = True,
) -> _VectorConfigCreate:
"""Create a vector using the `text2vec-digitalocean` module.

See the [documentation](https://weaviate.io/developers/weaviate/model-providers/digitalocean/embeddings)
for detailed usage.

Args:
name: The name of the vector.
quantizer: The quantizer to use for the vector index. If not provided, no quantization will be applied.
base_url: The base URL to use where API requests should go. Defaults to `None`, which uses the server-defined default of `https://inference.do-ai.run`.
model: The model to use, e.g. `qwen3-embedding-0.6b`. This is a required field on the server.
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`.
"""
return _VectorConfigCreate(
name=name,
source_properties=source_properties,
vectorizer=_Text2VecDigitalOceanConfig(
baseURL=base_url,
model=model,
vectorizeClassName=vectorize_collection_name,
),
vector_index_config=_IndexWrappers.single(vector_index_config, quantizer),
)

@staticmethod
def text2vec_morph(
*,
Expand Down
Loading