Forum Discussion

anand2020's avatar
anand2020
Microsoft Employee
1 year ago
Solved

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 exception. Any change in the API contract or schema?
 
 

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"])

 
  • Anonymous's avatar
    Anonymous
    1 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 feedback 

     

    If 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

    • VarunPatkar's avatar
      VarunPatkar
      Microsoft 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.

    • anand2020's avatar
      anand2020
      Microsoft 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(urlheaders=headersdata = 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'}
  • Anonymous's avatar
    Anonymous
    Not 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 feedback 

     

    If 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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi anand2020 
    As per our pervious coversation could you please let us know if you have submitted  your feedback ?
    Thank you.