Created
February 5, 2023 12:08
-
-
Save SuvidhaMalaviya/c0dd18323d071117d86e9946744b76e4 to your computer and use it in GitHub Desktop.
ChatGPT Integration-3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Call<ResponseBody> call = chatGPTAPI.sendRequest("Hello, how are you?", 100, 0.5f); | |
call.enqueue(new Callback<ResponseBody>() { | |
@Override | |
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { | |
if (response.isSuccessful()) { | |
try { | |
// Use response.body() to access the response from the API | |
String responseString = response.body().string(); | |
// Do something with the response | |
} catch (IOException e) { | |
// Handle the exception | |
} | |
} else { | |
// Handle the error | |
} | |
} | |
@Override | |
public void onFailure(Call<ResponseBody> call, Throwable t) { | |
// Handle the failure | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment