Skip to content

Commit a5b8c19

Browse files
Fix KB recall for inference endpoint connectors
1 parent 9b97e78 commit a5b8c19

3 files changed

Lines changed: 6 additions & 17 deletions

File tree

x-pack/platform/plugins/shared/observability_ai_assistant/server/functions/context/context.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ export function registerContextFunction({
3535
async ({ connectorId, messages, screenContexts, chat }, signal) => {
3636
const { request, plugins } = resources;
3737
const { analytics } = await plugins.core.start();
38-
const actionsClient = await (
39-
await plugins.actions.start()
40-
).getActionsClientWithRequest(request);
4138

4239
async function getContext() {
4340
const screenDescription = compact(
@@ -64,10 +61,8 @@ export function registerContextFunction({
6461
return { content };
6562
}
6663

67-
const connector = await actionsClient.get({
68-
id: connectorId,
69-
throwIfSystemAction: true,
70-
});
64+
const inferenceStart = await plugins.inference.start();
65+
const connector = await inferenceStart.getConnectorById(connectorId, request);
7166

7267
const { llmScores, relevantDocuments, suggestions } = await recallAndScore({
7368
recall: client.recall,

x-pack/platform/plugins/shared/observability_ai_assistant/server/functions/context/utils/recall_and_score.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import type { Logger } from '@kbn/logging';
99
import type { AnalyticsServiceStart } from '@kbn/core/server';
1010
import type { AssistantScope } from '@kbn/ai-assistant-common';
11-
import type { Connector } from '@kbn/actions-plugin/server';
11+
import type { InferenceConnector } from '@kbn/inference-common';
1212
import { scoreSuggestions } from './score_suggestions';
1313
import type { Message } from '../../../../common';
1414
import { getInferenceConnectorInfo } from '../../../../common/utils/get_inference_connector';
@@ -36,7 +36,7 @@ export async function recallAndScore({
3636
chat: FunctionCallChatFunction;
3737
analytics: AnalyticsServiceStart;
3838
scopes: AssistantScope[];
39-
connector?: Connector;
39+
connector?: InferenceConnector;
4040
screenDescription: string;
4141
messages: Message[];
4242
logger: Logger;

x-pack/platform/plugins/shared/observability_ai_assistant/server/routes/chat/route.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,10 @@ const chatRecallRoute = createObservabilityAIAssistantServerRoute({
203203

204204
const { request, plugins } = resources;
205205

206-
const actionsClient = await (
207-
await plugins.actions.start()
208-
).getActionsClientWithRequest(request);
209-
210206
const { connectorId, screenDescription, messages, scopes } = resources.params.body;
211207

212-
const connector = await actionsClient.get({
213-
id: connectorId,
214-
throwIfSystemAction: true,
215-
});
208+
const inferenceStart = await plugins.inference.start();
209+
const connector = await inferenceStart.getConnectorById(connectorId, request);
216210
const response$ = from(
217211
recallAndScore({
218212
analytics: (await resources.plugins.core.start()).analytics,

0 commit comments

Comments
 (0)