The metadata filter for generateContent via the API seems to work but it doesn’t work on the interactions API. Is this a known issue? I know the syntax is different so will post two examples below but this is extremely frustrating - users are selecting knowledge sources and getting stonewalled by the API.
Example with generate content API which defo works:
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "User query"
}
]
}
],
"systemInstruction": {
"parts": [
{
"text": "insturction 1"
}
]
},
"tools": [
{
"fileSearch": {
"fileSearchStoreNames": [
"fileSearchStores/store_name"
],
"metadataFilter": "company=\"xxx\" AND (documentUrl=\"xxx\" OR documentUrl=\"xxxx\")"
}
}
]
}
Example with interactions API - filtering is 100% not working.
{
"model": "gemini-3.1-pro-preview",
"input": "user query",
"tools": [
{
"type": "file_search",
"file_search_store_names": [
"fileSearchStores/store_name"
],
"metadata_filter": "company=\"xxx\" AND (documentUrl=\"xxx\" OR documentUrl=\"xxx\")"
}
],
"stream": false,
"store": true,
"system_instruction": "instruction."
}