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

JSON Serialization Issue #10

Closed
fmatak opened this issue May 15, 2024 · 1 comment
Closed

JSON Serialization Issue #10

fmatak opened this issue May 15, 2024 · 1 comment

Comments

@fmatak
Copy link

fmatak commented May 15, 2024

I have below code:

AssistantsClient ac = openAI.assistantsClient( ) ;
var aclist = ac.listAssistants( PaginationQueryParameters.none( ) ) ;
String jsonString = ObjectMapperSingleton.getInstance( ).writeValueAsString( aclist ) ;

This jsonString is not valid JSON. The "tools" array is as follows:
"tools":[{"type":"file_search","type":"file_search"}]

Notice the duplicate type fields. I managed to get rid of the duplicate by modifiying the current annotation:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
to
@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = "type", include = JsonTypeInfo.As.EXISTING_PROPERTY )

merging this change (and maybe updating other classes for similar issues) could be helpful.

@StefanBratanov
Copy link
Owner

Thank you. This is indeed a bug. Fixed it in 1208a1b . Will be part of the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants