Repository navigation
Description
Observed Behavior
On an int field, CosmosCollection treats a float operand like 2.0 as a type mismatch. Filter("count", "eq", 2.0) compiles to WHERE false, so it returns nothing. Filter("count", "ne", 2.0) compiles to IS_DEFINED(c["count"]), so it returns every record, including the ones where count is 2. in [2.0] works fine, and ordered filters like gt 1.5 raise a TypeError.
Expected Behavior
Compare the numbers, the same way in already does and InMemoryCollection and DuckDB do: eq 2.0 matches count 2 and ne 2.0 leaves it out. Cosmos stores every JSON number as a double, so c["count"] = 2.0 is a normal comparison there.
Steps to Reproduce
- Define a collection with an
intdata field - Filter it with
eqorneand a float value like2.0 - Look at the generated WHERE clause (or the results)
Minimal Reproduction
from unittest.mock import MagicMock
from agent_framework import Filter, VectorStoreCollectionDefinition, VectorStoreField
from agent_framework_azure_cosmos import CosmosCollection
definition = VectorStoreCollectionDefinition(
[
VectorStoreField("key", name="id", type_="str"),
VectorStoreField("data", name="count", type_="int"),
VectorStoreField("vector", name="embedding", type_="float", dimensions=2),
],
collection_name="items",
)
container = MagicMock()
container.id = "items"
collection = CosmosCollection(dict, definition=definition, container_client=container)
for flt in (Filter("count", "eq", 2.0), Filter("count", "ne", 2.0), Filter("count", "in", [2.0])):
print(flt.operator, collection._prepare_filter(flt)[0])Error Messages and Stack Traces
eq false
ne IS_DEFINED(c["count"])
in (IS_DEFINED(c["count"]) AND NOT IS_NULL(c["count"]) AND ARRAY_CONTAINS(@filter_0, c["count"]))
Package Versions
agent-framework-core 1.25.0, agent-framework-azure-cosmos 1.0.0b261106 (main at 924a6e5)
Python Version
Python 3.12
Operating System
macOS
Regression
No
Additional Context
_filter_value_compatible in _vector_store.py only accepts type(value) is int for int fields, while float fields already accept both. A fix could be to treat int and float fields the same for numeric operands (bools stay rejected). I have a fix with tests and will open a PR.
AI assistance: I used an AI assistant to help find the cause and write this up. I ran the repro myself.
Acknowledgements
- I searched existing issues and did not find a duplicate.
- I personally verified this behavior and the reproduction details are authentic.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Nov 9, 2026
Reproduced on
main(924a6e5) with a minimal check ofCosmosCollection._prepare_filteron anintfield:eq 2.0→false,ne 2.0→IS_DEFINED(c["count"]),gt 1.5→TypeError, whilein [2.0]compiles normally. This matches the report; the cause is thetype(value) is intcheck in_filter_value_compatible(python/packages/azure-cosmos/agent_framework_azure_cosmos/_vector_store.py).Support boundary: unclear. I found no maintained spec or doc stating how float operands on int fields should behave, so that scope decision is left to a maintainers. Routed to the azure-cosmos owner; the linked PR #10183 is still open.
Run: https://github.com/microsoft/agent-framework/actions/runs/42574107530