Forum Discussion
anand2020
1 year agoMicrosoft Employee
Fabric AI Skill API not working
Fabric AI Skill API not working. Tried with sample code from the Fabric documentation and articles, but I'm getting internal error exception. The authentication worked fine but getting internal error...
- 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
FabianSchut
1 year agoSolution 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
anand2020
1 year agoMicrosoft 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 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://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'}