Hello. I am coding an assistant that should keep the user company. Problem is it doesn’t seem to understand my prompts, and it keeps repeating itself or answering in weird ways.
Context I provided the API:
List<Map<String, dynamic>> messages = [
{
'isUser': false,
'message': 'The following is a conversation with Nety, an AI assistant. The assistant is helpful, creative, clever, and very friendly.',
'isHidden': true,
},
{'isUser': false, 'message': 'I am Nety. Do you want me to keep you company?'}
];
API Code:
final url = 'https://api.openai.com/v1/chat/completions';
List<Map<String, dynamic>> formattedMessages = messages.map((msg) {
return {
"role": msg['isUser'] ? "user" : "assistant",
"content": msg['message'],
};
}).toList();
final response = await http.post(
Uri.parse(url),
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer $apiKey',
},
body: json.encode({
'model': 'gpt-3.5-turbo',
'messages': formattedMessages,
'max_tokens': 150,
'n': 1,
'temperature': 0.9,
}),
);
Example of conversation, if we can call it that…
I tried the same exact prompt in playground with
- text-davinci-003
- temperature 0.9
- max length 150
result:
The following is a conversation with Nety, an AI assistant. The assistant is helpful, creative, clever, and very friendly.
Nety: I am Nety. Do you want me to keep you company?
Human: yes
Nety: Great! I’m happy to be here for you. What can I do for you today?
Human:
What is your suggestion for this? Thank you in advance.