Skip to content

Conversation

@agrimk
Copy link
Member

@agrimk agrimk commented Nov 18, 2025

No description provided.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 18, 2025
@github-actions
Copy link

📌 Cov diff with main:

Coverage-0%

📌 Overall coverage:

Coverage-17.87%

@github-actions
Copy link

📌 Cov diff with main:

Coverage-0%

📌 Overall coverage:

Coverage-17.87%

…/accelerated-data-science into removing_kernal_messaging_in_aqua
@github-actions
Copy link

📌 Cov diff with main:

Coverage-0%

📌 Overall coverage:

Coverage-17.87%

1 similar comment
@github-actions
Copy link

📌 Cov diff with main:

Coverage-0%

📌 Overall coverage:

Coverage-17.87%

Copy link
Member

@VipulMascarenhas VipulMascarenhas left a comment

Choose a reason for hiding this comment

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

the PR needs some work, also please add tests to validate the new helper methods added, and the _get_model_deployment_response function to cover:

  • chat completions with prompt only
  • chat completions with messages
  • multimodal with image, with audio
  • text completions
  • responses
  • missing/invalid endpoint_type -> HTTP 400

if payload.get("stop") == []:
payload["stop"] = None

encoded_image = "NA"
Copy link
Member

Choose a reason for hiding this comment

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

why is the key named NA here? shouldn't we check if "encoded_image" is present in the payload or not?

{"type": "text", "text": payload["prompt"]},
{
"type": "image_url",
"image_url": {"url": f"{self.encoded_image}"},
Copy link
Member

@VipulMascarenhas VipulMascarenhas Nov 24, 2025

Choose a reason for hiding this comment

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

this looks incorrect - self does not have encoded_image attribute


response = aqua_client.chat.completions.create(**api_kwargs)

elif self.file_type.startswith("audio"):
Copy link
Member

Choose a reason for hiding this comment

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

self does not have file_type attribute, shouldn't this be just file_type?

{"type": "text", "text": payload["prompt"]},
{
"type": "audio_url",
"audio_url": {"url": f"{self.encoded_image}"},
Copy link
Member

Choose a reason for hiding this comment

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

this looks incorrect - should encoded_image be passed when file type is audio?

for chunk in response:
piece = self._extract_text_from_chunk(chunk)
if piece:
print(piece, end="", flush=True)
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this yield instead of printing the chunk?

yield piece
except ExtendedRequestError as ex:
raise HTTPError(400, str(ex))
except Exception as ex:
Copy link
Member

Choose a reason for hiding this comment

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

handle unknown endpoint type with something like:

else:
    raise HTTPError(400, f"Unsupported endpoint_type: {endpoint_type}")

error_message = (
f"Error fetching data from endpoint '{endpoint}' [{error_type}]: {ex}"
)
logger.error(
Copy link
Member

Choose a reason for hiding this comment

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

this is old code, but has a breaking change. Can we add from ads.aqua import logger import at the top of the file? Else, if this handler is not used at all then we can remove this.

)
api_kwargs = {
"model": model,
"messages": [{"role": "user", "content": payload["prompt"]}],
Copy link
Member

Choose a reason for hiding this comment

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

payload["prompt"] can error out if prompt key isn't present. We can do some key validation at the beginning of the function for all attributes fetched from payload.


class AquaDeploymentStreamingInferenceHandler(AquaAPIhandler):

def _extract_text_from_choice(self, choice):
Copy link
Member

Choose a reason for hiding this comment

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

nit: add docstrings, use type hinting

return getattr(choice, "text", None) or getattr(choice, "content", None)

def _extract_text_from_chunk(self, chunk):
if chunk :
Copy link
Member

Choose a reason for hiding this comment

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

nit: add docstrings, use type hinting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants