@navba-MSFT I tried this code in python:
and it returns this : PS C:\Users\ANJALI> & C:/Users/ANJALI/AppData/Local/Programs/Python/Python312/python.exe "c:/Users/ANJALI/Documents/Trained_model_forcast_python/import requests.py"``Error: {"error":{"code":"NoCapacity","message":"The deployment does not have any capacity at the moment, please check the capacity setting and try again later."}}
and in this it comes as shown in the picture.
import requests
import json
# Set the Azure OpenAI endpoint URL
endpoint_url = ""
# Set your Azure OpenAI API key
api_key = ""
# Prepare the request headers
headers = {
"Content-Type": "application/json",
"api-key": api_key
}
# Prepare the request payload with a user message
payload = {
"temperature": 0.7,
"max_tokens": 800,
"top_p": 0.95,
"frequency_penalty": 0,
"presence_penalty": 0,
"stop": None,
"messages": [
{
"role": "user",
"content": "What are the differences between Azure Machine Learning and Azure AI services?"
}
],
"inScope": False # Set "inScope" to false as instructed
}
# Send the POST request to Azure OpenAI API
response = requests.post(endpoint_url, headers=headers, json=payload)
# Check if the request was successful (status code 200)
if response.status_code == 200:
# Parse and print the response
response_data = response.json()
print("Response:", response_data)
else:
print("Error:", response.text)