Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 69 additions & 8 deletions docs/ai/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
sidebar_label: Chat Endpoint
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Chat Endpoint

Expand Down Expand Up @@ -171,36 +173,95 @@ Chat maintains server-side conversation history per user and datasource. This en

## Server-Side Implementation

The Chat endpoint is automatically registered when you configure Reveal AI in your ASP.NET Core application:
The Chat endpoints are registered automatically when you configure Reveal AI in your application. No additional controller, route, or servlet wiring is required — both POST and DELETE endpoints are ready as soon as the AI services are added.

<Tabs groupId="code" queryString>
<TabItem value="aspnet" label="ASP.NET" default>

```csharp title="Program.cs"
using Reveal.Sdk;
using Reveal.Sdk.AI;

var builder = WebApplication.CreateBuilder(args);

// Add Reveal SDK
builder.Services.AddControllers().AddReveal(revealBuilder =>
{
// Configure datasource provider
revealBuilder.AddDataSourceProvider<DataSourceProvider>();
});

// Add Reveal AI - automatically registers chat endpoints
builder.Services.AddRevealAI()
.AddOpenAI(options =>
{
options.ApiKey = builder.Configuration["OpenAI:ApiKey"];
options.ModelId = "gpt-4.1";
});
options.ApiKey = builder.Configuration["RevealAI:OpenAI:ApiKey"];
options.Model = "gpt-4.1";
})
.UseMetadataCatalogFile("config/catalog.json");

var app = builder.Build();

app.MapControllers();
app.Run();
```

No additional controller or routing configuration is needed. Both POST and DELETE endpoints are ready to use once you call `AddRevealAI()`.
</TabItem>

<TabItem value="node" label="Node.js">

```javascript title="server.js"
const reveal = require('reveal-sdk-node');
const revealAI = require('reveal-sdk-node-ai');
const express = require('express');
const path = require('path');

const aiSettings = {
openai: {
ApiKey: process.env.OPENAI_API_KEY,
Model: 'gpt-4.1'
}
};

const revealOptions = {
dataSourceProvider: dataSourceProvider,
plugins: [
revealAI.withOptions({
defaultProvider: 'openai',
settings: aiSettings,
metadataCatalogFile: path.resolve(__dirname, 'Reveal', 'Metadata', 'catalog.json')
})
]
};

const app = express();
app.use('/', reveal(revealOptions));
app.listen(5111);
```

</TabItem>

<TabItem value="java" label="Java">

```java title="Application.java"
Map<String, Object> aiSettings = Map.of(
"openai", Map.of(
"ApiKey", System.getenv("OPENAI_API_KEY"),
"Model", "gpt-4.1"));

RevealAIPluginOptions aiPluginOptions = new RevealAIPluginOptions(
"openai",
Path.of("src", "main", "resources", "Reveal", "Metadata", "catalog.json")
.toAbsolutePath().normalize().toString(),
null,
null,
Map.of("settings", aiSettings));

IRevealServer revealServer = new RevealServerBuilder()
.setDataSourceProvider(dataSourceProvider)
.addPlugin(RevealAIPlugin.withOptions(aiPluginOptions))
.build();
```

</TabItem>
</Tabs>

## Metadata Configuration

Expand Down
6 changes: 6 additions & 0 deletions docs/ai/getting-started-html.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Before you begin, ensure you meet the [System Requirements](system-requirements.
2. [Reveal SDK AI Server](install-server-sdk.md) installed
3. **LLM Provider API Key** from [OpenAI](https://platform.openai.com/api-keys), [Anthropic](https://platform.anthropic.com/account/keys), or [Google Cloud](https://cloud.google.com/vertex-ai)

:::info Other server platforms

This guide uses ASP.NET Core for the server. The Reveal SDK AI Server is also available for **Node.js** and **Java** — see [Install Server SDK](install-server-sdk.md) for the equivalent installation and configuration steps. The HTML/JavaScript client below is identical regardless of which server you choose.

:::

## Step 1: Create the ASP.NET Core Server

### 1.1 Create a New ASP.NET Core Web API Project
Expand Down
Loading
Loading