Skip to content
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

JsonUtil improvement #37

Closed
propertius opened this issue Jun 7, 2024 · 1 comment
Closed

JsonUtil improvement #37

propertius opened this issue Jun 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@propertius
Copy link

Hi @Lambdua, I'm using your library specially for the Assistants API. Since yesterday the added a parallel_tool_calls param, I am getting this error:

Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "parallel_tool_calls" (class com.theokanning.openai.assistants.run.Run), not marked as ignorable...

What I did locally as a workaround was to make the JsonUtil internal Mapper a bit more robust, so that unknown properties would not make the parsing fail:

private static class ObjectMapperHolder {
		private static final ObjectMapper MAPPER = new ObjectMapper();
		static {
			MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
			MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
			MAPPER.setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE);
		}
	}

What do you think of this change?

@Lambdua
Copy link
Owner

Lambdua commented Jun 8, 2024

I'll check later❤️

@Lambdua Lambdua added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Jun 8, 2024
@Lambdua Lambdua closed this as completed Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants