diff --git a/weave/trace/refs.py b/weave/trace/refs.py index 6761bde3ab7..60310f17ca2 100644 --- a/weave/trace/refs.py +++ b/weave/trace/refs.py @@ -2,7 +2,7 @@ import urllib from typing import Any, Union -from ..trace_server import refs_internal, validation +from ..trace_server import refs_internal DICT_KEY_EDGE_NAME = refs_internal.DICT_KEY_EDGE_NAME LIST_INDEX_EDGE_NAME = refs_internal.LIST_INDEX_EDGE_NAME @@ -58,7 +58,8 @@ def __post_init__(self) -> None: refs_internal.validate_no_slashes(self.digest, "digest") refs_internal.validate_no_colons(self.digest, "digest") refs_internal.validate_extra(list(self.extra)) - validation.object_id_validator(self.name) + refs_internal.validate_no_slashes(self.name, "name") + refs_internal.validate_no_colons(self.name, "name") def uri(self) -> str: u = f"weave:///{self.entity}/{self.project}/object/{self.name}:{self.digest}" diff --git a/weave/trace_server/refs_internal.py b/weave/trace_server/refs_internal.py index ecf2a5fc75c..fa0bc0933f9 100644 --- a/weave/trace_server/refs_internal.py +++ b/weave/trace_server/refs_internal.py @@ -8,8 +8,6 @@ import urllib from typing import Any, Union -from . import validation - WEAVE_INTERNAL_SCHEME = "weave-trace-internal" WEAVE_SCHEME = "weave" WEAVE_PRIVATE_SCHEME = "weave-private" @@ -106,7 +104,8 @@ def __post_init__(self) -> None: validate_no_slashes(self.version, "version") validate_no_colons(self.version, "version") validate_extra(self.extra) - validation.object_id_validator(self.name) + validate_no_slashes(self.name, "name") + validate_no_colons(self.name, "name") def uri(self) -> str: u = f"{WEAVE_INTERNAL_SCHEME}:///{self.project_id}/object/{self.name}:{self.version}" diff --git a/weave/trace_server/validation.py b/weave/trace_server/validation.py index 97f3bc4b1f1..5606a46e95f 100644 --- a/weave/trace_server/validation.py +++ b/weave/trace_server/validation.py @@ -62,8 +62,9 @@ def _validate_object_name_charset(name: str) -> None: # Object names must be alphanumeric with dashes invalid_chars = re.findall(r"[^\w._-]", name) if invalid_chars: + invalid_char_set = list(set(invalid_chars)) raise ValueError( - f"Invalid object name: {name}. Contains invalid characters: {invalid_chars}" + f"Invalid object name: {name}. Contains invalid characters: {invalid_char_set}. Please upgrade your `weave` package to `>0.51.0` to prevent this error." ) if not name: diff --git a/weave/version.py b/weave/version.py index 6c36c90227d..6a56404e807 100644 --- a/weave/version.py +++ b/weave/version.py @@ -1 +1 @@ -VERSION = "0.51.0" +VERSION = "0.51.1"