typescriptpowerbiopenai-apipowerbi-custom-visualschatgpt-api

PowerBI Custom Visual with ChatGPT


I am developing a custom visual into Power BI using TypeScript. I have an input of type text for user input prompt and an input of type text for ChatGPT answer. The idea is that the user can ask anything about report's data or any report's visual and get an answer. The visual at the current stage looks like this:

![enter image description here

Behind the scenes the user prompt is sent to Azure-OpenAI service and is being processed by ChatGPT deployment to get the response. The only part which is missing is to be able to pass also the report's data. I have seen a similar video doing this with PowerAutomate visual, here is the video: https://youtu.be/q1XszZrZ3es

enter image description here

In this video we are able to pass though report's data though Power Automate visual into user prompt in order to be analyzed together with the question on our data: enter image description here

I managed to do the same by passing visual's data in a structured json format along with prompt and seems to working, but the question is if it is possible to get report's data though typescript into the custom visual without having the dataset on the visual it self?

I tried already a library called PowerBI Client inside my custom visual but with any use of this library the visual stop working (I think this can be used only with PowerBI Embedded):

  1. https://www.npmjs.com/package/powerbi-client
  2. https://github.com/microsoft/PowerBI-JavaScript

Based on this article is not possible to use a custom visual and access data on page or report scope level: https://community.powerbi.com/t5/Developer/Custom-visual-to-get-data-from-other-visuals/td-p/3193250

Any ideas?


Solution

  • After a lot of research, at the moment, this is not support and cannot be done though PowerBI, as we cannot access the whole reports data, so I changed the direction by creating a langchain server inside a kubernetes cluster accessing directly the respective database which exists also inside the cluster. This service is capable of converting questions to sql then take the sql query, execute it inside infrastructure and push again the result to chatgpt to generate a html visual.