I have llama model on deepinfra, and its resposes me utf8 string in answer, idk how to parse it into normal format.
im trying
Future<String> getContent(String style, String size, String keywords,
String additional, String content) async {
final Constants env = Constants();
String promtString =
$style;
String requestBody = jsonEncode({
"model": "meta-llama/Meta-Llama-3-70B-Instruct",
"messages": [
{"role": "user", "content": promtString}
]
});
var url = Uri.https(env.llamaApiUrl, env.llamaApiVersion);
var response = await http.post(url, body: requestBody, headers: {
"Authorization": env.llamaApiKey,
"Content-Type": "application/json"
});
var result = jsonDecode(response.body);
print(utf8.decode(result["choices"][0]["message"]["content"]));
return result["choices"][0]["message"]["content"];
}
I expecting, that i need to change format of string, but how?
New contributor
Zshow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.