Skip to content

Commit 91b3891

Browse files
author
awstools
committed
feat(client-bedrock-agent-runtime): Updating Bedrock Knowledge Base Metadata & Filters feature with two new filters listContains and stringContains
1 parent c7cfb66 commit 91b3891

File tree

5 files changed

+173
-23
lines changed

5 files changed

+173
-23
lines changed

clients/client-bedrock-agent-runtime/src/commands/RetrieveAndGenerateCommand.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ export interface RetrieveAndGenerateCommandOutput extends RetrieveAndGenerateRes
8282
* in: "<FilterAttribute>",
8383
* notIn: "<FilterAttribute>",
8484
* startsWith: "<FilterAttribute>",
85+
* listContains: "<FilterAttribute>",
86+
* stringContains: "<FilterAttribute>",
8587
* andAll: [ // RetrievalFilterList
8688
* {// Union: only one key present
8789
* equals: "<FilterAttribute>",
@@ -93,6 +95,8 @@ export interface RetrieveAndGenerateCommandOutput extends RetrieveAndGenerateRes
9395
* in: "<FilterAttribute>",
9496
* notIn: "<FilterAttribute>",
9597
* startsWith: "<FilterAttribute>",
98+
* listContains: "<FilterAttribute>",
99+
* stringContains: "<FilterAttribute>",
96100
* andAll: [
97101
* "<RetrievalFilter>",
98102
* ],

clients/client-bedrock-agent-runtime/src/commands/RetrieveCommand.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ export interface RetrieveCommandOutput extends RetrieveResponse, __MetadataBeare
7777
* in: "<FilterAttribute>",
7878
* notIn: "<FilterAttribute>",
7979
* startsWith: "<FilterAttribute>",
80+
* listContains: "<FilterAttribute>",
81+
* stringContains: "<FilterAttribute>",
8082
* andAll: [ // RetrievalFilterList
8183
* {// Union: only one key present
8284
* equals: "<FilterAttribute>",
@@ -88,6 +90,8 @@ export interface RetrieveCommandOutput extends RetrieveResponse, __MetadataBeare
8890
* in: "<FilterAttribute>",
8991
* notIn: "<FilterAttribute>",
9092
* startsWith: "<FilterAttribute>",
93+
* listContains: "<FilterAttribute>",
94+
* stringContains: "<FilterAttribute>",
9195
* andAll: [
9296
* "<RetrievalFilter>",
9397
* ],

clients/client-bedrock-agent-runtime/src/models/models_0.ts

Lines changed: 139 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,7 +2721,7 @@ export interface RetrieveResponse {
27212721
}
27222722

27232723
/**
2724-
* <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>
2724+
* <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>. See the examples below to see how to use these filters.</p>
27252725
* <p>This data type is used in the following API operations:</p>
27262726
* <ul>
27272727
* <li>
@@ -2743,18 +2743,24 @@ export type RetrievalFilter =
27432743
| RetrievalFilter.InMember
27442744
| RetrievalFilter.LessThanMember
27452745
| RetrievalFilter.LessThanOrEqualsMember
2746+
| RetrievalFilter.ListContainsMember
27462747
| RetrievalFilter.NotEqualsMember
27472748
| RetrievalFilter.NotInMember
27482749
| RetrievalFilter.OrAllMember
27492750
| RetrievalFilter.StartsWithMember
2751+
| RetrievalFilter.StringContainsMember
27502752
| RetrievalFilter.$UnknownMember;
27512753

27522754
/**
27532755
* @public
27542756
*/
27552757
export namespace RetrievalFilter {
27562758
/**
2757-
* <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>
2759+
* <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value matches the <code>value</code> in this object.</p>
2760+
* <p>The following example would return data sources with an <code>animal</code> attribute whose value is <code>cat</code>:</p>
2761+
* <p>
2762+
* <code>"equals": \{ "key": "animal", "value": "cat" \}</code>
2763+
* </p>
27582764
* @public
27592765
*/
27602766
export interface EqualsMember {
@@ -2767,13 +2773,19 @@ export namespace RetrievalFilter {
27672773
in?: never;
27682774
notIn?: never;
27692775
startsWith?: never;
2776+
listContains?: never;
2777+
stringContains?: never;
27702778
andAll?: never;
27712779
orAll?: never;
27722780
$unknown?: never;
27732781
}
27742782

27752783
/**
27762784
* <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>
2785+
* <p>The following example would return data sources that don't contain an <code>animal</code> attribute whose value is <code>cat</code>.</p>
2786+
* <p>
2787+
* <code>"notEquals": \{ "key": "animal", "value": "cat" \}</code>
2788+
* </p>
27772789
* @public
27782790
*/
27792791
export interface NotEqualsMember {
@@ -2786,13 +2798,19 @@ export namespace RetrievalFilter {
27862798
in?: never;
27872799
notIn?: never;
27882800
startsWith?: never;
2801+
listContains?: never;
2802+
stringContains?: never;
27892803
andAll?: never;
27902804
orAll?: never;
27912805
$unknown?: never;
27922806
}
27932807

27942808
/**
2795-
* <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>
2809+
* <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than the <code>value</code> in this object.</p>
2810+
* <p>The following example would return data sources with an <code>year</code> attribute whose value is greater than <code>1989</code>:</p>
2811+
* <p>
2812+
* <code>"greaterThan": \{ "key": "year", "value": 1989 \}</code>
2813+
* </p>
27962814
* @public
27972815
*/
27982816
export interface GreaterThanMember {
@@ -2805,13 +2823,19 @@ export namespace RetrievalFilter {
28052823
in?: never;
28062824
notIn?: never;
28072825
startsWith?: never;
2826+
listContains?: never;
2827+
stringContains?: never;
28082828
andAll?: never;
28092829
orAll?: never;
28102830
$unknown?: never;
28112831
}
28122832

28132833
/**
2814-
* <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>
2834+
* <p>Knowledge base data sources are returned if they 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.</p>
2835+
* <p>The following example would return data sources with an <code>year</code> attribute whose value is greater than or equal to <code>1989</code>:</p>
2836+
* <p>
2837+
* <code>"greaterThanOrEquals": \{ "key": "year", "value": 1989 \}</code>
2838+
* </p>
28152839
* @public
28162840
*/
28172841
export interface GreaterThanOrEqualsMember {
@@ -2824,13 +2848,19 @@ export namespace RetrievalFilter {
28242848
in?: never;
28252849
notIn?: never;
28262850
startsWith?: never;
2851+
listContains?: never;
2852+
stringContains?: never;
28272853
andAll?: never;
28282854
orAll?: never;
28292855
$unknown?: never;
28302856
}
28312857

28322858
/**
2833-
* <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>
2859+
* <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is less than the <code>value</code> in this object.</p>
2860+
* <p>The following example would return data sources with an <code>year</code> attribute whose value is less than to <code>1989</code>.</p>
2861+
* <p>
2862+
* <code>"lessThan": \{ "key": "year", "value": 1989 \}</code>
2863+
* </p>
28342864
* @public
28352865
*/
28362866
export interface LessThanMember {
@@ -2843,13 +2873,19 @@ export namespace RetrievalFilter {
28432873
in?: never;
28442874
notIn?: never;
28452875
startsWith?: never;
2876+
listContains?: never;
2877+
stringContains?: never;
28462878
andAll?: never;
28472879
orAll?: never;
28482880
$unknown?: never;
28492881
}
28502882

28512883
/**
2852-
* <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>
2884+
* <p>Knowledge base data sources are returned if they 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.</p>
2885+
* <p>The following example would return data sources with an <code>year</code> attribute whose value is less than or equal to <code>1989</code>.</p>
2886+
* <p>
2887+
* <code>"lessThanOrEquals": \{ "key": "year", "value": 1989 \}</code>
2888+
* </p>
28532889
* @public
28542890
*/
28552891
export interface LessThanOrEqualsMember {
@@ -2862,13 +2898,19 @@ export namespace RetrievalFilter {
28622898
in?: never;
28632899
notIn?: never;
28642900
startsWith?: never;
2901+
listContains?: never;
2902+
stringContains?: never;
28652903
andAll?: never;
28662904
orAll?: never;
28672905
$unknown?: never;
28682906
}
28692907

28702908
/**
2871-
* <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>
2909+
* <p>Knowledge base data sources are returned if they 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.</p>
2910+
* <p>The following example would return data sources with an <code>animal</code> attribute that is either <code>cat</code> or <code>dog</code>:</p>
2911+
* <p>
2912+
* <code>"in": \{ "key": "animal", "value": ["cat", "dog"] \}</code>
2913+
* </p>
28722914
* @public
28732915
*/
28742916
export interface InMember {
@@ -2881,13 +2923,19 @@ export namespace RetrievalFilter {
28812923
in: FilterAttribute;
28822924
notIn?: never;
28832925
startsWith?: never;
2926+
listContains?: never;
2927+
stringContains?: never;
28842928
andAll?: never;
28852929
orAll?: never;
28862930
$unknown?: never;
28872931
}
28882932

28892933
/**
2890-
* <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>
2934+
* <p>Knowledge base data sources are returned if they 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.</p>
2935+
* <p>The following example would return data sources whose <code>animal</code> attribute is neither <code>cat</code> nor <code>dog</code>.</p>
2936+
* <p>
2937+
* <code>"notIn": \{ "key": "animal", "value": ["cat", "dog"] \}</code>
2938+
* </p>
28912939
* @public
28922940
*/
28932941
export interface NotInMember {
@@ -2900,13 +2948,19 @@ export namespace RetrievalFilter {
29002948
in?: never;
29012949
notIn: FilterAttribute;
29022950
startsWith?: never;
2951+
listContains?: never;
2952+
stringContains?: never;
29032953
andAll?: never;
29042954
orAll?: never;
29052955
$unknown?: never;
29062956
}
29072957

29082958
/**
2909-
* <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>
2959+
* <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value starts with the <code>value</code> in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores.</p>
2960+
* <p>The following example would return data sources with an <code>animal</code> attribute starts with <code>ca</code> (for example, <code>cat</code> or <code>camel</code>).</p>
2961+
* <p>
2962+
* <code>"startsWith": \{ "key": "animal", "value": "ca" \}</code>
2963+
* </p>
29102964
* @public
29112965
*/
29122966
export interface StartsWithMember {
@@ -2919,13 +2973,75 @@ export namespace RetrievalFilter {
29192973
in?: never;
29202974
notIn?: never;
29212975
startsWith: FilterAttribute;
2976+
listContains?: never;
2977+
stringContains?: never;
29222978
andAll?: never;
29232979
orAll?: never;
29242980
$unknown?: never;
29252981
}
29262982

29272983
/**
2928-
* <p>Knowledge base data sources whose metadata attributes fulfill all the filter conditions inside this list are returned.</p>
2984+
* <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is a list that contains the <code>value</code> as one of its members.</p>
2985+
* <p>The following example would return data sources with an <code>animals</code> attribute that is a list containing a <code>cat</code> member (for example <code>["dog", "cat"]</code>).</p>
2986+
* <p>
2987+
* <code>"listContains": \{ "key": "animals", "value": "cat" \}</code>
2988+
* </p>
2989+
* @public
2990+
*/
2991+
export interface ListContainsMember {
2992+
equals?: never;
2993+
notEquals?: never;
2994+
greaterThan?: never;
2995+
greaterThanOrEquals?: never;
2996+
lessThan?: never;
2997+
lessThanOrEquals?: never;
2998+
in?: never;
2999+
notIn?: never;
3000+
startsWith?: never;
3001+
listContains: FilterAttribute;
3002+
stringContains?: never;
3003+
andAll?: never;
3004+
orAll?: never;
3005+
$unknown?: never;
3006+
}
3007+
3008+
/**
3009+
* <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is one of the following:</p>
3010+
* <ul>
3011+
* <li>
3012+
* <p>A string that contains the <code>value</code> as a substring. The following example would return data sources with an <code>animal</code> attribute that contains the substring <code>at</code> (for example <code>cat</code>).</p>
3013+
* <p>
3014+
* <code>"stringContains": \{ "key": "animal", "value": "at" \}</code>
3015+
* </p>
3016+
* </li>
3017+
* <li>
3018+
* <p>A list with a member that contains the <code>value</code> as a substring. The following example would return data sources with an <code>animals</code> attribute that is a list containing a member that contains the substring <code>at</code> (for example <code>["dog", "cat"]</code>).</p>
3019+
* <p>
3020+
* <code>"stringContains": \{ "key": "animals", "value": "at" \}</code>
3021+
* </p>
3022+
* </li>
3023+
* </ul>
3024+
* @public
3025+
*/
3026+
export interface StringContainsMember {
3027+
equals?: never;
3028+
notEquals?: never;
3029+
greaterThan?: never;
3030+
greaterThanOrEquals?: never;
3031+
lessThan?: never;
3032+
lessThanOrEquals?: never;
3033+
in?: never;
3034+
notIn?: never;
3035+
startsWith?: never;
3036+
listContains?: never;
3037+
stringContains: FilterAttribute;
3038+
andAll?: never;
3039+
orAll?: never;
3040+
$unknown?: never;
3041+
}
3042+
3043+
/**
3044+
* <p>Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list.</p>
29293045
* @public
29303046
*/
29313047
export interface AndAllMember {
@@ -2938,13 +3054,15 @@ export namespace RetrievalFilter {
29383054
in?: never;
29393055
notIn?: never;
29403056
startsWith?: never;
3057+
listContains?: never;
3058+
stringContains?: never;
29413059
andAll: RetrievalFilter[];
29423060
orAll?: never;
29433061
$unknown?: never;
29443062
}
29453063

29463064
/**
2947-
* <p>Knowledge base data sources whose metadata attributes fulfill at least one of the filter conditions inside this list are returned.</p>
3065+
* <p>Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list.</p>
29483066
* @public
29493067
*/
29503068
export interface OrAllMember {
@@ -2957,6 +3075,8 @@ export namespace RetrievalFilter {
29573075
in?: never;
29583076
notIn?: never;
29593077
startsWith?: never;
3078+
listContains?: never;
3079+
stringContains?: never;
29603080
andAll?: never;
29613081
orAll: RetrievalFilter[];
29623082
$unknown?: never;
@@ -2975,6 +3095,8 @@ export namespace RetrievalFilter {
29753095
in?: never;
29763096
notIn?: never;
29773097
startsWith?: never;
3098+
listContains?: never;
3099+
stringContains?: never;
29783100
andAll?: never;
29793101
orAll?: never;
29803102
$unknown: [string, any];
@@ -2990,6 +3112,8 @@ export namespace RetrievalFilter {
29903112
in: (value: FilterAttribute) => T;
29913113
notIn: (value: FilterAttribute) => T;
29923114
startsWith: (value: FilterAttribute) => T;
3115+
listContains: (value: FilterAttribute) => T;
3116+
stringContains: (value: FilterAttribute) => T;
29933117
andAll: (value: RetrievalFilter[]) => T;
29943118
orAll: (value: RetrievalFilter[]) => T;
29953119
_: (name: string, value: any) => T;
@@ -3005,6 +3129,8 @@ export namespace RetrievalFilter {
30053129
if (value.in !== undefined) return visitor.in(value.in);
30063130
if (value.notIn !== undefined) return visitor.notIn(value.notIn);
30073131
if (value.startsWith !== undefined) return visitor.startsWith(value.startsWith);
3132+
if (value.listContains !== undefined) return visitor.listContains(value.listContains);
3133+
if (value.stringContains !== undefined) return visitor.stringContains(value.stringContains);
30083134
if (value.andAll !== undefined) return visitor.andAll(value.andAll);
30093135
if (value.orAll !== undefined) return visitor.orAll(value.orAll);
30103136
return visitor._(value.$unknown[0], value.$unknown[1]);
@@ -3667,6 +3793,8 @@ export const RetrievalFilterFilterSensitiveLog = (obj: RetrievalFilter): any =>
36673793
if (obj.in !== undefined) return { in: obj.in };
36683794
if (obj.notIn !== undefined) return { notIn: obj.notIn };
36693795
if (obj.startsWith !== undefined) return { startsWith: obj.startsWith };
3796+
if (obj.listContains !== undefined) return { listContains: obj.listContains };
3797+
if (obj.stringContains !== undefined) return { stringContains: obj.stringContains };
36703798
if (obj.andAll !== undefined) return { andAll: SENSITIVE_STRING };
36713799
if (obj.orAll !== undefined) return { orAll: SENSITIVE_STRING };
36723800
if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" };

clients/client-bedrock-agent-runtime/src/protocols/Aws_restJson1.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,10 +818,12 @@ const se_RetrievalFilter = (input: RetrievalFilter, context: __SerdeContext): an
818818
in: (value) => ({ in: se_FilterAttribute(value, context) }),
819819
lessThan: (value) => ({ lessThan: se_FilterAttribute(value, context) }),
820820
lessThanOrEquals: (value) => ({ lessThanOrEquals: se_FilterAttribute(value, context) }),
821+
listContains: (value) => ({ listContains: se_FilterAttribute(value, context) }),
821822
notEquals: (value) => ({ notEquals: se_FilterAttribute(value, context) }),
822823
notIn: (value) => ({ notIn: se_FilterAttribute(value, context) }),
823824
orAll: (value) => ({ orAll: se_RetrievalFilterList(value, context) }),
824825
startsWith: (value) => ({ startsWith: se_FilterAttribute(value, context) }),
826+
stringContains: (value) => ({ stringContains: se_FilterAttribute(value, context) }),
825827
_: (name, value) => ({ name: value } as any),
826828
});
827829
};

0 commit comments

Comments
 (0)