I have two properties “Totaldue” and “Totalpaid”. Both properties are of decimal type and object query tool is not able to parse them. This is causing significant problems in AIP agent.
Hi @RajKarri!
Filtering between properties is not supported via the Object Query Tool. When looking at the raw system prompt in the View Reasoning tab, you can see that FILTER <property> <operator> <value>
is supported but not FILTER <property> <operator> <property>
is not.
There are two workarounds for this.
-
You could add additional description to your Object Query Tool (or in the agent’s Instructions) to make it clearer that
FILTER <property> <operator> <property>
is not valid. I was able to get it to work by adding this description “When comparing properties, get the values of the properties first then compare the values of the properties. FILTER is not valid.” The agent still takes a couple of tries with this description though, so you could improve it with some examples. This should work if you don’t have that many objects in the object type (if listing out the objects fits in the LLM context window). -
You could write functions that compare the two properties and import them as tools for agent to use. This may be most ideal if you know what kind of comparison you are expecting the agent to do.
Are these things in your Roadmap to improve? I’m not sure how many functions that I can write to cover each of these scenarios. I see issues in property to property comparisons, negative value comparisons and in aggregations as well.
This prompt helped though tool fails first time and picks up in the next time.
Rules that you MUST follow while using Object Query Tool:
- You cannot compare one property to another directly. For example, saying “one field equals another field” is not allowed.
- You can compare a property to a specific value. This is the correct way to write a filter.
- You’re allowed to combine multiple filters using logical operators like AND or OR. This means you can check for multiple conditions at once, such as “this field equals a value AND that field is greater than another value.”
- Never use negative values in filters. If you need to represent a condition like “within the past 30 days,” re-frame it using a positive expression or alternative logic.
- When using AGGREGATE, you cannot order the results if there are multiple properties specified in the groupBy clause. If there is only one groupBy property, you must order the results by the aggregated metric, such as sum. Ordering by any groupBy fields is not allowed under any circumstances.
We have plans to add a new tool that should be able to query Ontology better than the Object Query Tool! Please follow the release notes to see when it’s released!
When can we tentatively expect that, so we can plan accordingly? Thanks.