You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> We do not guarantee compatibility or correct operation with higher versions.
24
26
@@ -76,20 +78,28 @@ Files to Review:
76
78
77
79
#### AI Assistant Provider
78
80
79
-
On the server side, the `AIAssistantProvider` service manages assistants. An `IAIAssistantFactory` instance creates assistants with keys specified in previous steps.
81
+
On the server side, the `AIAssistantProvider` service manages assistants.
The `AIAssistantCreator.CreateAssistantAsync` method uploads a file to OpenAI, configures tool resources, creates an assistant with specified instructions and tools, initializes a new thread, and returns the assistant and thread IDs. The generated assistant and thread IDs are then passed to the `IAIAssistantFactory.GetAssistant` method, which returns an `IAIAssistant` instance. The created instance is added to the application's assistant collection and is referenced by its unique name.
93
+
94
+
For information on OpenAI Assistants, refer to the following documents:
95
+
-[OpenAI Assistants API overview](https://platform.openai.com/docs/assistants/overview)
96
+
-[Azure OpenAI: OpenAI Assistants client library for .NET](https://learn.microsoft.com/en-us/dotnet/api/overview/azure/ai.openai.assistants-readme?view=azure-dotnet-preview)
97
+
-[OpenAI .NET API library](https://github.com/openai/openai-dotnet)
@@ -132,7 +142,7 @@ On the `BeforeRender` event, add a new tab (a container for the assistant interf
132
142
133
143
#### Access the Assistant
134
144
135
-
Once the document is ready, the `DocumentReady` event handler sends a request to the server and obtains the assistant's ID:
145
+
Once the document is ready, the `DocumentReady` event handler sends a request to the server and obtains the assistant name:
136
146
137
147
```js
138
148
asyncfunctionDocumentReady(sender, args) {
@@ -144,7 +154,27 @@ async function DocumentReady(sender, args) {
144
154
}
145
155
```
146
156
147
-
The [`PerformCustomDocumentOperation`](https://docs.devexpress.com/XtraReports/js-ASPxClientWebDocumentViewer?p=netframework#js_aspxclientwebdocumentviewer_performcustomdocumentoperation) method exports the report to PDF and creates an assistant based on the exported document. See [AIDocumentOperationService.cs](./CS/ReportingApp/Services/AIDocumentOperationService.cs) for implementation details.
157
+
The [`PerformCustomDocumentOperation`](https://docs.devexpress.com/XtraReports/js-ASPxClientWebDocumentViewer?p=netframework#js_aspxclientwebdocumentviewer_performcustomdocumentoperation) method exports the report to PDF and creates an assistant based on the exported document:
158
+
159
+
```cs
160
+
// ...
161
+
public override async Task<DocumentOperationResponse>PerformOperationAsync(DocumentOperationRequestrequest, PrintingSystemBaseprintingSystem, PrintingSystemBaseprintingSystemWithEditingFields) {
@@ -239,21 +269,9 @@ async function BeforeRender(sender, args) {
239
269
}
240
270
```
241
271
242
-
The `AIAssistantProvider` service creates an assistant using the provided PDF documentation (the *documentation.pdf* file):
272
+
The `AIAssistantProvider.CreateUserAssistant` method creates an assistant using the provided PDF documentation (the *documentation.pdf* file) and prompt. See the [AIAssistantProvider.cs](./CS/ReportingApp/Services/AIAssistantProvider.cs) file for implementation details.
var assistant =awaitassistantFactory.CreateAssistant(assistantName);
249
-
Assistants.TryAdd(assistantName, assistant);
250
-
var prompt =GetPrompt(assistantType);
251
-
if(assistantType ==AssistantType.UserAssistant) {
252
-
awaitLoadDocumentation(assistant, prompt);
253
-
}
254
-
return assistantName;
255
-
}
256
-
```
257
275
#### Communicate with the Assistant
258
276
259
277
Each time a user sends a message, the [`onMessageEntered`](https://js.devexpress.com/jQuery/Documentation/24_2/ApiReference/UI_Components/dxChat/Configuration/#onMessageEntered) event handler passes the request to the assistant:
0 commit comments