mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-18 14:08:21 +00:00
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Backend Unit Tests / backend (push) Blocked by required conditions
Channel Gateway / gateway (push) Waiting to run
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Frontend Unit Tests / frontend (push) Blocked by required conditions
Playwright E2E Tests / Codegraph select (push) Waiting to run
Playwright E2E Tests / Shard timings (push) Waiting to run
Playwright E2E Tests / e2e () (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 1) (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 2) (push) Blocked by required conditions
Playwright E2E Tests / MCP Apps (browser and server) (push) Waiting to run
Playwright E2E Tests / e2e (push) Blocked by required conditions
Playwright Shard Timings / Record shard timings (push) Waiting to run
* feat: bridge host provider-text policy to remote SDK runs * build: consume published agents 4.2.7 for remote policy services
130 lines
3.7 KiB
JavaScript
130 lines
3.7 KiB
JavaScript
const { performance } = require('node:perf_hooks');
|
|
const { randomUUID } = require('node:crypto');
|
|
const {
|
|
GraphEvents,
|
|
Providers,
|
|
ProviderTextAdmission,
|
|
createHostProviderTextService,
|
|
} = require('@librechat/agents');
|
|
const { HumanMessage } = require('@librechat/agents/langchain/messages');
|
|
const { createRemoteSdkRun } = require('@librechat/api/sdk');
|
|
const { createExampleRun } = require('./agent.cjs');
|
|
|
|
const protectedOutput = process.env.SDK_BENCHMARK_PROTECTION === 'true';
|
|
const admission = new ProviderTextAdmission({
|
|
maxConcurrentInspections: 4,
|
|
maxBufferedBytes: 4194304,
|
|
});
|
|
// A deterministic pass-through policy measures bridge cost, not production PII detection.
|
|
const policy = {
|
|
version: 1,
|
|
timeoutMs: 10000,
|
|
maxAttemptBytes: 1048576,
|
|
maxBufferedBytes: 4194304,
|
|
classify: () => 'prose',
|
|
inspect: ({ content }) => ({
|
|
version: 1,
|
|
ok: true,
|
|
value: { content, replacements: 0, categories: [] },
|
|
}),
|
|
};
|
|
|
|
async function measure(remote) {
|
|
const identity = {
|
|
runtimeId: process.env.SDK_RUNTIME_ID || 'remote-example',
|
|
agentId: process.env.SDK_BENCHMARK_AGENT_ID || 'benchmark',
|
|
runId: randomUUID(),
|
|
conversationId: randomUUID(),
|
|
userId: 'benchmark',
|
|
};
|
|
let firstEventMs;
|
|
const started = performance.now();
|
|
const config = {
|
|
runId: identity.runId,
|
|
...(protectedOutput && { providerTextProtection: policy }),
|
|
returnContent: true,
|
|
tokenCounter: () => 1,
|
|
customHandlers: {
|
|
[GraphEvents.ON_MESSAGE_DELTA]: {
|
|
handle: async () => {
|
|
firstEventMs ??= performance.now() - started;
|
|
},
|
|
},
|
|
},
|
|
graphConfig: {
|
|
type: 'standard',
|
|
llmConfig: { provider: Providers.OPENAI },
|
|
agentId: identity.agentId,
|
|
},
|
|
};
|
|
const run = remote
|
|
? await createRemoteSdkRun({
|
|
config,
|
|
identity,
|
|
...(protectedOutput && {
|
|
hostServices: {
|
|
providerText: createHostProviderTextService({
|
|
identity,
|
|
policy,
|
|
admission,
|
|
inspectionTimeoutMs: 5000,
|
|
}),
|
|
},
|
|
}),
|
|
remote: {
|
|
url: process.env.SDK_RUNTIME_URL || 'ws://127.0.0.1:8804/sdk',
|
|
secret: process.env.SDK_RUNTIME_SECRET || '',
|
|
...(process.env.SDK_RUNTIME_RECOVERY === 'true' && {
|
|
recovery: { maxDisconnectMs: 15000, retryDelayMs: 250, maxJournalBytes: 67108864 },
|
|
}),
|
|
},
|
|
})
|
|
: await createExampleRun({
|
|
config,
|
|
identity,
|
|
compileOptions: {},
|
|
signal: new AbortController().signal,
|
|
agent: { id: identity.agentId },
|
|
});
|
|
await run.processStream(
|
|
{ messages: [new HumanMessage('Inspect and review the fixture.')] },
|
|
{
|
|
version: 'v2',
|
|
configurable: { thread_id: identity.conversationId },
|
|
},
|
|
);
|
|
return { firstEventMs, completedMs: performance.now() - started };
|
|
}
|
|
async function main() {
|
|
await measure(false);
|
|
await measure(true);
|
|
const local = [],
|
|
remote = [];
|
|
for (let i = 0; i < 5; i++) {
|
|
local.push(await measure(false));
|
|
remote.push(await measure(true));
|
|
}
|
|
const median = (samples, key) => samples.map((item) => item[key]).sort((a, b) => a - b)[2];
|
|
console.log(
|
|
JSON.stringify(
|
|
{
|
|
mode: 'deterministic custom graph, five warm samples',
|
|
protectedOutput,
|
|
local,
|
|
remote,
|
|
median: {
|
|
localFirstEventMs: median(local, 'firstEventMs'),
|
|
remoteFirstEventMs: median(remote, 'firstEventMs'),
|
|
localCompletedMs: median(local, 'completedMs'),
|
|
remoteCompletedMs: median(remote, 'completedMs'),
|
|
},
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
);
|
|
}
|
|
main().catch((error) => {
|
|
console.error('Benchmark failed', { name: error.name });
|
|
process.exitCode = 1;
|
|
});
|