-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for using custom Json ObjectMapper #205
Comments
Setting an |
The issue is that for different calls to jsonToObject() you may want a different ObjectReader. If it is set at the SimpleOpenAI level then whenever you need a different ObjectReader you'll have to create a new instance of SimpleOpenAI (which means passing around the API key + other initialization data). |
My use of |
Agreed. Both options can be useful for different workflows. |
@sashirestela Yes. We can make it work for our requirements. We can aggregate the custom data types we need across all use cases into one big unified ObjectMapper that can serialize everything we need. Thanks for adding this important capability. |
@sashirestela I'm also happy to see the usage of simple-openai growing and more and more requests are coming in. Let me know if I can help with a PR or anything else. |
Here is the issue. This specific instance happened during tool calls.
The FunctionExecutor calls Cleverclient's JsonUtil to deserialize JSON objects.
If the functional class contains types that are not registered by the vanilla object mapper / object reader in Cleverclient's JsonUtil we have a problem.
Since the ObjectReader is generated from a vanilla ObjectMapper that doesn't register the
com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
it can't handle dates. That's fine. Cleverclient shouldn't register any possible module. But, it should be possible to pass an external ObjectMapper/ObjectReader to all the methods in JsonUtil.I opened an issue for Cleverclient: sashirestela/cleverclient#77
Once, it is possible to provide a custom object mapper/object reader to JsonUtil, then, the FunctionExecutor should be able to pass a custom ObjectReader to Cleverclient's
JsonUtil.jsonToObject()
methodProbably overload the
execute()
andexecuteAll()
methods like so:The text was updated successfully, but these errors were encountered: