AzureMLOnlineEndpoint not working, 404 error, but same url and api key works with standard http
Labels: name: auto:bug, name: area: models

### System Info

0.0.276

### Who can help?

@hwchase17
@agola11

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I have deployed llama2 in Azure ML endpoint and when I test it with langchain code I got a 404 Error.  However using standard request library from python it works

Below : askdocuments2 ---> no lanchain
askdocuments --->langchain

same endpoint url, same key.  

```
def askdocuments2(
        question):
    # Request data goes here
    # The example below assumes JSON formatting which may be updated
    # depending on the format your endpoint expects.
    # More information can be found here:
    # https://docs.microsoft.com/azure/machine-learning/how-to-deploy-advanced-entry-script
    formatter = LlamaContentFormatter()
    data = formatter.format_request_payload(prompt=question, model_kwargs={"temperature": 0.1, "max_tokens": 300})
    body = data

    url = 'https://llama-2-7b-test.westeurope.inference.ml.azure.com/score'
    # Replace this with the primary/secondary key or AMLToken for the endpoint
    api_key = ''
    if not api_key:
        raise Exception("A key should be provided to invoke the endpoint")

    # The azureml-model-deployment header will force the request to go to a specific deployment.
    # Remove this header to have the request observe the endpoint traffic rules
    headers = {'Content-Type': 'application/json', 'Authorization': ('Bearer ' + api_key), 'azureml-model-deployment': 'llama'}

    req = urllib.request.Request(url, body, headers)

    try:
        response = urllib.request.urlopen(req)

        result = response.read()
        decoded_data = json.loads(result.decode('utf-8'))
        text = decoded_data[0]["0"]
        return text
    except urllib.error.HTTPError as error:
        print("The request failed with status code: " + str(error.code))

        # Print the headers - they include the requert ID and the timestamp, which are useful for debugging the failure
        print(error.info())
        print(error.read().decode("utf8", 'ignore'))


def askdocuments(
        question):

    try:
        content_formatter = LlamaContentFormatter()
        llm = AzureMLOnlineEndpoint(
            endpoint_api_key="",
            deployment_name="llama-2-7b-test",
            endpoint_url="https://llama-2-7b-test.westeurope.inference.ml.azure.com/score",
            model_kwargs={"temperature": 0.8, "max_tokens": 300},
            content_formatter=content_formatter
        )

        formatter_template = "Write a {word_count} word essay about {topic}."

        prompt = PromptTemplate(
            input_variables=["word_count", "topic"], template=formatter_template
        )

        chain = LLMChain(llm=llm, prompt=prompt)
        response = chain.run({"word_count": 100, "topic": "how to make friends"})
        return response
    except requests.exceptions.RequestException as e:
        # Handle any requests-related errors (e.g., network issues, invalid URL)
        raise ValueError(f"Error with the API request: {e}")

    except json.JSONDecodeError as e:
        # Handle any JSON decoding errors (e.g., invalid JSON format)
        raise ValueError(f"Error decoding API response as JSON: {e}")
    except Exception as e:
        # Handle any other errors
        raise ValueError(f"Error: {e}")

```



### Expected behavior

According to the documentation I am doing everything correctly, so not sure why its showing a 404 error in a valid url