fixed the prompt asset casting#634
Conversation
Code ReviewThis PR fixes prompt asset parsing by updating imports to the new
|
Code ReviewThis PR fixes prompt asset casting in the benchmark by switching from Findings1. Silent When a file asset exists but contains neither else:
self.__prompt_assets.append(None)If the server adds a new metadata key (e.g. 2. return os.path.basename(asset)On Linux, 3. Caller-visible behaviour change: self.__prompt_assets.append(
self.__normalize_cached_asset(uploaded.prompt_asset)
)After 4. Third independent copy of the URL detection regex __URL_SCHEME_RE = re.compile(r"^https?://", re.IGNORECASE)The same pattern already lives at 5. @classmethod
def __normalize_cached_asset(cls, asset: str | None) -> str | None:
if asset is None or cls.__URL_SCHEME_RE.match(asset):
return asset
return os.path.basename(asset)
Overall the fix is on the right track — handling both metadata key variants is clearly necessary. The most important issues to address before merge are #1 (silent data loss) and #3 (breaking caller contract). #2 is a latent cross-platform bug. #4 and #5 are cleanups. |
No description provided.