Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This sample shows how to generate content using a prompt defined by Copilot Studio or AI Hub.
This sample is a Power Apps Component Framework (PCF) control that integrates with code interpreter enabled prompts to render interactive HTML/JavaScript data visuals or generate previews and downloads for PDF, Word, PowerPoint, and Excel files.
Available for
Model-driven apps
Code
You can find the code for sample here: PowerApps-Samples/component-framework/CodeInterpreterControl/.
Important
See the sample README for detailed instructions about how to build the control and configure the PCF component in the form.
Demonstrates
This example demonstrates how a single PCF control can render different output in the model-driven app form that depends on the prompt provided. This sample provides a managed solution you can install that contains three prompts that are prepared for you.
Prompt: Create sample data for the example table
The provided managed solution also includes the definition for a table named sample_example. Testing this prompt creates 10 sample records to use in this demonstration.
Tip
Copy one of the example GUID values to set as a test sample_example record for your environment when you test the other prompts.
Prompt: Example interactive row summary chart
This prompt specifies an interactive chart that returns a mimetype value of text/html:
Tip
If you Test this prompt, use one of the example GUID values from the first prompt and set it as the Sample data for the RecordId parameter.
The HTML isn't currently rendered in the Model response, but you can view Run details to confirm it ran successfully.
The PCF control renders this interactive HTML within the form:
Prompt: Example sales proposal document
This prompt specifies a preview and direct download for a generated PDF file.
Tip
If you Test this prompt, use one of the example GUID values from the first prompt and set it as the Sample data for the RecordId parameter.
If you Test this prompt, you can preview results in the Model response. The control renders a different experience within the form:
Generated .docx, .pptx and .xlsx files are also supported, but the sample PCF control currently doesn't support .pptx.
App: sample_example app
The managed solution also includes a preconfigured model-driven application with form available for you to configure the CodeInterpreter PCF control. This app reduces the number of steps necessary to try the sample.