Код: Выделить всё
https://router.huggingface.co/hf-inference/v1/chat/completions
Код: Выделить всё
https://api-inference.huggingface.coВот мой код запроса Java:
Код: Выделить всё
String json = "{"
+ "\"inputs\": \"" + safePrompt + "\""
+ "}";
RequestBody body = RequestBody.create(json, MediaType.parse("application/json"));
Request request = new Request.Builder()
.url("https://router.huggingface.co/hf-inference/v1/chat/completions")
.addHeader("Authorization", "Bearer " + hfToken)
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.code());
System.out.println(response.body().string());
}
Код: Выделить всё
Response code: 422
Raw body length: 24
Подробнее здесь: https://stackoverflow.com/questions/798 ... pse-plugin
Мобильная версия