@okf/ootils 1.41.1 → 1.41.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +58 -18
- package/dist/browser.d.ts +58 -18
- package/dist/browser.js +52 -0
- package/dist/browser.mjs +52 -0
- package/dist/node.d.mts +58 -18
- package/dist/node.d.ts +58 -18
- package/dist/node.js +52 -0
- package/dist/node.mjs +52 -0
- package/dist/universal.d.mts +58 -18
- package/dist/universal.d.ts +58 -18
- package/dist/universal.js +52 -0
- package/dist/universal.mjs +52 -0
- package/package.json +1 -1
package/dist/universal.js
CHANGED
|
@@ -966,6 +966,58 @@ var BASE_BULLMQ_CONFIG = {
|
|
|
966
966
|
}
|
|
967
967
|
}
|
|
968
968
|
},
|
|
969
|
+
AI_AUTO_ANNOTATE_PREP_QUEUE: {
|
|
970
|
+
// PREP queue — the front of the per-doc Flow pipeline. The FE-facing
|
|
971
|
+
// /AIAutoAnnotate handler no longer fetches + summarizes + chunks +
|
|
972
|
+
// enqueues each doc inline (that serial, LLM-heavy loop blocked the HTTP
|
|
973
|
+
// request and risked App Engine clipping large batches mid-loop, silently
|
|
974
|
+
// dropping every doc past the cutoff). Instead the handler computes the
|
|
975
|
+
// batch-level prereqs ONCE (7th criterion + platform-derived categories)
|
|
976
|
+
// and enqueues one PREP job per doc here, then returns fast.
|
|
977
|
+
//
|
|
978
|
+
// Each prep job's worker (okf-sub) calls okf-be /internal/prepDoc, which
|
|
979
|
+
// does the per-doc work: fetch → summarizeDocument (warms the doc-level
|
|
980
|
+
// summary cache) → chunk fields → enqueue that doc's Flow (parent on
|
|
981
|
+
// AI_AUTO_ANNOTATE_QUEUE + one child per chunk on the CHUNK queue). So the
|
|
982
|
+
// Flow parents now get created rolling, as each prep job completes, rather
|
|
983
|
+
// than all up-front in the request. A prep failure isolates to its one doc
|
|
984
|
+
// (that doc is skipped); sibling prep jobs keep going.
|
|
985
|
+
id: "ai-auto-annotate-prep-queue",
|
|
986
|
+
queueConfig: {
|
|
987
|
+
defaultJobOptions: {
|
|
988
|
+
// attempts:1 — a retry would re-summarize (cache-HIT, cheap) but then
|
|
989
|
+
// re-enqueue the doc's Flow, double-annotating the doc. The rest of
|
|
990
|
+
// the per-doc Flow pipeline is attempts:1 for the same fail-loud
|
|
991
|
+
// reason (a retry just re-fires expensive LLM work).
|
|
992
|
+
attempts: 1,
|
|
993
|
+
backoff: {
|
|
994
|
+
type: "exponential",
|
|
995
|
+
delay: 5e3
|
|
996
|
+
},
|
|
997
|
+
removeOnComplete: 30,
|
|
998
|
+
removeOnFail: 100
|
|
999
|
+
},
|
|
1000
|
+
streams: {
|
|
1001
|
+
events: {
|
|
1002
|
+
maxLen: 10
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
workerConfig: {
|
|
1007
|
+
// Each prep job = one Mongo doc fetch + ONE summarize LLM call + a
|
|
1008
|
+
// deterministic chunk + a Flow enqueue. It's lighter than a chunk job
|
|
1009
|
+
// (which does ~4 LLM calls), so we can run more in parallel — 10 keeps
|
|
1010
|
+
// prep comfortably AHEAD of the downstream chunk queue (concurrency 5),
|
|
1011
|
+
// which is the real throughput cap. Going much higher than that buys
|
|
1012
|
+
// little: prep would just drain faster into a chunk queue that still
|
|
1013
|
+
// processes 5 at a time, while adding concurrent okf-be /internal/prepDoc
|
|
1014
|
+
// load + concurrent summarize calls against the shared OpenAI TPM budget.
|
|
1015
|
+
concurrency: 10,
|
|
1016
|
+
lockDuration: 3e5,
|
|
1017
|
+
// 5 min — generous ceiling over the 180s summarizer timeout
|
|
1018
|
+
maxStalledCount: 1
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
969
1021
|
AI_AUTO_ANNOTATE_QUEUE: {
|
|
970
1022
|
// PARENT queue in the per-doc Flow. One job per doc; child jobs (one
|
|
971
1023
|
// per chunk) live on AI_AUTO_ANNOTATE_CHUNK_QUEUE. BullMQ Flow fires
|
package/dist/universal.mjs
CHANGED
|
@@ -896,6 +896,58 @@ var BASE_BULLMQ_CONFIG = {
|
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
898
|
},
|
|
899
|
+
AI_AUTO_ANNOTATE_PREP_QUEUE: {
|
|
900
|
+
// PREP queue — the front of the per-doc Flow pipeline. The FE-facing
|
|
901
|
+
// /AIAutoAnnotate handler no longer fetches + summarizes + chunks +
|
|
902
|
+
// enqueues each doc inline (that serial, LLM-heavy loop blocked the HTTP
|
|
903
|
+
// request and risked App Engine clipping large batches mid-loop, silently
|
|
904
|
+
// dropping every doc past the cutoff). Instead the handler computes the
|
|
905
|
+
// batch-level prereqs ONCE (7th criterion + platform-derived categories)
|
|
906
|
+
// and enqueues one PREP job per doc here, then returns fast.
|
|
907
|
+
//
|
|
908
|
+
// Each prep job's worker (okf-sub) calls okf-be /internal/prepDoc, which
|
|
909
|
+
// does the per-doc work: fetch → summarizeDocument (warms the doc-level
|
|
910
|
+
// summary cache) → chunk fields → enqueue that doc's Flow (parent on
|
|
911
|
+
// AI_AUTO_ANNOTATE_QUEUE + one child per chunk on the CHUNK queue). So the
|
|
912
|
+
// Flow parents now get created rolling, as each prep job completes, rather
|
|
913
|
+
// than all up-front in the request. A prep failure isolates to its one doc
|
|
914
|
+
// (that doc is skipped); sibling prep jobs keep going.
|
|
915
|
+
id: "ai-auto-annotate-prep-queue",
|
|
916
|
+
queueConfig: {
|
|
917
|
+
defaultJobOptions: {
|
|
918
|
+
// attempts:1 — a retry would re-summarize (cache-HIT, cheap) but then
|
|
919
|
+
// re-enqueue the doc's Flow, double-annotating the doc. The rest of
|
|
920
|
+
// the per-doc Flow pipeline is attempts:1 for the same fail-loud
|
|
921
|
+
// reason (a retry just re-fires expensive LLM work).
|
|
922
|
+
attempts: 1,
|
|
923
|
+
backoff: {
|
|
924
|
+
type: "exponential",
|
|
925
|
+
delay: 5e3
|
|
926
|
+
},
|
|
927
|
+
removeOnComplete: 30,
|
|
928
|
+
removeOnFail: 100
|
|
929
|
+
},
|
|
930
|
+
streams: {
|
|
931
|
+
events: {
|
|
932
|
+
maxLen: 10
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
workerConfig: {
|
|
937
|
+
// Each prep job = one Mongo doc fetch + ONE summarize LLM call + a
|
|
938
|
+
// deterministic chunk + a Flow enqueue. It's lighter than a chunk job
|
|
939
|
+
// (which does ~4 LLM calls), so we can run more in parallel — 10 keeps
|
|
940
|
+
// prep comfortably AHEAD of the downstream chunk queue (concurrency 5),
|
|
941
|
+
// which is the real throughput cap. Going much higher than that buys
|
|
942
|
+
// little: prep would just drain faster into a chunk queue that still
|
|
943
|
+
// processes 5 at a time, while adding concurrent okf-be /internal/prepDoc
|
|
944
|
+
// load + concurrent summarize calls against the shared OpenAI TPM budget.
|
|
945
|
+
concurrency: 10,
|
|
946
|
+
lockDuration: 3e5,
|
|
947
|
+
// 5 min — generous ceiling over the 180s summarizer timeout
|
|
948
|
+
maxStalledCount: 1
|
|
949
|
+
}
|
|
950
|
+
},
|
|
899
951
|
AI_AUTO_ANNOTATE_QUEUE: {
|
|
900
952
|
// PARENT queue in the per-doc Flow. One job per doc; child jobs (one
|
|
901
953
|
// per chunk) live on AI_AUTO_ANNOTATE_CHUNK_QUEUE. BullMQ Flow fires
|