From 978c692007ca4a564faa02b17c1e22ff4096d912 Mon Sep 17 00:00:00 2001 From: Larry Gregory Date: Mon, 18 Nov 2024 13:58:41 -0500 Subject: [PATCH] Add missing attributes for new version of @langtrase/trace-attributes --- .../src/create_observable_from_http_response.ts | 6 +++--- .../client/operators/with_langtrace_chat_complete_span.ts | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/kbn-server-route-repository-client/src/create_observable_from_http_response.ts b/packages/kbn-server-route-repository-client/src/create_observable_from_http_response.ts index 1690244ca19a..ccd0980617f8 100644 --- a/packages/kbn-server-route-repository-client/src/create_observable_from_http_response.ts +++ b/packages/kbn-server-route-repository-client/src/create_observable_from_http_response.ts @@ -37,10 +37,10 @@ export function createObservableFromHttpResponse( } return new Observable((subscriber) => { - const parser = createParser((event) => { - if (event.type === 'event') { + const parser = createParser({ + onEvent: (event) => { subscriber.next(event.data); - } + }, }); const readStream = async () => { diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant/server/service/client/operators/with_langtrace_chat_complete_span.ts b/x-pack/plugins/observability_solution/observability_ai_assistant/server/service/client/operators/with_langtrace_chat_complete_span.ts index 9e32ba4b57bf..767121928622 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant/server/service/client/operators/with_langtrace_chat_complete_span.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant/server/service/client/operators/with_langtrace_chat_complete_span.ts @@ -41,7 +41,10 @@ export function withLangtraceChatCompleteSpan({ 'http.max.retries': 0, // dummy URL 'url.full': 'http://localhost:3000/chat/completions', + 'url.path': '/chat/completions', 'http.timeout': 120 * 1000, + 'gen_ai.operation.name': 'chat_completion', + 'gen_ai.request.model': model, 'llm.prompts': JSON.stringify( messages.map((message) => ({ role: message.message.role,