Add support for filtering out properties in serialized objects from function calls
When function calls request data with potentially large amounts of data, it would have been great if we could customize the serializer in a way such that a filter can be applied. This would have to be done in the mapper.writer() call. It would potetially save ALOT of tokens if this could be done, from my experience the assistant is only interested in a small portion of the data sent back.
ObjectMapper mapper = new ObjectMapper();
FilterProvider filters = new SimpleFilterProvider()
.addFilter("myFilter", SimpleBeanPropertyFilter
.filterOutAllExcept("field1", "field2"));
mapper.setFilterProvider(filters);
String json = mapper.writer(filters).writeValueAsString(myObject);
A "hack" (that could be useful in other scenarios as well) would be to apply a UnaryOperator