### Run Development Server with npm
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md
Starts the application development server using the 'npm run start' command. This command compiles the project and serves it, typically in a default web browser.
```bash
npm run start
```
--------------------------------
### Clone Smart AI Samples Repository
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md
Clones the smart-ai-samples GitHub repository to your local machine. This is the initial step to get the project structure.
```bash
git clone https://github.com/syncfusion/smart-ai-samples.git
cd smart-ai-samples/typescript
```
--------------------------------
### Configure Stability AI API Key (C# Example)
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md
Provides a C# example for configuring the API key for Stability AI, which is used for AI Image processing. This shows how the key might be stored in a C# application.
```csharp
// Stability AI APIKEY
public string ApiKey = "your-api-key";
```
--------------------------------
### Install Project Dependencies
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/README.md
Installs all the required Node.js packages for the project, as defined in the package.json file. This command should be run after cloning the repository.
```bash
npm install
```
--------------------------------
### Register Syncfusion License Key
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md
Activates the Syncfusion license key by running an npx command. This requires creating a syncfusion-license.txt file in the project root with the license key.
```bash
npx syncfusion-license activate
```
--------------------------------
### Install Ollama NuGet Packages for Blazor
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md
Installs the necessary NuGet packages for integrating Ollama with Blazor applications. These packages include core AI libraries and Ollama-specific integrations.
```powershell
Install-Package Microsoft.Extensions.AI
Install-Package OllamaSharp
```
--------------------------------
### Run Development Server
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/README.md
Starts the application development server using an npm script. This command compiles the code and launches the application in the default web browser, allowing for real-time development.
```bash
npm run dev
```
--------------------------------
### Install OpenAI NuGet Packages for Blazor
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md
Installs the necessary NuGet packages for integrating OpenAI with Blazor applications. These packages provide the core libraries for AI functionalities.
```powershell
Install-Package Microsoft.Extensions.AI
Install-Package Microsoft.Extensions.AI.OpenAI
```
--------------------------------
### Install Azure OpenAI NuGet Packages for Blazor
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md
Installs the necessary NuGet packages for integrating Azure OpenAI with Blazor applications. These packages include core AI libraries and Azure-specific integrations.
```powershell
Install-Package Microsoft.Extensions.AI
Install-Package Microsoft.Extensions.AI.OpenAI
Install-Package Azure.AI.OpenAI
```
--------------------------------
### Configure Azure OpenAI and Gemini AI Models
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md
Demonstrates how to configure AI service credentials in the ai-models.ts file for both Azure OpenAI and Google Gemini. It shows placeholder values for resource names, API keys, and model names.
```typescript
// for Azure Open AI service
const azure = createAzure({
resourceName: 'YOUR_RESOURCE_NAME',
apiKey: 'YOUR_API_KEY',
});
const aiModel = azure('YOUR_MODEL_NAME');
// for gemini model
const google = createGoogleGenerativeAI({
baseURL: "https://generativelanguage.googleapis.com/v1beta",
apiKey: "API_KEY"
});
const aiModel = google('YOUR_MODEL_NAME');
```
--------------------------------
### Configure Stability AI API Key for Image Editor
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/typescript/README.md
Sets up the API key for Stability AI, a third-party service used for AI Image processing in the Image Editor component. The key is added as a bearer token.
```typescript
const apiKey= `Bearer YOUR_API_KEY`;
```
--------------------------------
### Configure OpenAI Service in Blazor Server App
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md
Configures the OpenAI service for Blazor Server applications. Requires installing Microsoft.Extensions.AI and Microsoft.Extensions.AI.OpenAI NuGet packages. It injects the OpenAI inference service into the application.
```csharp
using Syncfusion.Blazor.SmartComponents;
using Syncfusion.Blazor.AI;
using Microsoft.Extensions.AI;
using OpenAI;
var builder = WebApplication.CreateBuilder(args);
....
builder.Services.AddSyncfusionBlazor();
string openAIApiKey = "API-KEY";
string openAIModel = "OPENAI_MODEL";
OpenAIClient openAIClient = new OpenAIClient(openAIApiKey);
IChatClient openAIChatClient = openAIClient.GetChatClient(openAIModel).AsIChatClient();
builder.Services.AddChatClient(openAIChatClient);
builder.Services.AddSyncfusionSmartComponents()
.InjectOpenAIInference();
var app = builder.Build();
....
```
--------------------------------
### Configure Ollama Service in Blazor Server App
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md
Configures the Ollama service for Blazor Server applications, allowing the use of self-hosted AI models. Requires installing Microsoft.Extensions.AI and OllamaSharp NuGet packages. It injects the Ollama chat client.
```csharp
using Syncfusion.Blazor.SmartComponents;
using Syncfusion.Blazor.AI;
using Microsoft.Extensions.AI;
using OllamaSharp;
var builder = WebApplication.CreateBuilder(args);
....
builder.Services.AddSyncfusionBlazor();
string ModelName = "MODEL_NAME";
IChatClient chatClient = new OllamaApiClient("http://localhost:11434", ModelName);
builder.Services.AddChatClient(chatClient);
builder.Services.AddSyncfusionSmartComponents()
.InjectOpenAIInference();
var app = builder.Build();
....
```
--------------------------------
### Configure Azure OpenAI Service in Blazor Server App
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/README.md
Configures the Azure OpenAI service for Blazor Server applications. Requires installing Microsoft.Extensions.AI, Microsoft.Extensions.AI.OpenAI, and Azure.AI.OpenAI NuGet packages. It injects the Azure OpenAI inference service.
```csharp
using Syncfusion.Blazor.SmartComponents;
using Syncfusion.Blazor.AI;
using Azure.AI.OpenAI;
using Microsoft.Extensions.AI;
using System.ClientModel;
var builder = WebApplication.CreateBuilder(args);
....
builder.Services.AddSyncfusionBlazor();
string azureOpenAIKey = "AZURE_OPENAI_KEY";
string azureOpenAIEndpoint = "AZURE_OPENAI_ENDPOINT";
string azureOpenAIModel = "AZURE_OPENAI_MODEL";
AzureOpenAIClient azureOpenAIClient = new AzureOpenAIClient(
new Uri(azureOpenAIEndpoint),
new ApiKeyCredential(azureOpenAIKey)
);
IChatClient azureOpenAIChatClient = azureOpenAIClient.GetChatClient(azureOpenAIModel).AsIChatClient();
builder.Services.AddChatClient(azureOpenAIChatClient);
builder.Services.AddSyncfusionSmartComponents()
.InjectOpenAIInference();
var app = builder.Build();
....
```
--------------------------------
### Use Open Iconic Standalone Icon Font
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/blazor/SyncfusionAISamples/wwwroot/open-iconic/README.md
This example shows how to use Open Iconic's icon font on its own, without a specific framework. It requires linking the default stylesheet and using span elements with the 'oi' class and a 'data-glyph' attribute to specify the icon.
```html
```
--------------------------------
### Implementing SmartTextArea in Vue.js
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/vue/src/ai-components/ai-smart-textarea/Readme.md
This snippet demonstrates how to integrate the Syncfusion SmartTextArea component into a Vue.js application. It includes template setup, component registration, and property configuration for placeholder, label type, resize mode, dimensions, user role, predefined phrases, and AI suggestion handling. The `aiSuggestionHandler` is configured to call an asynchronous function for fetching AI suggestions.
```html
```
```typescript
import { Component, Vue } from 'vue-property-decorator';
import { SmartTextAreaComponent } from '@syncfusion/ej2-vue-inputs';
@Component({
components: {
'ejs-smarttextarea': SmartTextAreaComponent
}
})
export default class App extends Vue {
public placeholder: string = 'Enter your queries here';
public floatLabelType: string = 'Auto';
public resizeMode: string = 'Both';
public rows: number = 3;
public cols: number = 35;
public userRole: string = 'Employee communicating with internal team';
public userPhrases: string[] = [
"Please find the attached report.",
"Let's schedule a meeting to discuss this further.",
"Can you provide an update on this task?",
"I appreciate your prompt response.",
"Let's collaborate on this project to ensure timely delivery."
];
public serverAIRequest = async (settings: any) => {
let output = '';
try {
const response = await (window as any).AzureAIRequest(settings) as string;
output = response;
} catch (error) {
console.error("Error:", error);
}
return output;
}
}
```
--------------------------------
### Annotate Form Fields for SmartPasteButton
Source: https://github.com/syncfusion/smart-ai-samples/blob/master/react/src/ai-components/smartpaste/Readme.md
These HTML examples illustrate how to use the `data-smartpaste-description` attribute on form elements (``, `