[ACS-9564] Corrected models after change of Knowledge Retrieval answer structure (#10817)

* [ACS-9564] Corrected models after change of Knowledge Retrieval answer structure

* [ACS-9564] Changed id

* [ACS-9564] Fixed unit tests
This commit is contained in:
AleksanderSklorz 2025-04-25 08:56:12 +02:00 committed by GitHub
parent b1fca8dd4b
commit 50ad04aeb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 164 additions and 42 deletions

View File

@ -60,11 +60,38 @@ describe('SearchAiService', () => {
const answer: AiAnswerEntry = {
entry: {
answer: 'Some answer 1',
questionId,
complete: true,
question: 'Some question',
objectReferences: [
{
objectId: 'some id 1',
references: [
{
referenceId: 'some reference id 1',
referenceText: 'some reference text 1'
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 2',
rank: 2,
rankScore: 0.004
}
]
},
{
objectId: 'some id 2',
references: [
{
referenceId: 'some reference id 3',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 4',
rank: 2,
rankScore: 0.004
}
]
}
]
}

View File

@ -52,27 +52,31 @@ A paginated list is returned in the response body. For example:
```json
{
"list": {
"pagination": {
"count": 2,
"hasMoreItems": false,
"totalItems": 2,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
"answer": "Some answer",
"questionId": "Some question id",
"question": "Some question",
"complete": true,
"objectReferences": [
{
"objectId": "some-object-id",
"references": [
{
"referenceId": "Some reference id",
"referenceText": "Some reference text"
"referenceId": "some-reference-id1",
"rankScore": 0.031,
"rank": 2
},
{
"referenceId": "some-reference-id2",
"rankScore": 0.031,
"rank": 1
},
{
"referenceId": "some-reference-id3",
"rankScore": 0.028,
"rank": 3
}
]
}
}
]
}
}
@ -140,9 +144,19 @@ searchAiApi.getConfig().then((answer) => {
**Properties**
| Name | Type |
|----------------|-------------------------------------------|
|----------------------|-------------------------------------------------------|
| **answer** | string |
| **questionId** | string |
| **question** | string |
| **complete** | boolean |
| **objectReferences** | [AiAnswerObjectReference](#AiAnswerObjectReference)[] |
## AiAnswerObjectReference
**Properties**
| Name | Type |
|----------------|-------------------------------------------|
| **objectId** | string |
| **references** | [AiAnswerReference](#AiAnswerReference)[] |
## AiAnswerReference
@ -150,9 +164,10 @@ searchAiApi.getConfig().then((answer) => {
**Properties**
| Name | Type |
|-------------------|--------|
|-----------------|--------|
| **referenceId** | string |
| **referenceText** | string |
| **rankScore** | number |
| **rank** | number |
## QuestionModel

View File

@ -15,10 +15,11 @@
* limitations under the License.
*/
import { AiAnswerReference } from './aiAnswerReference';
import { AiAnswerObjectReference } from './aiAnswerObjectReference';
export interface AiAnswer {
answer: string;
questionId: string;
references: AiAnswerReference[];
answer?: string;
question: string;
complete: boolean;
objectReferences: AiAnswerObjectReference[];
}

View File

@ -0,0 +1,23 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AiAnswerReference } from './aiAnswerReference';
export interface AiAnswerObjectReference {
objectId: string;
references: AiAnswerReference[];
}

View File

@ -17,5 +17,6 @@
export interface AiAnswerReference {
referenceId: string;
referenceText: string;
rankScore: number;
rank: number;
}

View File

@ -34,6 +34,7 @@ export * from './agentPagingList';
export * from './aiAnswer';
export * from './aiAnswerEntry';
export * from './aiAnswerReference';
export * from './aiAnswerObjectReference';
export * from './association';
export * from './associationBody';
export * from './associationEntry';

View File

@ -68,11 +68,38 @@ describe('SearchAiApi', () => {
assert.deepStrictEqual(answer, {
entry: {
answer: 'Some answer 1',
questionId: 'some id 1',
complete: true,
question: 'Some question',
objectReferences: [
{
objectId: 'some id 1',
references: [
{
referenceId: 'some reference id 1',
referenceText: 'some reference text 1'
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 2',
rank: 2,
rankScore: 0.004
}
]
},
{
objectId: 'some id 2',
references: [
{
referenceId: 'some reference id 3',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 4',
rank: 2,
rankScore: 0.004
}
]
}
]
}

View File

@ -46,11 +46,38 @@ export class SearchAiMock extends BaseMock {
.reply(200, {
entry: {
answer: 'Some answer 1',
questionId: 'some id 1',
complete: true,
question: 'Some question',
objectReferences: [
{
objectId: 'some id 1',
references: [
{
referenceId: 'some reference id 1',
referenceText: 'some reference text 1'
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 2',
rank: 2,
rankScore: 0.004
}
]
},
{
objectId: 'some id 2',
references: [
{
referenceId: 'some reference id 3',
rank: 1,
rankScore: 0.005
},
{
referenceId: 'some reference id 4',
rank: 2,
rankScore: 0.004
}
]
}
]
}