semantic-link-labs icon indicating copy to clipboard operation
semantic-link-labs copied to clipboard

generate_measure_descriptions user doesnt belong to cluster issue

Open jozsefbraun opened this issue 1 year ago • 9 comments

Dear Team!

I would like to invoke generate_measure_descriptions() function inside a Fabric Notebook, but I get the following error: FabricHTTPException: 401 Unauthorized for url: https://api.fabric.microsoft.com//explore/v202304/nl2nl/completions Headers: {'Content-Length': '0', 'X-PowerBI-Error-Info': 'UserDoesNotBelongToCurrentCluster', 'X-PowerBI-Error-Details': "Current user belongs to cluster '', but this request was sent to cluster: 'WABI-NORTH-EUROPE-redirect.analysis.windows.net'.", 'request-redirected': 'true', 'home-cluster-uri': 'https://wabi-north-europe-m-primary-redirect.analysis.windows.net/', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'Access-Control-Expose-Headers': 'RequestId,X-PowerBI-Error-Info,X-PowerBI-Error-Details', 'RequestId': 'xxx', 'Date': 'Tue, 14 Jan 2025 15:34:48 GMT'}

I get the same results with a specific measure + readonly = True and no measure defined + False settings.

My workspace is attached to a P4 capacity, my user is also part of the user group who can use Copilot feature and I am a Fabric administrator as well. (Also, randomly connect_semantic_model() doesnt find my model saying that it doesnt exist, but it's clearly there - I used another capacity in the beginning then i attached that P4, probably that object movement messed it up?! (even after hours)) Could you please help me finding the issue?

Thanks Jozsef

jozsefbraun avatar Jan 14 '25 15:01 jozsefbraun

You must run this function on an F64 sku or higher as documented here.

m-kovalsky avatar Jan 15 '25 17:01 m-kovalsky

Checking in here. Do you still get this issue when running on a Fabric capacity (F64+)? The transient issue with connect_semantic_model should now be much less frequent as changes were made to Semantic Link to ensure a better connection to the model (which was inherited by semantic link labs).

m-kovalsky avatar Apr 16 '25 16:04 m-kovalsky

Hi Michael, Finally I got the chance to test it on an F64 instead of a P1, but I still get the same issue even as a Fabric Administrator myself. Is there any other prerequisites for the model, workspace, user who runs it?

jozsefbraun avatar May 15 '25 13:05 jozsefbraun

Hello @m-kovalsky,

FYI, I tested this function today in a workspace that is backed by a F64 capacity, and I got the same error.

Quick question, will the F64 requirement be removed since all F SKUs have access to Copilot?

ryanwade-microsoft avatar May 27 '25 20:05 ryanwade-microsoft

Hi @m-kovalsky,

I tested this function in a workspace under a F64 capacity and got the same error message as well.

ecampuss avatar Aug 07 '25 21:08 ecampuss

Would you try 0.12.2 and let me know?

m-kovalsky avatar Sep 12 '25 10:09 m-kovalsky

hi Michael, now i get different errors. if I execute it as myself I get this: File /nfs4/pyenv-a286b49c-5b65-42ce-9bef-78658bb95e14/lib/python3.11/site-packages/sempy_labs/tom/_model.py:4673, in TOMWrapper.generate_measure_descriptions(self, measure_name, max_batch_size) 4667 response = requests.post( 4668 f"{prefix}/explore/v202304/nl2nl/completions", 4669 headers=headers, 4670 json=payload, 4671 ) 4672 if response.status_code != 200: -> 4673 raise FabricHTTPException( 4674 f"Failed to retrieve descriptions: {response.text}" 4675 ) 4677 for item in response.json().get("modelItems", []): 4678 ms_name = item["urn"]

File /nfs4/pyenv-a286b49c-5b65-42ce-9bef-78658bb95e14/lib/python3.11/site-packages/sempy/fabric/exceptions/_exceptions.py:24, in FabricHTTPException.init(self, response) 21 self.error_reason: str 22 # The following section is copied from response.raise_for_status() 23 # ---------------------------------------------------------------- ---> 24 if isinstance(response.reason, bytes): 25 # We attempt to decode utf-8 first because some servers 26 # choose to localize their reason strings. If the string 27 # isn't utf-8, we fall back to iso-8859-1 for all other 28 # encodings. (See PR #3538) 29 try: 30 self.error_reason = response.reason.decode("utf-8")

AttributeError: 'str' object has no attribute 'reason'

If i execute it as a service principal I get this error, but not just for generate measures but even listing out tables from model. ImportError: cannot import name 'create_on_access_token_expired_callback' from 'sempy.fabric._token_provider' (/nfs4/pyenv-a286b49c-5b65-42ce-9bef-78658bb95e14/lib/python3.11/site-packages/sempy/fabric/_token_provider.py)

Let me know if you need further information!

jozsefbraun avatar Sep 16 '25 08:09 jozsefbraun

Thanks for testing. I'm making an update in 0.12.3 so we'll see how that goes.

m-kovalsky avatar Sep 16 '25 11:09 m-kovalsky

Please try 0.12.3.

m-kovalsky avatar Sep 17 '25 05:09 m-kovalsky