Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Please add more context on the AMLRequest and AMLResponse classes

Open
#1,905 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start with the AMLRequest and AMLResponse reference pages and the source file AzureML-Docset/stable/docs-ref-autogen/azureml.contrib.services.aml_request.AMLRequest.yml; compare them with the linked online-endpoints-binary-payloads.ipynb sample. Document the relevant parameters, attributes, and sample usage for passing JSON alongside a binary file and accessing it in the scoring script.

Written by the indexing model from the issue text.

Description

I am testing the sample https://github.com/Azure/azureml-examples/blob/main/sdk/python/endpoints/online/managed/online-endpoints-binary-payloads.ipynb
As per the documentation, the AMLRequest and AMLResponse classes were inherited from flask.wrappers. However, please also add the parameters and attributes and sample usage of these classes.

If I am sending a JSON object to the MOE (Managed Online Endpoint) along with the binary image file, the request object will hold these values passed as raw httprequest.

payload = {"file-metadata": {
    "filename": "my-image.jpg",
    "file-size": "150kb",
    ...
}}
res = requests.post(
    url=scoring_uri,
    headers={"Authorization": f"Bearer {key}"},
    json=payload, **attempt to pass the payload to the request**
    files=[
        ("file", open("my-image.jpg", "rb"))
    ],
)

How to pass a JSON payload to this request and access that from within the scoring script? I tried to configure the json parameter to assign a sample JSON payload as above sample. However, when viewing the value through req.get_json() in the scoring script, this function returns empty.

@rawhttp
def run(req : AMLRequest):
    print(req.get_json()) **nothing gets printed out**

I found a workaround to assign the payload to the headers parameter as follows. However, it would be appreciated if you may also include the correct approach/sample usage of the above class(es).

payload = {"file-metadata": {
    "filename": "my-image.jpg",
    "file-size": "150kb",
    ...
}}

headers_ = {"Authorization": f"Bearer {key}", "File-Metadata": json.dumps(payload)}

res = requests.post(
    url=scoring_uri,
    headers=headers_
    ...)

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Dominant language
Jupyter Notebook
Stars
4.4k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure/MachineLearningNotebooks

All issues in Azure/MachineLearningNotebooks

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.