# Getting Started with the Kendo UI for Vue Conversational UI

This guide provides essential information about using the Kendo UI for Vue AIPrompt component, part of the Conversational UI package in the Kendo UI for Vue suite.
In this page you will learn how to:

* Install the Conversational UI package that provides the AIPrompt
* Add the AIPrompt component to your Vue project and apply basic configurations to it.
* Style the component and activate your product license.

<CtaPanelOverview></CtaPanelOverview>

After completing this guide, you will be able to reproduce the following example.

[Demo Source](https://demos.telerik.com/kendo-vue-ui/conversational-ui/overview/source.txt)

## Setting Up Your Vue Project

Before you install the Kendo UI for Vue AIPrompt, make sure that you have a running Vue project. The easiest way to set up a Vue project is to use the approach described in the [Set up the Vue project](https://www.telerik.com/kendo-vue-ui-develop/components/getting-started/javascript-composition-api#1-set-up-the-vue-project) section of the [First Steps with JavaScript ](https://www.telerik.com/kendo-vue-ui-develop/components/getting-started/javascript-composition-api) article.

## Installing the Conversational UI Package

All Kendo UI for Vue packages are distributed through npm and offer a similar installation experience. To use the AIPrompt component, start with the installation of the Conversational UI npm package and its [dependencies](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/get-started#dependencies).

```sh
npm install --save @progress/kendo-vue-conversational-ui @progress/kendo-vue-buttons @progress/kendo-vue-layout @progress/kendo-vue-inputs @progress/kendo-vue-progressbars @progress/kendo-licensing @progress/kendo-drawing @progress/kendo-svg-icons @progress/kendo-vue-intl
```

## Importing the Component

After installing the package, import the AIPrompt component in the Vue App.

In the `src/App.vue` file of your Vue project, import the `AIPrompt`, `AIPromptView` and `AIPromptOutputView` components together with the `outputViewDefaults` and `promptViewDefaults` default configurations from the Conversational UI package.

```jsx
// ES2015 module syntax
import { AIPrompt, AIPromptOutputView, AIPromptView, outputViewDefaults, promptViewDefaults } from "@progress/kendo-vue-conversational-ui";
```

```jsx
// CommonJS format
const { AIPrompt, AIPromptOutputView, AIPromptView, outputViewDefaults, promptViewDefaults } = require('@progress/kendo-vue-conversational-ui');
```

## Using the Component

1. Define the `AIPrompt`, `AIPromptView` and `AIPromptOutputView` components

   ```jsx
      <AIPrompt>
         <AIPromptView />
         <AIPromptOutputView />
      </AIPrompt>
   ```

2. Next, define the following:

* [`activeView`](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/api/aipromptprops#activeView) property that sets the currently visible view for the component.
* [`onActiveViewChange`](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/api/aipromptprops#onActiveViewChange) event triggered when the component's view is changed.
* [`onPromptRequest`](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/api/aipromptprops#onPromptRequest) event which is triggered when the user clicks the `Generate` button in the Prompt view.

Finally pass `promptViewDefaults` and `outputViewDefaults` to the [`toolbarItems`](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/api/aipromptprops#toolbarItems) prop and define the outputs property in the `AIPromptOutputView` component.

```jsx
   <AIPrompt
      :activeView="activeView"
      @activeviewchange="handleActiveViewChange"
      @promptrequest="handleOnRequest"
      :toolbarItems="[promptViewDefaults, outputViewDefaults]"
   >
      <AIPromptView />
      <AIPromptOutputView :outputs="outputs" />
   </AIPrompt>
```

1. Add the following data properties and methods:

   ```jsx
      components: {
         AIPrompt,
         AIPromptOutputView,
         AIPromptView,
      },
      data: function () {
         return {
            outputViewDefaults,
            promptViewDefaults,
            activeView: promptViewDefaults.name,
            outputs: [],
         };
      },
      methods: {
         handleOnRequest(prompt, outputItem) {
            if (!prompt) {
            return;
            }

            this.outputs = [
            {
               id: this.outputs.length + 1,
               title: "Title",
               subTitle: `Request ${this.outputs.length + 1}`,
               responseContent: `Response content for prompt ${
                  prompt + ". Generation: " + this.outputs.length
               }`,
               prompt,
            },
            ...this.outputs,
            ];
            this.activeView = outputViewDefaults.name;
         },
         handleActiveViewChange(viewName) {
            this.activeView = viewName;
         },
      }
   ```

2. To make the AIPrompt look correctly, install and import the [Kendo UI Meridian Theme](https://www.telerik.com/design-system/docs/themes/kendo-themes/meridian/), which is one of the [five beautiful themes](https://www.telerik.com/kendo-vue-ui-develop/components/styling) for Kendo UI for Vue.

   1. Install the meridian theme package.

      ```sh
      npm install --save @progress/kendo-theme-meridian
      ```

   2. Import the Theme package in `src/App.vue`.

      ```jsx
      import '@progress/kendo-theme-meridian';
      ```

3. Build, run and test the application by typing the following command in the root folder of your project:

   ```sh
   npm run dev
   ```

## Activating Your License Key

Using any of the UI components in the Kendo UI for Vue library requires either a commercial license key or an active trial license key.

Follow the instructions on the [My License page](https://www.telerik.com/kendo-vue-ui-develop/components/my-license) to activate your trial or commercial license. You can skip this step if your application already contains a Kendo UI for Vue license file.

## Dependencies

The Conversational UI package requires you to install the following [peer dependencies](https://nodejs.org/en/blog/npm/peer-dependencies/) in your application:

| Package Name                     | Description                                                                                                                                                                       |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| vue 3.0.0+                       | Contains the functionality necessary to define Vue components.                                                                                                                    |
| @progress/kendo-licensing        | Contains the internal infrastructure related to licensing.                                                                                                                        |
| @progress/kendo-vue-buttons      | Contains the Kendo UI for Vue Buttons components.                                                                                                                                 |
| @progress/kendo-vue-layouts      | Contains all layout related components part of the Kendo UI for Vue suite.                                                                                                        |
| @progress/kendo-vue-inputs       | Contains the Inputs available in Kendo UI for Vue.                                                                                                                                |
| @progress/kendo-vue-progressbars | Contains the Kendo UI for Vue components that display progress.                                                                                                                   |
| @progress/kendo-vue-intl         | Contains the Kendo UI for Vue Internationalization package that applies the desired cultures by providing services and pipes for the parsing and formatting of dates and numbers. |
| @progress/kendo-svg-icons        | Contains the Kendo UI for Vue SVG icons.                                                                                                                                          |

## Suggested Links

* [Prompt Suggestions](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/ai-prompt/suggestions)
* [Custom Commands](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/ai-prompt/commands)
* [AIPrompt Custom Templates](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/ai-prompt/customization)
* [Events](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/ai-prompt/events)
* [Globalization](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/ai-prompt/globalization)

## Learning Resources

* [Kendo UI for Vue - First Steps with JavaScript](https://www.telerik.com/kendo-vue-ui-develop/components/getting-started/javascript-composition-api)
* [Kendo UI for Vue - First Steps with JavaScript + Options API](https://www.telerik.com/kendo-vue-ui-develop/components/getting-started/javascript-options-api)
* [Kendo UI for Vue - First Steps with TypeScript](https://www.telerik.com/kendo-vue-ui-develop/components/getting-started/typescript-composition-api)
* [Kendo UI for Vue - First Steps with TypeScript + Options API](https://www.telerik.com/kendo-vue-ui-develop/components/getting-started/typescript-options-api)
* [Virtual Classroom - Kendo UI for Vue with TypeScript(Course Available to Trial and Commercial License Holders)](https://learn.telerik.com/learn/course/internal/view/elearning/45/kendo-ui-for-vue-with-typescript)
* [Kendo UI Productivity Tools extension for VS Code](https://www.telerik.com/kendo-vue-ui-develop/components/vscode-extension)

## Suggested Links

* [API Reference of the AIPromptProps](https://www.telerik.com/kendo-vue-ui-develop/components/conversationalui/api/aipromptprops)
