@absolutejs/rag 0.0.18 → 0.0.19

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/index.js CHANGED
@@ -11658,7 +11658,7 @@ var resolveRAGHTMXRenderers = (custom = {}) => {
11658
11658
  };
11659
11659
  };
11660
11660
  // src/chat/chat.ts
11661
- import { Elysia } from "elysia";
11661
+ import { Elysia, sse } from "elysia";
11662
11662
 
11663
11663
  // src/internal/constants.ts
11664
11664
  var HTTP_STATUS_OK = 200;
@@ -30856,12 +30856,12 @@ var ragChat = (config) => {
30856
30856
  }).post(`${path}/evaluate/stream`, async function* ({ body, request }) {
30857
30857
  const input = toRAGEvaluationInput(body);
30858
30858
  if (!input) {
30859
- yield {
30859
+ yield sse({
30860
30860
  data: JSON.stringify({
30861
30861
  error: "Expected payload shape: { cases: [{ id, query, expectedChunkIds|expectedSources|expectedDocumentIds }] }"
30862
30862
  }),
30863
30863
  event: "error"
30864
- };
30864
+ });
30865
30865
  return;
30866
30866
  }
30867
30867
  const accessScope = await loadAccessScope(request);
@@ -30869,27 +30869,27 @@ var ragChat = (config) => {
30869
30869
  if (evaluationCase.corpusKey && !matchesAccessScope(accessScope, {
30870
30870
  corpusKey: evaluationCase.corpusKey
30871
30871
  }) || (evaluationCase.expectedDocumentIds ?? []).some((documentId) => !matchesAccessScope(accessScope, { documentId })) || (evaluationCase.expectedSources ?? []).some((source) => !matchesAccessScope(accessScope, { source }))) {
30872
- yield {
30872
+ yield sse({
30873
30873
  data: JSON.stringify({
30874
30874
  error: "Evaluation case is outside the allowed RAG access scope"
30875
30875
  }),
30876
30876
  event: "error"
30877
- };
30877
+ });
30878
30878
  return;
30879
30879
  }
30880
30880
  }
30881
30881
  const collection = resolveCollection();
30882
30882
  if (!collection) {
30883
- yield {
30883
+ yield sse({
30884
30884
  data: JSON.stringify({ error: "RAG collection is not configured" }),
30885
30885
  event: "error"
30886
- };
30886
+ });
30887
30887
  return;
30888
30888
  }
30889
- yield {
30889
+ yield sse({
30890
30890
  data: JSON.stringify({ total: input.cases.length }),
30891
30891
  event: "start"
30892
- };
30892
+ });
30893
30893
  const pending = [];
30894
30894
  let resolveNext = null;
30895
30895
  let finished = false;
@@ -30912,7 +30912,7 @@ var ragChat = (config) => {
30912
30912
  });
30913
30913
  while (true) {
30914
30914
  while (pending.length > 0) {
30915
- yield { data: JSON.stringify(pending.shift()), event: "case" };
30915
+ yield sse({ data: JSON.stringify(pending.shift()), event: "case" });
30916
30916
  }
30917
30917
  if (finished) {
30918
30918
  break;
@@ -30923,14 +30923,14 @@ var ragChat = (config) => {
30923
30923
  }
30924
30924
  try {
30925
30925
  const result = await resultPromise;
30926
- yield { data: JSON.stringify(result), event: "result" };
30926
+ yield sse({ data: JSON.stringify(result), event: "result" });
30927
30927
  } catch (caught) {
30928
- yield {
30928
+ yield sse({
30929
30929
  data: JSON.stringify({
30930
30930
  error: caught instanceof Error ? caught.message : String(caught)
30931
30931
  }),
30932
30932
  event: "error"
30933
- };
30933
+ });
30934
30934
  }
30935
30935
  }).get(`${path}/status`, async ({ request }) => {
30936
30936
  const result = await handleStatus(request);
@@ -38164,5 +38164,5 @@ export {
38164
38164
  addRAGEvaluationSuiteCase
38165
38165
  };
38166
38166
 
38167
- //# debugId=27BA74206F3A122164756E2164756E21
38167
+ //# debugId=BD3325EB562F864664756E2164756E21
38168
38168
  //# sourceMappingURL=index.js.map