Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

JsonProperties avoiding 'Unrecognized request argument supplied' erro… #91

Merged
merged 1 commit into from
Mar 8, 2023

Conversation

GianSeb
Copy link
Contributor

@GianSeb GianSeb commented Feb 9, 2023

…r in Image and Completion Requests

For developers that don't use the client library.

Example was made with RestTemplate.

EX. ERROR:
org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: "{ "error": { "message": "Unrecognized request argument supplied: logitBias", "type": "invalid_request_error", "param": null, "code": null }}"

@cryptoapebot
Copy link

Not that it makes a diff as it's personal pref, I've been using Gson instead of Jackson annotations.

   GeneratedImage gen = gs.fromJson(response.body(), GeneratedImage.class);

public class @Data GeneratedImage {
	Integer created = 0;
	ArrayList<ImageLocation> data = null;
}

@GianSeb
Copy link
Contributor Author

GianSeb commented Feb 9, 2023

@cryptoapebot Sorry but the project already use Jackson library like in Image class (com.theokanning.openai.image), and if I would use existing models like CompletionRequest in the -api- module, I need they will be serialized/deserialized correctly.

@cryptoapebot
Copy link

Yes, of course. I'm not recommending switching, but because of my integration of calls with this library and w/ other projects, I've been forced to choose.

@TheoKanning TheoKanning merged commit ec701cd into TheoKanning:main Mar 8, 2023
@TheoKanning
Copy link
Owner

I'll go ahead and add these everywhere, then nobody will have to will worry about setting jackson to snake case anymore

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

Successfully merging this pull request may close these issues.

None yet

3 participants