@aws-sdk/client-bedrock-agent-runtime 3.542.0 → 3.543.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.
@@ -1,4 +1,5 @@
1
1
  import { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client";
2
+ import { DocumentType as __DocumentType } from "@smithy/types";
2
3
  import { BedrockAgentRuntimeServiceException as __BaseException } from "./BedrockAgentRuntimeServiceException";
3
4
  /**
4
5
  * <p>The request is denied because of missing access permissions. Check your permissions and retry your request.</p>
@@ -396,6 +397,11 @@ export interface RetrievedReference {
396
397
  * @public
397
398
  */
398
399
  location?: RetrievalResultLocation;
400
+ /**
401
+ * <p>Contains metadata attributes and their values for the file in the data source. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-ds.html#kb-ds-metadata">Metadata and filtering</a>.</p>
402
+ * @public
403
+ */
404
+ metadata?: Record<string, __DocumentType>;
399
405
  }
400
406
  /**
401
407
  * <p>An object containing a segment of the generated response that is based on a source in the knowledge base, alongside information about the source.</p>
@@ -1449,8 +1455,7 @@ export interface RetrieveAndGenerateInput {
1449
1455
  * <ul>
1450
1456
  * <li>
1451
1457
  * <p>
1452
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a>
1453
- * </p>
1458
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>filter</code> field</p>
1454
1459
  * </li>
1455
1460
  * </ul>
1456
1461
  * @public
@@ -1494,6 +1499,30 @@ export interface GenerationConfiguration {
1494
1499
  */
1495
1500
  promptTemplate?: PromptTemplate;
1496
1501
  }
1502
+ /**
1503
+ * <p>Specifies the name that the metadata attribute must match and the value to which to compare the value of the metadata attribute. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1504
+ * <p>This data type is used in the following API operations:</p>
1505
+ * <ul>
1506
+ * <li>
1507
+ * <p>
1508
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a>
1509
+ * </p>
1510
+ * </li>
1511
+ * </ul>
1512
+ * @public
1513
+ */
1514
+ export interface FilterAttribute {
1515
+ /**
1516
+ * <p>The name that the metadata attribute must match.</p>
1517
+ * @public
1518
+ */
1519
+ key: string | undefined;
1520
+ /**
1521
+ * <p>The value to whcih to compare the value of the metadata attribute.</p>
1522
+ * @public
1523
+ */
1524
+ value: __DocumentType | undefined;
1525
+ }
1497
1526
  /**
1498
1527
  * @public
1499
1528
  * @enum
@@ -1507,223 +1536,479 @@ export declare const SearchType: {
1507
1536
  */
1508
1537
  export type SearchType = (typeof SearchType)[keyof typeof SearchType];
1509
1538
  /**
1510
- * <p>Configurations for how to perform the search query and return results. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1539
+ * @public
1540
+ * @enum
1541
+ */
1542
+ export declare const RetrieveAndGenerateType: {
1543
+ readonly KNOWLEDGE_BASE: "KNOWLEDGE_BASE";
1544
+ };
1545
+ /**
1546
+ * @public
1547
+ */
1548
+ export type RetrieveAndGenerateType = (typeof RetrieveAndGenerateType)[keyof typeof RetrieveAndGenerateType];
1549
+ /**
1550
+ * <p>Contains configuration about the session with the knowledge base.</p>
1511
1551
  * <p>This data type is used in the following API operations:</p>
1512
1552
  * <ul>
1513
1553
  * <li>
1514
1554
  * <p>
1515
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>vectorSearchConfiguration</code> field</p>
1555
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>sessionConfiguration</code> field</p>
1516
1556
  * </li>
1557
+ * </ul>
1558
+ * @public
1559
+ */
1560
+ export interface RetrieveAndGenerateSessionConfiguration {
1561
+ /**
1562
+ * <p>The ARN of the KMS key encrypting the session.</p>
1563
+ * @public
1564
+ */
1565
+ kmsKeyArn: string | undefined;
1566
+ }
1567
+ /**
1568
+ * <p>Contains the response generated from querying the knowledge base.</p>
1569
+ * <p>This data type is used in the following API operations:</p>
1570
+ * <ul>
1517
1571
  * <li>
1518
1572
  * <p>
1519
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>vectorSearchConfiguration</code> field</p>
1573
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax">RetrieveAndGenerate response</a> – in the <code>output</code> field</p>
1520
1574
  * </li>
1521
1575
  * </ul>
1522
1576
  * @public
1523
1577
  */
1524
- export interface KnowledgeBaseVectorSearchConfiguration {
1578
+ export interface RetrieveAndGenerateOutput {
1525
1579
  /**
1526
- * <p>The number of source chunks to retrieve.</p>
1580
+ * <p>The response generated from querying the knowledge base.</p>
1527
1581
  * @public
1528
1582
  */
1529
- numberOfResults?: number;
1583
+ text: string | undefined;
1584
+ }
1585
+ /**
1586
+ * @public
1587
+ */
1588
+ export interface RetrieveAndGenerateResponse {
1530
1589
  /**
1531
- * <p>By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a <code>HYBRID</code> search using both vector embeddings and raw text, or <code>SEMANTIC</code> search using only vector embeddings. For other vector store configurations, only <code>SEMANTIC</code> search is available. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-test.html">Test a knowledge base</a>.</p>
1590
+ * <p>The unique identifier of the session. Reuse the same value to continue the same session with the knowledge base.</p>
1532
1591
  * @public
1533
1592
  */
1534
- overrideSearchType?: SearchType;
1593
+ sessionId: string | undefined;
1594
+ /**
1595
+ * <p>Contains the response generated from querying the knowledge base.</p>
1596
+ * @public
1597
+ */
1598
+ output: RetrieveAndGenerateOutput | undefined;
1599
+ /**
1600
+ * <p>A list of segments of the generated response that are based on sources in the knowledge base, alongside information about the sources.</p>
1601
+ * @public
1602
+ */
1603
+ citations?: Citation[];
1535
1604
  }
1536
1605
  /**
1537
- * <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1606
+ * <p>Contains the query made to the knowledge base.</p>
1538
1607
  * <p>This data type is used in the following API operations:</p>
1539
1608
  * <ul>
1540
1609
  * <li>
1541
1610
  * <p>
1542
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>retrievalConfiguration</code> field</p>
1543
- * </li>
1544
- * <li>
1545
- * <p>
1546
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>retrievalConfiguration</code> field</p>
1611
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>retrievalQuery</code> field</p>
1547
1612
  * </li>
1548
1613
  * </ul>
1549
1614
  * @public
1550
1615
  */
1551
- export interface KnowledgeBaseRetrievalConfiguration {
1616
+ export interface KnowledgeBaseQuery {
1552
1617
  /**
1553
- * <p>Contains details about how the results from the vector search should be returned. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1618
+ * <p>The text of the query made to the knowledge base.</p>
1554
1619
  * @public
1555
1620
  */
1556
- vectorSearchConfiguration: KnowledgeBaseVectorSearchConfiguration | undefined;
1621
+ text: string | undefined;
1557
1622
  }
1558
1623
  /**
1559
- * <p>Contains details about the resource being queried.</p>
1624
+ * <p>Details about a result from querying the knowledge base.</p>
1560
1625
  * <p>This data type is used in the following API operations:</p>
1561
1626
  * <ul>
1562
1627
  * <li>
1563
1628
  * <p>
1564
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>knowledgeBaseConfiguration</code> field</p>
1565
- * </li>
1566
- * <li>
1567
- * <p>
1568
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>knowledgeBaseConfiguration</code> field</p>
1629
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>retrievalResults</code> field</p>
1569
1630
  * </li>
1570
1631
  * </ul>
1571
1632
  * @public
1572
1633
  */
1573
- export interface KnowledgeBaseRetrieveAndGenerateConfiguration {
1634
+ export interface KnowledgeBaseRetrievalResult {
1574
1635
  /**
1575
- * <p>The unique identifier of the knowledge base that is queried and the foundation model used for generation.</p>
1636
+ * <p>Contains a chunk of text from a data source in the knowledge base.</p>
1576
1637
  * @public
1577
1638
  */
1578
- knowledgeBaseId: string | undefined;
1639
+ content: RetrievalResultContent | undefined;
1579
1640
  /**
1580
- * <p>The ARN of the foundation model used to generate a response.</p>
1641
+ * <p>Contains information about the location of the data source.</p>
1581
1642
  * @public
1582
1643
  */
1583
- modelArn: string | undefined;
1644
+ location?: RetrievalResultLocation;
1584
1645
  /**
1585
- * <p>Contains configurations for how to retrieve and return the knowledge base query.</p>
1646
+ * <p>The level of relevance of the result to the query.</p>
1586
1647
  * @public
1587
1648
  */
1588
- retrievalConfiguration?: KnowledgeBaseRetrievalConfiguration;
1649
+ score?: number;
1589
1650
  /**
1590
- * <p>Contains configurations for response generation based on the knowwledge base query results.</p>
1651
+ * <p>Contains metadata attributes and their values for the file in the data source. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-ds.html#kb-ds-metadata">Metadata and filtering</a>.</p>
1591
1652
  * @public
1592
1653
  */
1593
- generationConfiguration?: GenerationConfiguration;
1654
+ metadata?: Record<string, __DocumentType>;
1594
1655
  }
1595
1656
  /**
1596
1657
  * @public
1597
- * @enum
1598
1658
  */
1599
- export declare const RetrieveAndGenerateType: {
1600
- readonly KNOWLEDGE_BASE: "KNOWLEDGE_BASE";
1601
- };
1602
- /**
1603
- * @public
1604
- */
1605
- export type RetrieveAndGenerateType = (typeof RetrieveAndGenerateType)[keyof typeof RetrieveAndGenerateType];
1659
+ export interface RetrieveResponse {
1660
+ /**
1661
+ * <p>A list of results from querying the knowledge base.</p>
1662
+ * @public
1663
+ */
1664
+ retrievalResults: KnowledgeBaseRetrievalResult[] | undefined;
1665
+ /**
1666
+ * <p>If there are more results than can fit in the response, the response returns a <code>nextToken</code>. Use this token in the <code>nextToken</code> field of another request to retrieve the next batch of results.</p>
1667
+ * @public
1668
+ */
1669
+ nextToken?: string;
1670
+ }
1606
1671
  /**
1607
- * <p>Contains details about the resource being queried.</p>
1672
+ * <p>Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1608
1673
  * <p>This data type is used in the following API operations:</p>
1609
1674
  * <ul>
1610
1675
  * <li>
1611
1676
  * <p>
1612
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>retrieveAndGenerateConfiguration</code> field</p>
1677
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>filter</code> field</p>
1678
+ * </li>
1679
+ * <li>
1680
+ * <p>
1681
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>filter</code> field</p>
1613
1682
  * </li>
1614
1683
  * </ul>
1615
1684
  * @public
1616
1685
  */
1617
- export interface RetrieveAndGenerateConfiguration {
1686
+ export type RetrievalFilter = RetrievalFilter.AndAllMember | RetrievalFilter.EqualsMember | RetrievalFilter.GreaterThanMember | RetrievalFilter.GreaterThanOrEqualsMember | RetrievalFilter.InMember | RetrievalFilter.LessThanMember | RetrievalFilter.LessThanOrEqualsMember | RetrievalFilter.NotEqualsMember | RetrievalFilter.NotInMember | RetrievalFilter.OrAllMember | RetrievalFilter.StartsWithMember | RetrievalFilter.$UnknownMember;
1687
+ /**
1688
+ * @public
1689
+ */
1690
+ export declare namespace RetrievalFilter {
1618
1691
  /**
1619
- * <p>The type of resource that is queried by the request.</p>
1692
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value matches the <code>value</code> in this object are returned.</p>
1620
1693
  * @public
1621
1694
  */
1622
- type: RetrieveAndGenerateType | undefined;
1695
+ interface EqualsMember {
1696
+ equals: FilterAttribute;
1697
+ notEquals?: never;
1698
+ greaterThan?: never;
1699
+ greaterThanOrEquals?: never;
1700
+ lessThan?: never;
1701
+ lessThanOrEquals?: never;
1702
+ in?: never;
1703
+ notIn?: never;
1704
+ startsWith?: never;
1705
+ andAll?: never;
1706
+ orAll?: never;
1707
+ $unknown?: never;
1708
+ }
1709
+ /**
1710
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value doesn't match the <code>value</code> in this object are returned.</p>
1711
+ * @public
1712
+ */
1713
+ interface NotEqualsMember {
1714
+ equals?: never;
1715
+ notEquals: FilterAttribute;
1716
+ greaterThan?: never;
1717
+ greaterThanOrEquals?: never;
1718
+ lessThan?: never;
1719
+ lessThanOrEquals?: never;
1720
+ in?: never;
1721
+ notIn?: never;
1722
+ startsWith?: never;
1723
+ andAll?: never;
1724
+ orAll?: never;
1725
+ $unknown?: never;
1726
+ }
1727
+ /**
1728
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than the <code>value</code> in this object are returned.</p>
1729
+ * @public
1730
+ */
1731
+ interface GreaterThanMember {
1732
+ equals?: never;
1733
+ notEquals?: never;
1734
+ greaterThan: FilterAttribute;
1735
+ greaterThanOrEquals?: never;
1736
+ lessThan?: never;
1737
+ lessThanOrEquals?: never;
1738
+ in?: never;
1739
+ notIn?: never;
1740
+ startsWith?: never;
1741
+ andAll?: never;
1742
+ orAll?: never;
1743
+ $unknown?: never;
1744
+ }
1745
+ /**
1746
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than or equal to the <code>value</code> in this object are returned.</p>
1747
+ * @public
1748
+ */
1749
+ interface GreaterThanOrEqualsMember {
1750
+ equals?: never;
1751
+ notEquals?: never;
1752
+ greaterThan?: never;
1753
+ greaterThanOrEquals: FilterAttribute;
1754
+ lessThan?: never;
1755
+ lessThanOrEquals?: never;
1756
+ in?: never;
1757
+ notIn?: never;
1758
+ startsWith?: never;
1759
+ andAll?: never;
1760
+ orAll?: never;
1761
+ $unknown?: never;
1762
+ }
1763
+ /**
1764
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is less than the <code>value</code> in this object are returned.</p>
1765
+ * @public
1766
+ */
1767
+ interface LessThanMember {
1768
+ equals?: never;
1769
+ notEquals?: never;
1770
+ greaterThan?: never;
1771
+ greaterThanOrEquals?: never;
1772
+ lessThan: FilterAttribute;
1773
+ lessThanOrEquals?: never;
1774
+ in?: never;
1775
+ notIn?: never;
1776
+ startsWith?: never;
1777
+ andAll?: never;
1778
+ orAll?: never;
1779
+ $unknown?: never;
1780
+ }
1781
+ /**
1782
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is less than or equal to the <code>value</code> in this object are returned.</p>
1783
+ * @public
1784
+ */
1785
+ interface LessThanOrEqualsMember {
1786
+ equals?: never;
1787
+ notEquals?: never;
1788
+ greaterThan?: never;
1789
+ greaterThanOrEquals?: never;
1790
+ lessThan?: never;
1791
+ lessThanOrEquals: FilterAttribute;
1792
+ in?: never;
1793
+ notIn?: never;
1794
+ startsWith?: never;
1795
+ andAll?: never;
1796
+ orAll?: never;
1797
+ $unknown?: never;
1798
+ }
1799
+ /**
1800
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value is in the list specified in the <code>value</code> in this object are returned.</p>
1801
+ * @public
1802
+ */
1803
+ interface InMember {
1804
+ equals?: never;
1805
+ notEquals?: never;
1806
+ greaterThan?: never;
1807
+ greaterThanOrEquals?: never;
1808
+ lessThan?: never;
1809
+ lessThanOrEquals?: never;
1810
+ in: FilterAttribute;
1811
+ notIn?: never;
1812
+ startsWith?: never;
1813
+ andAll?: never;
1814
+ orAll?: never;
1815
+ $unknown?: never;
1816
+ }
1817
+ /**
1818
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value isn't in the list specified in the <code>value</code> in this object are returned.</p>
1819
+ * @public
1820
+ */
1821
+ interface NotInMember {
1822
+ equals?: never;
1823
+ notEquals?: never;
1824
+ greaterThan?: never;
1825
+ greaterThanOrEquals?: never;
1826
+ lessThan?: never;
1827
+ lessThanOrEquals?: never;
1828
+ in?: never;
1829
+ notIn: FilterAttribute;
1830
+ startsWith?: never;
1831
+ andAll?: never;
1832
+ orAll?: never;
1833
+ $unknown?: never;
1834
+ }
1835
+ /**
1836
+ * <p>Knowledge base data sources that contain a metadata attribute whose name matches the <code>key</code> and whose value starts with the <code>value</code> in this object are returned. This filter is currently only supported for Amazon OpenSearch Serverless vector stores.</p>
1837
+ * @public
1838
+ */
1839
+ interface StartsWithMember {
1840
+ equals?: never;
1841
+ notEquals?: never;
1842
+ greaterThan?: never;
1843
+ greaterThanOrEquals?: never;
1844
+ lessThan?: never;
1845
+ lessThanOrEquals?: never;
1846
+ in?: never;
1847
+ notIn?: never;
1848
+ startsWith: FilterAttribute;
1849
+ andAll?: never;
1850
+ orAll?: never;
1851
+ $unknown?: never;
1852
+ }
1853
+ /**
1854
+ * <p>Knowledge base data sources whose metadata attributes fulfill all the filter conditions inside this list are returned.</p>
1855
+ * @public
1856
+ */
1857
+ interface AndAllMember {
1858
+ equals?: never;
1859
+ notEquals?: never;
1860
+ greaterThan?: never;
1861
+ greaterThanOrEquals?: never;
1862
+ lessThan?: never;
1863
+ lessThanOrEquals?: never;
1864
+ in?: never;
1865
+ notIn?: never;
1866
+ startsWith?: never;
1867
+ andAll: RetrievalFilter[];
1868
+ orAll?: never;
1869
+ $unknown?: never;
1870
+ }
1871
+ /**
1872
+ * <p>Knowledge base data sources whose metadata attributes fulfill at least one of the filter conditions inside this list are returned.</p>
1873
+ * @public
1874
+ */
1875
+ interface OrAllMember {
1876
+ equals?: never;
1877
+ notEquals?: never;
1878
+ greaterThan?: never;
1879
+ greaterThanOrEquals?: never;
1880
+ lessThan?: never;
1881
+ lessThanOrEquals?: never;
1882
+ in?: never;
1883
+ notIn?: never;
1884
+ startsWith?: never;
1885
+ andAll?: never;
1886
+ orAll: RetrievalFilter[];
1887
+ $unknown?: never;
1888
+ }
1623
1889
  /**
1624
- * <p>Contains details about the resource being queried.</p>
1625
1890
  * @public
1626
1891
  */
1627
- knowledgeBaseConfiguration?: KnowledgeBaseRetrieveAndGenerateConfiguration;
1892
+ interface $UnknownMember {
1893
+ equals?: never;
1894
+ notEquals?: never;
1895
+ greaterThan?: never;
1896
+ greaterThanOrEquals?: never;
1897
+ lessThan?: never;
1898
+ lessThanOrEquals?: never;
1899
+ in?: never;
1900
+ notIn?: never;
1901
+ startsWith?: never;
1902
+ andAll?: never;
1903
+ orAll?: never;
1904
+ $unknown: [string, any];
1905
+ }
1906
+ interface Visitor<T> {
1907
+ equals: (value: FilterAttribute) => T;
1908
+ notEquals: (value: FilterAttribute) => T;
1909
+ greaterThan: (value: FilterAttribute) => T;
1910
+ greaterThanOrEquals: (value: FilterAttribute) => T;
1911
+ lessThan: (value: FilterAttribute) => T;
1912
+ lessThanOrEquals: (value: FilterAttribute) => T;
1913
+ in: (value: FilterAttribute) => T;
1914
+ notIn: (value: FilterAttribute) => T;
1915
+ startsWith: (value: FilterAttribute) => T;
1916
+ andAll: (value: RetrievalFilter[]) => T;
1917
+ orAll: (value: RetrievalFilter[]) => T;
1918
+ _: (name: string, value: any) => T;
1919
+ }
1920
+ const visit: <T>(value: RetrievalFilter, visitor: Visitor<T>) => T;
1628
1921
  }
1629
1922
  /**
1630
- * <p>Contains configuration about the session with the knowledge base.</p>
1923
+ * <p>Configurations for how to perform the search query and return results. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1631
1924
  * <p>This data type is used in the following API operations:</p>
1632
1925
  * <ul>
1633
1926
  * <li>
1634
1927
  * <p>
1635
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>sessionConfiguration</code> field</p>
1928
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>vectorSearchConfiguration</code> field</p>
1929
+ * </li>
1930
+ * <li>
1931
+ * <p>
1932
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>vectorSearchConfiguration</code> field</p>
1636
1933
  * </li>
1637
1934
  * </ul>
1638
1935
  * @public
1639
1936
  */
1640
- export interface RetrieveAndGenerateSessionConfiguration {
1641
- /**
1642
- * <p>The ARN of the KMS key encrypting the session.</p>
1643
- * @public
1644
- */
1645
- kmsKeyArn: string | undefined;
1646
- }
1647
- /**
1648
- * @public
1649
- */
1650
- export interface RetrieveAndGenerateRequest {
1651
- /**
1652
- * <p>The unique identifier of the session. Reuse the same value to continue the same session with the knowledge base.</p>
1653
- * @public
1654
- */
1655
- sessionId?: string;
1937
+ export interface KnowledgeBaseVectorSearchConfiguration {
1656
1938
  /**
1657
- * <p>Contains the query to be made to the knowledge base.</p>
1939
+ * <p>The number of source chunks to retrieve.</p>
1658
1940
  * @public
1659
1941
  */
1660
- input: RetrieveAndGenerateInput | undefined;
1942
+ numberOfResults?: number;
1661
1943
  /**
1662
- * <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1944
+ * <p>By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a <code>HYBRID</code> search using both vector embeddings and raw text, or <code>SEMANTIC</code> search using only vector embeddings. For other vector store configurations, only <code>SEMANTIC</code> search is available. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-test.html">Test a knowledge base</a>.</p>
1663
1945
  * @public
1664
1946
  */
1665
- retrieveAndGenerateConfiguration?: RetrieveAndGenerateConfiguration;
1947
+ overrideSearchType?: SearchType;
1666
1948
  /**
1667
- * <p>Contains details about the session with the knowledge base.</p>
1949
+ * <p>Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1668
1950
  * @public
1669
1951
  */
1670
- sessionConfiguration?: RetrieveAndGenerateSessionConfiguration;
1952
+ filter?: RetrievalFilter;
1671
1953
  }
1672
1954
  /**
1673
- * <p>Contains the response generated from querying the knowledge base.</p>
1955
+ * <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1674
1956
  * <p>This data type is used in the following API operations:</p>
1675
1957
  * <ul>
1676
1958
  * <li>
1677
1959
  * <p>
1678
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax">RetrieveAndGenerate response</a> – in the <code>output</code> field</p>
1960
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>retrievalConfiguration</code> field</p>
1961
+ * </li>
1962
+ * <li>
1963
+ * <p>
1964
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>retrievalConfiguration</code> field</p>
1679
1965
  * </li>
1680
1966
  * </ul>
1681
1967
  * @public
1682
1968
  */
1683
- export interface RetrieveAndGenerateOutput {
1969
+ export interface KnowledgeBaseRetrievalConfiguration {
1684
1970
  /**
1685
- * <p>The response generated from querying the knowledge base.</p>
1971
+ * <p>Contains details about how the results from the vector search should be returned. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
1686
1972
  * @public
1687
1973
  */
1688
- text: string | undefined;
1974
+ vectorSearchConfiguration: KnowledgeBaseVectorSearchConfiguration | undefined;
1689
1975
  }
1690
1976
  /**
1977
+ * <p>Contains details about the resource being queried.</p>
1978
+ * <p>This data type is used in the following API operations:</p>
1979
+ * <ul>
1980
+ * <li>
1981
+ * <p>
1982
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>knowledgeBaseConfiguration</code> field</p>
1983
+ * </li>
1984
+ * <li>
1985
+ * <p>
1986
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>knowledgeBaseConfiguration</code> field</p>
1987
+ * </li>
1988
+ * </ul>
1691
1989
  * @public
1692
1990
  */
1693
- export interface RetrieveAndGenerateResponse {
1991
+ export interface KnowledgeBaseRetrieveAndGenerateConfiguration {
1694
1992
  /**
1695
- * <p>The unique identifier of the session. Reuse the same value to continue the same session with the knowledge base.</p>
1993
+ * <p>The unique identifier of the knowledge base that is queried and the foundation model used for generation.</p>
1696
1994
  * @public
1697
1995
  */
1698
- sessionId: string | undefined;
1996
+ knowledgeBaseId: string | undefined;
1699
1997
  /**
1700
- * <p>Contains the response generated from querying the knowledge base.</p>
1998
+ * <p>The ARN of the foundation model used to generate a response.</p>
1701
1999
  * @public
1702
2000
  */
1703
- output: RetrieveAndGenerateOutput | undefined;
2001
+ modelArn: string | undefined;
1704
2002
  /**
1705
- * <p>A list of segments of the generated response that are based on sources in the knowledge base, alongside information about the sources.</p>
2003
+ * <p>Contains configurations for how to retrieve and return the knowledge base query.</p>
1706
2004
  * @public
1707
2005
  */
1708
- citations?: Citation[];
1709
- }
1710
- /**
1711
- * <p>Contains the query made to the knowledge base.</p>
1712
- * <p>This data type is used in the following API operations:</p>
1713
- * <ul>
1714
- * <li>
1715
- * <p>
1716
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>retrievalQuery</code> field</p>
1717
- * </li>
1718
- * </ul>
1719
- * @public
1720
- */
1721
- export interface KnowledgeBaseQuery {
2006
+ retrievalConfiguration?: KnowledgeBaseRetrievalConfiguration;
1722
2007
  /**
1723
- * <p>The text of the query made to the knowledge base.</p>
2008
+ * <p>Contains configurations for response generation based on the knowwledge base query results.</p>
1724
2009
  * @public
1725
2010
  */
1726
- text: string | undefined;
2011
+ generationConfiguration?: GenerationConfiguration;
1727
2012
  }
1728
2013
  /**
1729
2014
  * @public
@@ -1751,47 +2036,52 @@ export interface RetrieveRequest {
1751
2036
  nextToken?: string;
1752
2037
  }
1753
2038
  /**
1754
- * <p>Details about a result from querying the knowledge base.</p>
2039
+ * <p>Contains details about the resource being queried.</p>
1755
2040
  * <p>This data type is used in the following API operations:</p>
1756
2041
  * <ul>
1757
2042
  * <li>
1758
2043
  * <p>
1759
- * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_ResponseSyntax">Retrieve response</a> – in the <code>retrievalResults</code> field</p>
2044
+ * <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>retrieveAndGenerateConfiguration</code> field</p>
1760
2045
  * </li>
1761
2046
  * </ul>
1762
2047
  * @public
1763
2048
  */
1764
- export interface KnowledgeBaseRetrievalResult {
1765
- /**
1766
- * <p>Contains a chunk of text from a data source in the knowledge base.</p>
1767
- * @public
1768
- */
1769
- content: RetrievalResultContent | undefined;
2049
+ export interface RetrieveAndGenerateConfiguration {
1770
2050
  /**
1771
- * <p>Contains information about the location of the data source.</p>
2051
+ * <p>The type of resource that is queried by the request.</p>
1772
2052
  * @public
1773
2053
  */
1774
- location?: RetrievalResultLocation;
2054
+ type: RetrieveAndGenerateType | undefined;
1775
2055
  /**
1776
- * <p>The level of relevance of the result to the query.</p>
2056
+ * <p>Contains details about the resource being queried.</p>
1777
2057
  * @public
1778
2058
  */
1779
- score?: number;
2059
+ knowledgeBaseConfiguration?: KnowledgeBaseRetrieveAndGenerateConfiguration;
1780
2060
  }
1781
2061
  /**
1782
2062
  * @public
1783
2063
  */
1784
- export interface RetrieveResponse {
2064
+ export interface RetrieveAndGenerateRequest {
1785
2065
  /**
1786
- * <p>A list of results from querying the knowledge base.</p>
2066
+ * <p>The unique identifier of the session. Reuse the same value to continue the same session with the knowledge base.</p>
1787
2067
  * @public
1788
2068
  */
1789
- retrievalResults: KnowledgeBaseRetrievalResult[] | undefined;
2069
+ sessionId?: string;
1790
2070
  /**
1791
- * <p>If there are more results than can fit in the response, the response returns a <code>nextToken</code>. Use this token in the <code>nextToken</code> field of another request to retrieve the next batch of results.</p>
2071
+ * <p>Contains the query to be made to the knowledge base.</p>
1792
2072
  * @public
1793
2073
  */
1794
- nextToken?: string;
2074
+ input: RetrieveAndGenerateInput | undefined;
2075
+ /**
2076
+ * <p>Contains configurations for the knowledge base query and retrieval process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.</p>
2077
+ * @public
2078
+ */
2079
+ retrieveAndGenerateConfiguration?: RetrieveAndGenerateConfiguration;
2080
+ /**
2081
+ * <p>Contains details about the session with the knowledge base.</p>
2082
+ * @public
2083
+ */
2084
+ sessionConfiguration?: RetrieveAndGenerateSessionConfiguration;
1795
2085
  }
1796
2086
  /**
1797
2087
  * @internal
@@ -1932,27 +2222,39 @@ export declare const GenerationConfigurationFilterSensitiveLog: (obj: Generation
1932
2222
  /**
1933
2223
  * @internal
1934
2224
  */
1935
- export declare const KnowledgeBaseRetrieveAndGenerateConfigurationFilterSensitiveLog: (obj: KnowledgeBaseRetrieveAndGenerateConfiguration) => any;
2225
+ export declare const RetrieveAndGenerateOutputFilterSensitiveLog: (obj: RetrieveAndGenerateOutput) => any;
1936
2226
  /**
1937
2227
  * @internal
1938
2228
  */
1939
- export declare const RetrieveAndGenerateConfigurationFilterSensitiveLog: (obj: RetrieveAndGenerateConfiguration) => any;
2229
+ export declare const RetrieveAndGenerateResponseFilterSensitiveLog: (obj: RetrieveAndGenerateResponse) => any;
1940
2230
  /**
1941
2231
  * @internal
1942
2232
  */
1943
- export declare const RetrieveAndGenerateRequestFilterSensitiveLog: (obj: RetrieveAndGenerateRequest) => any;
2233
+ export declare const KnowledgeBaseQueryFilterSensitiveLog: (obj: KnowledgeBaseQuery) => any;
1944
2234
  /**
1945
2235
  * @internal
1946
2236
  */
1947
- export declare const RetrieveAndGenerateOutputFilterSensitiveLog: (obj: RetrieveAndGenerateOutput) => any;
2237
+ export declare const KnowledgeBaseRetrievalResultFilterSensitiveLog: (obj: KnowledgeBaseRetrievalResult) => any;
1948
2238
  /**
1949
2239
  * @internal
1950
2240
  */
1951
- export declare const RetrieveAndGenerateResponseFilterSensitiveLog: (obj: RetrieveAndGenerateResponse) => any;
2241
+ export declare const RetrieveResponseFilterSensitiveLog: (obj: RetrieveResponse) => any;
1952
2242
  /**
1953
2243
  * @internal
1954
2244
  */
1955
- export declare const KnowledgeBaseQueryFilterSensitiveLog: (obj: KnowledgeBaseQuery) => any;
2245
+ export declare const RetrievalFilterFilterSensitiveLog: (obj: RetrievalFilter) => any;
2246
+ /**
2247
+ * @internal
2248
+ */
2249
+ export declare const KnowledgeBaseVectorSearchConfigurationFilterSensitiveLog: (obj: KnowledgeBaseVectorSearchConfiguration) => any;
2250
+ /**
2251
+ * @internal
2252
+ */
2253
+ export declare const KnowledgeBaseRetrievalConfigurationFilterSensitiveLog: (obj: KnowledgeBaseRetrievalConfiguration) => any;
2254
+ /**
2255
+ * @internal
2256
+ */
2257
+ export declare const KnowledgeBaseRetrieveAndGenerateConfigurationFilterSensitiveLog: (obj: KnowledgeBaseRetrieveAndGenerateConfiguration) => any;
1956
2258
  /**
1957
2259
  * @internal
1958
2260
  */
@@ -1960,8 +2262,8 @@ export declare const RetrieveRequestFilterSensitiveLog: (obj: RetrieveRequest) =
1960
2262
  /**
1961
2263
  * @internal
1962
2264
  */
1963
- export declare const KnowledgeBaseRetrievalResultFilterSensitiveLog: (obj: KnowledgeBaseRetrievalResult) => any;
2265
+ export declare const RetrieveAndGenerateConfigurationFilterSensitiveLog: (obj: RetrieveAndGenerateConfiguration) => any;
1964
2266
  /**
1965
2267
  * @internal
1966
2268
  */
1967
- export declare const RetrieveResponseFilterSensitiveLog: (obj: RetrieveResponse) => any;
2269
+ export declare const RetrieveAndGenerateRequestFilterSensitiveLog: (obj: RetrieveAndGenerateRequest) => any;