Skip to content

Commit

Permalink
[Backport] Update @elastic/appex-ai-infra (main) (#200579) (#202809)
Browse files Browse the repository at this point in the history
This PR backports #200579 to `8.x`

Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
  • Loading branch information
legrego and elastic-renovate-prod[bot] authored Dec 5, 2024
1 parent 3314a65 commit 59883db
Show file tree
Hide file tree
Showing 9 changed files with 268 additions and 129 deletions.
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"@types/react": "~18.2.0",
"@types/react-dom": "~18.2.0",
"@xstate5/react/**/xstate": "^5.18.1",
"globby/fast-glob": "^3.2.11"
"globby/fast-glob": "^3.3.2"
},
"dependencies": {
"@appland/sql-parser": "^1.5.1",
Expand Down Expand Up @@ -1030,7 +1030,7 @@
"@langchain/google-vertexai": "^0.1.0",
"@langchain/langgraph": "0.2.19",
"@langchain/openai": "^0.3.11",
"@langtrase/trace-attributes": "^3.0.8",
"@langtrase/trace-attributes": "^7.5.0",
"@launchdarkly/node-server-sdk": "^9.7.2",
"@launchdarkly/openfeature-node-server": "^1.0.0",
"@loaders.gl/core": "^3.4.7",
Expand All @@ -1057,12 +1057,12 @@
"@reduxjs/toolkit": "1.9.7",
"@slack/webhook": "^7.0.1",
"@smithy/eventstream-codec": "^3.1.1",
"@smithy/eventstream-serde-node": "^3.0.3",
"@smithy/eventstream-serde-node": "^3.0.12",
"@smithy/middleware-stack": "^3.0.10",
"@smithy/node-http-handler": "^3.3.1",
"@smithy/protocol-http": "^4.1.7",
"@smithy/signature-v4": "^3.1.1",
"@smithy/types": "^3.2.0",
"@smithy/signature-v4": "^4.2.3",
"@smithy/types": "^3.7.1",
"@smithy/util-utf8": "^3.0.0",
"@tanstack/react-query": "^4.29.12",
"@tanstack/react-query-devtools": "^4.29.12",
Expand All @@ -1081,12 +1081,12 @@
"@xyflow/react": "^12.3.2",
"adm-zip": "^0.5.9",
"ai": "^2.2.33",
"ajv": "^8.12.0",
"ansi-regex": "^6.0.1",
"ajv": "^8.17.1",
"ansi-regex": "^6.1.0",
"antlr4": "^4.13.1-patch-1",
"archiver": "^7.0.1",
"async": "^3.2.3",
"aws4": "^1.12.0",
"aws4": "^1.13.2",
"axios": "^1.7.4",
"base64-js": "^1.3.1",
"bitmap-sdf": "^1.0.3",
Expand Down Expand Up @@ -1129,7 +1129,7 @@
"dotenv": "^16.4.5",
"elastic-apm-node": "^4.7.3",
"email-addresses": "^5.0.0",
"eventsource-parser": "^1.1.1",
"eventsource-parser": "^3.0.0",
"execa": "^5.1.1",
"expiry-js": "0.1.7",
"exponential-backoff": "^3.1.1",
Expand All @@ -1147,7 +1147,7 @@
"getos": "^3.1.0",
"globby": "^11.1.0",
"google-auth-library": "^9.10.0",
"gpt-tokenizer": "^2.1.2",
"gpt-tokenizer": "^2.6.2",
"handlebars": "4.7.8",
"he": "^1.2.0",
"history": "^4.9.0",
Expand Down Expand Up @@ -1175,7 +1175,7 @@
"jsts": "^1.6.2",
"kea": "^2.6.0",
"langchain": "^0.3.5",
"langsmith": "^0.2.3",
"langsmith": "^0.2.5",
"launchdarkly-js-client-sdk": "^3.5.0",
"load-json-file": "^6.2.0",
"lodash": "^4.17.21",
Expand Down Expand Up @@ -1204,7 +1204,7 @@
"nunjucks": "^3.2.4",
"object-hash": "^1.3.1",
"object-path-immutable": "^3.1.1",
"openai": "^4.68.0",
"openai": "^4.72.0",
"openpgp": "5.10.1",
"opn": "^5.5.0",
"ora": "^4.0.4",
Expand Down Expand Up @@ -1591,7 +1591,7 @@
"@types/js-search": "^1.4.0",
"@types/js-yaml": "^3.11.1",
"@types/jsdom": "^20.0.1",
"@types/json-schema": "^7",
"@types/json-schema": "^7.0.15",
"@types/json-stable-stringify": "^1.0.32",
"@types/json5": "^2.2.0",
"@types/jsonwebtoken": "^9.0.0",
Expand Down Expand Up @@ -1835,7 +1835,7 @@
"svgo": "^2.8.0",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.1",
"table": "^6.8.1",
"table": "^6.8.2",
"tape": "^5.0.1",
"terser": "^5.31.6",
"terser-webpack-plugin": "^4.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export function createObservableFromHttpResponse(
}

return new Observable<string>((subscriber) => {
const parser = createParser((event) => {
if (event.type === 'event') {
const parser = createParser({
onEvent: (event) => {
subscriber.next(event.data);
}
},
});

const readStream = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export function createObservableFromHttpResponse<T extends ServerSentEvent = nev
}

return new Observable<T>((subscriber) => {
const parser = createParser((event) => {
if (event.type === 'event')
const parser = createParser({
onEvent: (event) => {
try {
const data = JSON.parse(event.data);
if (event.event === 'error') {
Expand All @@ -48,6 +48,7 @@ export function createObservableFromHttpResponse<T extends ServerSentEvent = nev
} catch (error) {
subscriber.error(createSSEInternalError(`Failed to parse JSON`));
}
},
});

const readStream = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export function createObservableFromHttpResponse(
}

return new Observable<string>((subscriber) => {
const parser = createParser((event) => {
if (event.type === 'event') {
const parser = createParser({
onEvent: (event) => {
subscriber.next(event.data);
}
},
});

const readStream = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { Observable } from 'rxjs';

export function eventSourceStreamIntoObservable(readable: Readable) {
return new Observable<string>((subscriber) => {
const parser = createParser((event) => {
if (event.type === 'event') {
const parser = createParser({
onEvent: (event) => {
subscriber.next(event.data);
}
},
});

async function processStream() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ describe('observableIntoEventSourceStream', () => {

const events: Array<Record<string, any>> = [];

const parser = createParser((event) => {
if (event.type === 'event') {
const parser = createParser({
onEvent: (event) => {
events.push(JSON.parse(event.data));
}
},
});

chunks.forEach((chunk) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export function withLangtraceChatCompleteSpan<T extends ChatEvent>({
'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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { Observable } from 'rxjs';

export function eventsourceStreamIntoObservable(readable: Readable) {
return new Observable<string>((subscriber) => {
const parser = createParser((event) => {
if (event.type === 'event') {
const parser = createParser({
onEvent: (event) => {
subscriber.next(event.data);
}
},
});

async function processStream() {
Expand Down
Loading

0 comments on commit 59883db

Please sign in to comment.