Forum Discussion
Fabric AI Skill API not working
import requests
import json
import pprint
from synapse.ml.mlflow import get_mlflow_env_config
# the URL could change if the workspace is assigned to a different capacity
url = "https://<used valid url here>"
configs = get_mlflow_env_config()
headers = {
"Authorization": f"Bearer {configs.driver_aad_token}",
"Content-Type": "application/json; charset=utf-8"
}
question = "{userQuestion: \"what is an example product?\"}"
response = requests.post(url, headers=headers, data = question)
print("RESPONSE: ", response)
print("")
response = json.loads(response.content)
print(response["result"])
- Anonymous1 year ago
Hi anand2020
Thank you for reaching out microsoft fabric community forum.
We appriciate you for bringing it to the notice. If there are any changes required in document it will reviewed and updated soon.
As it is in preview mode please submit your valuable feedbackIf this solution helps, please consider giving us Kudos and accepting it as the solution so that it may assist other members in the community.
Thank you
5 Replies
- FabianSchutSolution Sage
Just to make sure, all the prerequisites are fulfilled?
Prerequisites
- A paid F64 or higher Fabric capacity resource.
- AI skill tenant switch is enabled.
- Copilot tenant switch is enabled.
- Cross-geo sharing for AI is enabled, if relevant
- VarunPatkarMicrosoft Employee
I've experienced the same issue. Previously, this API was working fine and provided both the SQL query and its execution output. I haven’t made any changes to my workspace, and since it was working earlier, I assume all requirements were met. I’m wondering if there might have been an update to the API or its schema that isn’t yet reflected in the documentation.
- anand2020Microsoft Employee
Yes, it is a paid F64, AI Skill is enabled, I'm able to create AI Skill run it, but I'm not able to call the published AI Skill API even within Fabric in the Notebook with the following code.
import requestsimport jsonimport pprintfrom synapse.ml.mlflow import get_mlflow_env_config# the URL could change if the workspace is assigned to a different capacityurl = "https://msitapi.fabric.microsoft.com/v1/workspaces/<guid>/aiskills/<guid>/__private/aiassistant/openai"configs = get_mlflow_env_config()headers = {"Authorization": f"Bearer {configs.driver_aad_token}","Content-Type": "application/json; charset=utf-8"}question = "{userQuestion: \"sample question?\"}"response = requests.post(url, headers=headers, data = question)print("RESPONSE: ", response)print("")response = json.loads(response.content)print(response)Response is below:RESPONSE: <Response [500]> {'requestId': 'ae02ccee-33bc-4aeb-82da-45fb848c5d61', 'errorCode': 'UnknownError', 'message': 'An error occurred while processing the operation'}
- AnonymousNot applicable
Hi anand2020
Thank you for reaching out microsoft fabric community forum.
We appriciate you for bringing it to the notice. If there are any changes required in document it will reviewed and updated soon.
As it is in preview mode please submit your valuable feedbackIf this solution helps, please consider giving us Kudos and accepting it as the solution so that it may assist other members in the community.
Thank you
- AnonymousNot applicable
Hi anand2020
As per our pervious coversation could you please let us know if you have submitted your feedback ?
Thank you.