weave-typescript 0.28.0 → 0.30.0

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.
@@ -5,7 +5,7 @@
5
5
  // protoc unknown
6
6
  // source: weaveapi/retrieval/v1/retrieval.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.ExplainRetrievalResponse = exports.SubQueryResult = exports.ExplainRetrievalRequest = exports.RetrieveResponse = exports.RetrieveRequest = exports.RetrievedThread = exports.Citation = exports.RetrievalPlan = exports.RerankerConfig = exports.SubQuery = exports.RetrievalConstraints = exports.IntentSignal = exports.KnowledgeTypeBias = exports.SubQueryStrategy = exports.RetrievalTimeScope = exports.IntentType = exports.protobufPackage = void 0;
8
+ exports.ExplainRetrievalResponse = exports.SubQueryResult = exports.ExplainRetrievalRequest = exports.SearchDocumentsResponse = exports.SearchDocumentsRequest = exports.RetrieveResponse = exports.RetrieveRequest = exports.RetrievedDocument = exports.DocumentSearchSnippet = exports.DocumentSearchFilters = exports.RetrievedThread = exports.Citation = exports.RetrievalPlan = exports.RerankerConfig = exports.SubQuery = exports.RetrievalConstraints = exports.IntentSignal = exports.KnowledgeTypeBias = exports.SubQueryStrategy = exports.RetrievalTimeScope = exports.IntentType = exports.protobufPackage = void 0;
9
9
  exports.intentTypeFromJSON = intentTypeFromJSON;
10
10
  exports.intentTypeToJSON = intentTypeToJSON;
11
11
  exports.retrievalTimeScopeFromJSON = retrievalTimeScopeFromJSON;
@@ -1391,6 +1391,495 @@ exports.RetrievedThread = {
1391
1391
  return message;
1392
1392
  },
1393
1393
  };
1394
+ function createBaseDocumentSearchFilters() {
1395
+ return { tags: [], restrictedTags: [], scopes: [], uploadedAfter: undefined, uploadedBefore: undefined };
1396
+ }
1397
+ exports.DocumentSearchFilters = {
1398
+ encode(message, writer = new wire_1.BinaryWriter()) {
1399
+ for (const v of message.tags) {
1400
+ writer.uint32(10).string(v);
1401
+ }
1402
+ for (const v of message.restrictedTags) {
1403
+ writer.uint32(18).string(v);
1404
+ }
1405
+ writer.uint32(26).fork();
1406
+ for (const v of message.scopes) {
1407
+ writer.int32(v);
1408
+ }
1409
+ writer.join();
1410
+ if (message.uploadedAfter !== undefined) {
1411
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.uploadedAfter), writer.uint32(34).fork()).join();
1412
+ }
1413
+ if (message.uploadedBefore !== undefined) {
1414
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.uploadedBefore), writer.uint32(42).fork()).join();
1415
+ }
1416
+ return writer;
1417
+ },
1418
+ decode(input, length) {
1419
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1420
+ const end = length === undefined ? reader.len : reader.pos + length;
1421
+ const message = createBaseDocumentSearchFilters();
1422
+ while (reader.pos < end) {
1423
+ const tag = reader.uint32();
1424
+ switch (tag >>> 3) {
1425
+ case 1: {
1426
+ if (tag !== 10) {
1427
+ break;
1428
+ }
1429
+ message.tags.push(reader.string());
1430
+ continue;
1431
+ }
1432
+ case 2: {
1433
+ if (tag !== 18) {
1434
+ break;
1435
+ }
1436
+ message.restrictedTags.push(reader.string());
1437
+ continue;
1438
+ }
1439
+ case 3: {
1440
+ if (tag === 24) {
1441
+ message.scopes.push(reader.int32());
1442
+ continue;
1443
+ }
1444
+ if (tag === 26) {
1445
+ const end2 = reader.uint32() + reader.pos;
1446
+ while (reader.pos < end2) {
1447
+ message.scopes.push(reader.int32());
1448
+ }
1449
+ continue;
1450
+ }
1451
+ break;
1452
+ }
1453
+ case 4: {
1454
+ if (tag !== 34) {
1455
+ break;
1456
+ }
1457
+ message.uploadedAfter = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1458
+ continue;
1459
+ }
1460
+ case 5: {
1461
+ if (tag !== 42) {
1462
+ break;
1463
+ }
1464
+ message.uploadedBefore = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1465
+ continue;
1466
+ }
1467
+ }
1468
+ if ((tag & 7) === 4 || tag === 0) {
1469
+ break;
1470
+ }
1471
+ reader.skip(tag & 7);
1472
+ }
1473
+ return message;
1474
+ },
1475
+ fromJSON(object) {
1476
+ return {
1477
+ tags: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.tags) ? object.tags.map((e) => globalThis.String(e)) : [],
1478
+ restrictedTags: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.restrictedTags)
1479
+ ? object.restrictedTags.map((e) => globalThis.String(e))
1480
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.restricted_tags)
1481
+ ? object.restricted_tags.map((e) => globalThis.String(e))
1482
+ : [],
1483
+ scopes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.scopes) ? object.scopes.map((e) => (0, ingestion_pb_1.documentScopeFromJSON)(e)) : [],
1484
+ uploadedAfter: isSet(object.uploadedAfter)
1485
+ ? fromJsonTimestamp(object.uploadedAfter)
1486
+ : isSet(object.uploaded_after)
1487
+ ? fromJsonTimestamp(object.uploaded_after)
1488
+ : undefined,
1489
+ uploadedBefore: isSet(object.uploadedBefore)
1490
+ ? fromJsonTimestamp(object.uploadedBefore)
1491
+ : isSet(object.uploaded_before)
1492
+ ? fromJsonTimestamp(object.uploaded_before)
1493
+ : undefined,
1494
+ };
1495
+ },
1496
+ toJSON(message) {
1497
+ var _a, _b, _c;
1498
+ const obj = {};
1499
+ if ((_a = message.tags) === null || _a === void 0 ? void 0 : _a.length) {
1500
+ obj.tags = message.tags;
1501
+ }
1502
+ if ((_b = message.restrictedTags) === null || _b === void 0 ? void 0 : _b.length) {
1503
+ obj.restrictedTags = message.restrictedTags;
1504
+ }
1505
+ if ((_c = message.scopes) === null || _c === void 0 ? void 0 : _c.length) {
1506
+ obj.scopes = message.scopes.map((e) => (0, ingestion_pb_1.documentScopeToJSON)(e));
1507
+ }
1508
+ if (message.uploadedAfter !== undefined) {
1509
+ obj.uploadedAfter = message.uploadedAfter.toISOString();
1510
+ }
1511
+ if (message.uploadedBefore !== undefined) {
1512
+ obj.uploadedBefore = message.uploadedBefore.toISOString();
1513
+ }
1514
+ return obj;
1515
+ },
1516
+ create(base) {
1517
+ return exports.DocumentSearchFilters.fromPartial(base !== null && base !== void 0 ? base : {});
1518
+ },
1519
+ fromPartial(object) {
1520
+ var _a, _b, _c;
1521
+ var _d, _e;
1522
+ const message = createBaseDocumentSearchFilters();
1523
+ message.tags = ((_a = object.tags) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
1524
+ message.restrictedTags = ((_b = object.restrictedTags) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
1525
+ message.scopes = ((_c = object.scopes) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || [];
1526
+ message.uploadedAfter = (_d = object.uploadedAfter) !== null && _d !== void 0 ? _d : undefined;
1527
+ message.uploadedBefore = (_e = object.uploadedBefore) !== null && _e !== void 0 ? _e : undefined;
1528
+ return message;
1529
+ },
1530
+ };
1531
+ function createBaseDocumentSearchSnippet() {
1532
+ return { threadId: "", text: "", score: 0, classification: 0, sourceLocation: undefined };
1533
+ }
1534
+ exports.DocumentSearchSnippet = {
1535
+ encode(message, writer = new wire_1.BinaryWriter()) {
1536
+ if (message.threadId !== "") {
1537
+ writer.uint32(10).string(message.threadId);
1538
+ }
1539
+ if (message.text !== "") {
1540
+ writer.uint32(18).string(message.text);
1541
+ }
1542
+ if (message.score !== 0) {
1543
+ writer.uint32(29).float(message.score);
1544
+ }
1545
+ if (message.classification !== 0) {
1546
+ writer.uint32(32).int32(message.classification);
1547
+ }
1548
+ if (message.sourceLocation !== undefined) {
1549
+ ingestion_pb_1.SourceLocation.encode(message.sourceLocation, writer.uint32(42).fork()).join();
1550
+ }
1551
+ return writer;
1552
+ },
1553
+ decode(input, length) {
1554
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1555
+ const end = length === undefined ? reader.len : reader.pos + length;
1556
+ const message = createBaseDocumentSearchSnippet();
1557
+ while (reader.pos < end) {
1558
+ const tag = reader.uint32();
1559
+ switch (tag >>> 3) {
1560
+ case 1: {
1561
+ if (tag !== 10) {
1562
+ break;
1563
+ }
1564
+ message.threadId = reader.string();
1565
+ continue;
1566
+ }
1567
+ case 2: {
1568
+ if (tag !== 18) {
1569
+ break;
1570
+ }
1571
+ message.text = reader.string();
1572
+ continue;
1573
+ }
1574
+ case 3: {
1575
+ if (tag !== 29) {
1576
+ break;
1577
+ }
1578
+ message.score = reader.float();
1579
+ continue;
1580
+ }
1581
+ case 4: {
1582
+ if (tag !== 32) {
1583
+ break;
1584
+ }
1585
+ message.classification = reader.int32();
1586
+ continue;
1587
+ }
1588
+ case 5: {
1589
+ if (tag !== 42) {
1590
+ break;
1591
+ }
1592
+ message.sourceLocation = ingestion_pb_1.SourceLocation.decode(reader, reader.uint32());
1593
+ continue;
1594
+ }
1595
+ }
1596
+ if ((tag & 7) === 4 || tag === 0) {
1597
+ break;
1598
+ }
1599
+ reader.skip(tag & 7);
1600
+ }
1601
+ return message;
1602
+ },
1603
+ fromJSON(object) {
1604
+ return {
1605
+ threadId: isSet(object.threadId)
1606
+ ? globalThis.String(object.threadId)
1607
+ : isSet(object.thread_id)
1608
+ ? globalThis.String(object.thread_id)
1609
+ : "",
1610
+ text: isSet(object.text) ? globalThis.String(object.text) : "",
1611
+ score: isSet(object.score) ? globalThis.Number(object.score) : 0,
1612
+ classification: isSet(object.classification) ? (0, ingestion_pb_1.threadClassificationFromJSON)(object.classification) : 0,
1613
+ sourceLocation: isSet(object.sourceLocation)
1614
+ ? ingestion_pb_1.SourceLocation.fromJSON(object.sourceLocation)
1615
+ : isSet(object.source_location)
1616
+ ? ingestion_pb_1.SourceLocation.fromJSON(object.source_location)
1617
+ : undefined,
1618
+ };
1619
+ },
1620
+ toJSON(message) {
1621
+ const obj = {};
1622
+ if (message.threadId !== "") {
1623
+ obj.threadId = message.threadId;
1624
+ }
1625
+ if (message.text !== "") {
1626
+ obj.text = message.text;
1627
+ }
1628
+ if (message.score !== 0) {
1629
+ obj.score = message.score;
1630
+ }
1631
+ if (message.classification !== 0) {
1632
+ obj.classification = (0, ingestion_pb_1.threadClassificationToJSON)(message.classification);
1633
+ }
1634
+ if (message.sourceLocation !== undefined) {
1635
+ obj.sourceLocation = ingestion_pb_1.SourceLocation.toJSON(message.sourceLocation);
1636
+ }
1637
+ return obj;
1638
+ },
1639
+ create(base) {
1640
+ return exports.DocumentSearchSnippet.fromPartial(base !== null && base !== void 0 ? base : {});
1641
+ },
1642
+ fromPartial(object) {
1643
+ var _a, _b, _c, _d;
1644
+ const message = createBaseDocumentSearchSnippet();
1645
+ message.threadId = (_a = object.threadId) !== null && _a !== void 0 ? _a : "";
1646
+ message.text = (_b = object.text) !== null && _b !== void 0 ? _b : "";
1647
+ message.score = (_c = object.score) !== null && _c !== void 0 ? _c : 0;
1648
+ message.classification = (_d = object.classification) !== null && _d !== void 0 ? _d : 0;
1649
+ message.sourceLocation = (object.sourceLocation !== undefined && object.sourceLocation !== null)
1650
+ ? ingestion_pb_1.SourceLocation.fromPartial(object.sourceLocation)
1651
+ : undefined;
1652
+ return message;
1653
+ },
1654
+ };
1655
+ function createBaseRetrievedDocument() {
1656
+ return {
1657
+ documentId: "",
1658
+ documentName: "",
1659
+ mimeType: "",
1660
+ scope: 0,
1661
+ tags: [],
1662
+ sensitivityTags: [],
1663
+ score: 0,
1664
+ matchedThreadCount: 0,
1665
+ snippets: [],
1666
+ uploadedAt: undefined,
1667
+ };
1668
+ }
1669
+ exports.RetrievedDocument = {
1670
+ encode(message, writer = new wire_1.BinaryWriter()) {
1671
+ if (message.documentId !== "") {
1672
+ writer.uint32(10).string(message.documentId);
1673
+ }
1674
+ if (message.documentName !== "") {
1675
+ writer.uint32(18).string(message.documentName);
1676
+ }
1677
+ if (message.mimeType !== "") {
1678
+ writer.uint32(26).string(message.mimeType);
1679
+ }
1680
+ if (message.scope !== 0) {
1681
+ writer.uint32(32).int32(message.scope);
1682
+ }
1683
+ for (const v of message.tags) {
1684
+ ingestion_pb_1.DocumentTag.encode(v, writer.uint32(42).fork()).join();
1685
+ }
1686
+ for (const v of message.sensitivityTags) {
1687
+ writer.uint32(50).string(v);
1688
+ }
1689
+ if (message.score !== 0) {
1690
+ writer.uint32(61).float(message.score);
1691
+ }
1692
+ if (message.matchedThreadCount !== 0) {
1693
+ writer.uint32(64).int32(message.matchedThreadCount);
1694
+ }
1695
+ for (const v of message.snippets) {
1696
+ exports.DocumentSearchSnippet.encode(v, writer.uint32(74).fork()).join();
1697
+ }
1698
+ if (message.uploadedAt !== undefined) {
1699
+ timestamp_pb_1.Timestamp.encode(toTimestamp(message.uploadedAt), writer.uint32(82).fork()).join();
1700
+ }
1701
+ return writer;
1702
+ },
1703
+ decode(input, length) {
1704
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
1705
+ const end = length === undefined ? reader.len : reader.pos + length;
1706
+ const message = createBaseRetrievedDocument();
1707
+ while (reader.pos < end) {
1708
+ const tag = reader.uint32();
1709
+ switch (tag >>> 3) {
1710
+ case 1: {
1711
+ if (tag !== 10) {
1712
+ break;
1713
+ }
1714
+ message.documentId = reader.string();
1715
+ continue;
1716
+ }
1717
+ case 2: {
1718
+ if (tag !== 18) {
1719
+ break;
1720
+ }
1721
+ message.documentName = reader.string();
1722
+ continue;
1723
+ }
1724
+ case 3: {
1725
+ if (tag !== 26) {
1726
+ break;
1727
+ }
1728
+ message.mimeType = reader.string();
1729
+ continue;
1730
+ }
1731
+ case 4: {
1732
+ if (tag !== 32) {
1733
+ break;
1734
+ }
1735
+ message.scope = reader.int32();
1736
+ continue;
1737
+ }
1738
+ case 5: {
1739
+ if (tag !== 42) {
1740
+ break;
1741
+ }
1742
+ message.tags.push(ingestion_pb_1.DocumentTag.decode(reader, reader.uint32()));
1743
+ continue;
1744
+ }
1745
+ case 6: {
1746
+ if (tag !== 50) {
1747
+ break;
1748
+ }
1749
+ message.sensitivityTags.push(reader.string());
1750
+ continue;
1751
+ }
1752
+ case 7: {
1753
+ if (tag !== 61) {
1754
+ break;
1755
+ }
1756
+ message.score = reader.float();
1757
+ continue;
1758
+ }
1759
+ case 8: {
1760
+ if (tag !== 64) {
1761
+ break;
1762
+ }
1763
+ message.matchedThreadCount = reader.int32();
1764
+ continue;
1765
+ }
1766
+ case 9: {
1767
+ if (tag !== 74) {
1768
+ break;
1769
+ }
1770
+ message.snippets.push(exports.DocumentSearchSnippet.decode(reader, reader.uint32()));
1771
+ continue;
1772
+ }
1773
+ case 10: {
1774
+ if (tag !== 82) {
1775
+ break;
1776
+ }
1777
+ message.uploadedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
1778
+ continue;
1779
+ }
1780
+ }
1781
+ if ((tag & 7) === 4 || tag === 0) {
1782
+ break;
1783
+ }
1784
+ reader.skip(tag & 7);
1785
+ }
1786
+ return message;
1787
+ },
1788
+ fromJSON(object) {
1789
+ return {
1790
+ documentId: isSet(object.documentId)
1791
+ ? globalThis.String(object.documentId)
1792
+ : isSet(object.document_id)
1793
+ ? globalThis.String(object.document_id)
1794
+ : "",
1795
+ documentName: isSet(object.documentName)
1796
+ ? globalThis.String(object.documentName)
1797
+ : isSet(object.document_name)
1798
+ ? globalThis.String(object.document_name)
1799
+ : "",
1800
+ mimeType: isSet(object.mimeType)
1801
+ ? globalThis.String(object.mimeType)
1802
+ : isSet(object.mime_type)
1803
+ ? globalThis.String(object.mime_type)
1804
+ : "",
1805
+ scope: isSet(object.scope) ? (0, ingestion_pb_1.documentScopeFromJSON)(object.scope) : 0,
1806
+ tags: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.tags) ? object.tags.map((e) => ingestion_pb_1.DocumentTag.fromJSON(e)) : [],
1807
+ sensitivityTags: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sensitivityTags)
1808
+ ? object.sensitivityTags.map((e) => globalThis.String(e))
1809
+ : globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sensitivity_tags)
1810
+ ? object.sensitivity_tags.map((e) => globalThis.String(e))
1811
+ : [],
1812
+ score: isSet(object.score) ? globalThis.Number(object.score) : 0,
1813
+ matchedThreadCount: isSet(object.matchedThreadCount)
1814
+ ? globalThis.Number(object.matchedThreadCount)
1815
+ : isSet(object.matched_thread_count)
1816
+ ? globalThis.Number(object.matched_thread_count)
1817
+ : 0,
1818
+ snippets: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.snippets)
1819
+ ? object.snippets.map((e) => exports.DocumentSearchSnippet.fromJSON(e))
1820
+ : [],
1821
+ uploadedAt: isSet(object.uploadedAt)
1822
+ ? fromJsonTimestamp(object.uploadedAt)
1823
+ : isSet(object.uploaded_at)
1824
+ ? fromJsonTimestamp(object.uploaded_at)
1825
+ : undefined,
1826
+ };
1827
+ },
1828
+ toJSON(message) {
1829
+ var _a, _b, _c;
1830
+ const obj = {};
1831
+ if (message.documentId !== "") {
1832
+ obj.documentId = message.documentId;
1833
+ }
1834
+ if (message.documentName !== "") {
1835
+ obj.documentName = message.documentName;
1836
+ }
1837
+ if (message.mimeType !== "") {
1838
+ obj.mimeType = message.mimeType;
1839
+ }
1840
+ if (message.scope !== 0) {
1841
+ obj.scope = (0, ingestion_pb_1.documentScopeToJSON)(message.scope);
1842
+ }
1843
+ if ((_a = message.tags) === null || _a === void 0 ? void 0 : _a.length) {
1844
+ obj.tags = message.tags.map((e) => ingestion_pb_1.DocumentTag.toJSON(e));
1845
+ }
1846
+ if ((_b = message.sensitivityTags) === null || _b === void 0 ? void 0 : _b.length) {
1847
+ obj.sensitivityTags = message.sensitivityTags;
1848
+ }
1849
+ if (message.score !== 0) {
1850
+ obj.score = message.score;
1851
+ }
1852
+ if (message.matchedThreadCount !== 0) {
1853
+ obj.matchedThreadCount = Math.round(message.matchedThreadCount);
1854
+ }
1855
+ if ((_c = message.snippets) === null || _c === void 0 ? void 0 : _c.length) {
1856
+ obj.snippets = message.snippets.map((e) => exports.DocumentSearchSnippet.toJSON(e));
1857
+ }
1858
+ if (message.uploadedAt !== undefined) {
1859
+ obj.uploadedAt = message.uploadedAt.toISOString();
1860
+ }
1861
+ return obj;
1862
+ },
1863
+ create(base) {
1864
+ return exports.RetrievedDocument.fromPartial(base !== null && base !== void 0 ? base : {});
1865
+ },
1866
+ fromPartial(object) {
1867
+ var _a, _b, _c;
1868
+ var _d, _e, _f, _g, _h, _j, _k;
1869
+ const message = createBaseRetrievedDocument();
1870
+ message.documentId = (_d = object.documentId) !== null && _d !== void 0 ? _d : "";
1871
+ message.documentName = (_e = object.documentName) !== null && _e !== void 0 ? _e : "";
1872
+ message.mimeType = (_f = object.mimeType) !== null && _f !== void 0 ? _f : "";
1873
+ message.scope = (_g = object.scope) !== null && _g !== void 0 ? _g : 0;
1874
+ message.tags = ((_a = object.tags) === null || _a === void 0 ? void 0 : _a.map((e) => ingestion_pb_1.DocumentTag.fromPartial(e))) || [];
1875
+ message.sensitivityTags = ((_b = object.sensitivityTags) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
1876
+ message.score = (_h = object.score) !== null && _h !== void 0 ? _h : 0;
1877
+ message.matchedThreadCount = (_j = object.matchedThreadCount) !== null && _j !== void 0 ? _j : 0;
1878
+ message.snippets = ((_c = object.snippets) === null || _c === void 0 ? void 0 : _c.map((e) => exports.DocumentSearchSnippet.fromPartial(e))) || [];
1879
+ message.uploadedAt = (_k = object.uploadedAt) !== null && _k !== void 0 ? _k : undefined;
1880
+ return message;
1881
+ },
1882
+ };
1394
1883
  function createBaseRetrieveRequest() {
1395
1884
  return { organizationId: "", query: "", constraints: undefined, sessionId: "" };
1396
1885
  }
@@ -1574,6 +2063,245 @@ exports.RetrieveResponse = {
1574
2063
  return message;
1575
2064
  },
1576
2065
  };
2066
+ function createBaseSearchDocumentsRequest() {
2067
+ return { organizationId: "", query: "", constraints: undefined, filters: undefined, pageSize: 0, pageToken: "" };
2068
+ }
2069
+ exports.SearchDocumentsRequest = {
2070
+ encode(message, writer = new wire_1.BinaryWriter()) {
2071
+ if (message.organizationId !== "") {
2072
+ writer.uint32(10).string(message.organizationId);
2073
+ }
2074
+ if (message.query !== "") {
2075
+ writer.uint32(18).string(message.query);
2076
+ }
2077
+ if (message.constraints !== undefined) {
2078
+ exports.RetrievalConstraints.encode(message.constraints, writer.uint32(26).fork()).join();
2079
+ }
2080
+ if (message.filters !== undefined) {
2081
+ exports.DocumentSearchFilters.encode(message.filters, writer.uint32(34).fork()).join();
2082
+ }
2083
+ if (message.pageSize !== 0) {
2084
+ writer.uint32(40).int32(message.pageSize);
2085
+ }
2086
+ if (message.pageToken !== "") {
2087
+ writer.uint32(50).string(message.pageToken);
2088
+ }
2089
+ return writer;
2090
+ },
2091
+ decode(input, length) {
2092
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2093
+ const end = length === undefined ? reader.len : reader.pos + length;
2094
+ const message = createBaseSearchDocumentsRequest();
2095
+ while (reader.pos < end) {
2096
+ const tag = reader.uint32();
2097
+ switch (tag >>> 3) {
2098
+ case 1: {
2099
+ if (tag !== 10) {
2100
+ break;
2101
+ }
2102
+ message.organizationId = reader.string();
2103
+ continue;
2104
+ }
2105
+ case 2: {
2106
+ if (tag !== 18) {
2107
+ break;
2108
+ }
2109
+ message.query = reader.string();
2110
+ continue;
2111
+ }
2112
+ case 3: {
2113
+ if (tag !== 26) {
2114
+ break;
2115
+ }
2116
+ message.constraints = exports.RetrievalConstraints.decode(reader, reader.uint32());
2117
+ continue;
2118
+ }
2119
+ case 4: {
2120
+ if (tag !== 34) {
2121
+ break;
2122
+ }
2123
+ message.filters = exports.DocumentSearchFilters.decode(reader, reader.uint32());
2124
+ continue;
2125
+ }
2126
+ case 5: {
2127
+ if (tag !== 40) {
2128
+ break;
2129
+ }
2130
+ message.pageSize = reader.int32();
2131
+ continue;
2132
+ }
2133
+ case 6: {
2134
+ if (tag !== 50) {
2135
+ break;
2136
+ }
2137
+ message.pageToken = reader.string();
2138
+ continue;
2139
+ }
2140
+ }
2141
+ if ((tag & 7) === 4 || tag === 0) {
2142
+ break;
2143
+ }
2144
+ reader.skip(tag & 7);
2145
+ }
2146
+ return message;
2147
+ },
2148
+ fromJSON(object) {
2149
+ return {
2150
+ organizationId: isSet(object.organizationId)
2151
+ ? globalThis.String(object.organizationId)
2152
+ : isSet(object.organization_id)
2153
+ ? globalThis.String(object.organization_id)
2154
+ : "",
2155
+ query: isSet(object.query) ? globalThis.String(object.query) : "",
2156
+ constraints: isSet(object.constraints) ? exports.RetrievalConstraints.fromJSON(object.constraints) : undefined,
2157
+ filters: isSet(object.filters) ? exports.DocumentSearchFilters.fromJSON(object.filters) : undefined,
2158
+ pageSize: isSet(object.pageSize)
2159
+ ? globalThis.Number(object.pageSize)
2160
+ : isSet(object.page_size)
2161
+ ? globalThis.Number(object.page_size)
2162
+ : 0,
2163
+ pageToken: isSet(object.pageToken)
2164
+ ? globalThis.String(object.pageToken)
2165
+ : isSet(object.page_token)
2166
+ ? globalThis.String(object.page_token)
2167
+ : "",
2168
+ };
2169
+ },
2170
+ toJSON(message) {
2171
+ const obj = {};
2172
+ if (message.organizationId !== "") {
2173
+ obj.organizationId = message.organizationId;
2174
+ }
2175
+ if (message.query !== "") {
2176
+ obj.query = message.query;
2177
+ }
2178
+ if (message.constraints !== undefined) {
2179
+ obj.constraints = exports.RetrievalConstraints.toJSON(message.constraints);
2180
+ }
2181
+ if (message.filters !== undefined) {
2182
+ obj.filters = exports.DocumentSearchFilters.toJSON(message.filters);
2183
+ }
2184
+ if (message.pageSize !== 0) {
2185
+ obj.pageSize = Math.round(message.pageSize);
2186
+ }
2187
+ if (message.pageToken !== "") {
2188
+ obj.pageToken = message.pageToken;
2189
+ }
2190
+ return obj;
2191
+ },
2192
+ create(base) {
2193
+ return exports.SearchDocumentsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
2194
+ },
2195
+ fromPartial(object) {
2196
+ var _a, _b, _c, _d;
2197
+ const message = createBaseSearchDocumentsRequest();
2198
+ message.organizationId = (_a = object.organizationId) !== null && _a !== void 0 ? _a : "";
2199
+ message.query = (_b = object.query) !== null && _b !== void 0 ? _b : "";
2200
+ message.constraints = (object.constraints !== undefined && object.constraints !== null)
2201
+ ? exports.RetrievalConstraints.fromPartial(object.constraints)
2202
+ : undefined;
2203
+ message.filters = (object.filters !== undefined && object.filters !== null)
2204
+ ? exports.DocumentSearchFilters.fromPartial(object.filters)
2205
+ : undefined;
2206
+ message.pageSize = (_c = object.pageSize) !== null && _c !== void 0 ? _c : 0;
2207
+ message.pageToken = (_d = object.pageToken) !== null && _d !== void 0 ? _d : "";
2208
+ return message;
2209
+ },
2210
+ };
2211
+ function createBaseSearchDocumentsResponse() {
2212
+ return { documents: [], plan: undefined, nextPageToken: "" };
2213
+ }
2214
+ exports.SearchDocumentsResponse = {
2215
+ encode(message, writer = new wire_1.BinaryWriter()) {
2216
+ for (const v of message.documents) {
2217
+ exports.RetrievedDocument.encode(v, writer.uint32(10).fork()).join();
2218
+ }
2219
+ if (message.plan !== undefined) {
2220
+ exports.RetrievalPlan.encode(message.plan, writer.uint32(18).fork()).join();
2221
+ }
2222
+ if (message.nextPageToken !== "") {
2223
+ writer.uint32(26).string(message.nextPageToken);
2224
+ }
2225
+ return writer;
2226
+ },
2227
+ decode(input, length) {
2228
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
2229
+ const end = length === undefined ? reader.len : reader.pos + length;
2230
+ const message = createBaseSearchDocumentsResponse();
2231
+ while (reader.pos < end) {
2232
+ const tag = reader.uint32();
2233
+ switch (tag >>> 3) {
2234
+ case 1: {
2235
+ if (tag !== 10) {
2236
+ break;
2237
+ }
2238
+ message.documents.push(exports.RetrievedDocument.decode(reader, reader.uint32()));
2239
+ continue;
2240
+ }
2241
+ case 2: {
2242
+ if (tag !== 18) {
2243
+ break;
2244
+ }
2245
+ message.plan = exports.RetrievalPlan.decode(reader, reader.uint32());
2246
+ continue;
2247
+ }
2248
+ case 3: {
2249
+ if (tag !== 26) {
2250
+ break;
2251
+ }
2252
+ message.nextPageToken = reader.string();
2253
+ continue;
2254
+ }
2255
+ }
2256
+ if ((tag & 7) === 4 || tag === 0) {
2257
+ break;
2258
+ }
2259
+ reader.skip(tag & 7);
2260
+ }
2261
+ return message;
2262
+ },
2263
+ fromJSON(object) {
2264
+ return {
2265
+ documents: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.documents)
2266
+ ? object.documents.map((e) => exports.RetrievedDocument.fromJSON(e))
2267
+ : [],
2268
+ plan: isSet(object.plan) ? exports.RetrievalPlan.fromJSON(object.plan) : undefined,
2269
+ nextPageToken: isSet(object.nextPageToken)
2270
+ ? globalThis.String(object.nextPageToken)
2271
+ : isSet(object.next_page_token)
2272
+ ? globalThis.String(object.next_page_token)
2273
+ : "",
2274
+ };
2275
+ },
2276
+ toJSON(message) {
2277
+ var _a;
2278
+ const obj = {};
2279
+ if ((_a = message.documents) === null || _a === void 0 ? void 0 : _a.length) {
2280
+ obj.documents = message.documents.map((e) => exports.RetrievedDocument.toJSON(e));
2281
+ }
2282
+ if (message.plan !== undefined) {
2283
+ obj.plan = exports.RetrievalPlan.toJSON(message.plan);
2284
+ }
2285
+ if (message.nextPageToken !== "") {
2286
+ obj.nextPageToken = message.nextPageToken;
2287
+ }
2288
+ return obj;
2289
+ },
2290
+ create(base) {
2291
+ return exports.SearchDocumentsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
2292
+ },
2293
+ fromPartial(object) {
2294
+ var _a;
2295
+ var _b;
2296
+ const message = createBaseSearchDocumentsResponse();
2297
+ message.documents = ((_a = object.documents) === null || _a === void 0 ? void 0 : _a.map((e) => exports.RetrievedDocument.fromPartial(e))) || [];
2298
+ message.plan = (object.plan !== undefined && object.plan !== null)
2299
+ ? exports.RetrievalPlan.fromPartial(object.plan)
2300
+ : undefined;
2301
+ message.nextPageToken = (_b = object.nextPageToken) !== null && _b !== void 0 ? _b : "";
2302
+ return message;
2303
+ },
2304
+ };
1577
2305
  function createBaseExplainRetrievalRequest() {
1578
2306
  return { organizationId: "", query: "", constraints: undefined, sessionId: "" };
1579
2307
  }