fix(forge): various merge errors for the new binary encoding format (#261)

Co-authored-by: Steve Chan <>
This commit is contained in:
Steve Chan
2025-08-15 09:27:24 -07:00
committed by GitHub
parent b237fe781c
commit 2a19c4edde
2 changed files with 13 additions and 3 deletions

View File

@@ -75,7 +75,7 @@ class _BaseForgeInferenceClient:
headers: dict[str, str] = {},
) -> tuple[dict[str, Any], dict[str, str]]:
request["potential_sequence_of_concern"] = potential_sequence_of_concern
headers = headers = {**self.headers, **headers}
headers = {**self.headers, **headers}
if return_bytes:
headers["return-bytes"] = "true"
return request, headers
@@ -87,7 +87,6 @@ class _BaseForgeInferenceClient:
error_msg=f"Failure in {endpoint}: {response.text}",
)
data = assemble_message(response.headers, response)
data = response.json()
# Nextjs puts outputs dict under "data" key.
# Lift it up for easier downstream processing.
if "outputs" not in data and "data" in data:

View File

@@ -834,7 +834,12 @@ class ESM3ForgeInferenceClient(ESM3InferenceClient, _BaseForgeInferenceClient):
)
try:
data = await self._async_post(
"forward_and_sample", request, input.potential_sequence_of_concern
"forward_and_sample",
request,
input.potential_sequence_of_concern,
headers={
"Accept": f"{MIMETYPE_ES_PICKLE};protocol={pickle.HIGHEST_PROTOCOL}, application/json"
},
)
except ESMProteinError as e:
return e
@@ -953,6 +958,9 @@ class ESM3ForgeInferenceClient(ESM3InferenceClient, _BaseForgeInferenceClient):
request,
input.potential_sequence_of_concern,
return_bytes=return_bytes,
headers={
"Accept": f"{MIMETYPE_ES_PICKLE};protocol={pickle.HIGHEST_PROTOCOL}, application/json"
},
)
except ESMProteinError as e:
return e
@@ -1140,6 +1148,9 @@ class ESMCForgeInferenceClient(ESMCInferenceClient, _BaseForgeInferenceClient):
request,
input.potential_sequence_of_concern,
return_bytes=return_bytes,
headers={
"Accept": f"{MIMETYPE_ES_PICKLE};protocol={pickle.HIGHEST_PROTOCOL}, application/json"
},
)
except ESMProteinError as e:
return e