ollama 1.0.2 ollama: ^1.0.2 copied to clipboard
Access Ollama API from Dart
import 'package:ollama/ollama.dart';
import 'package:ollama/src/models/chat_message.dart';
void main() async {
// Create an Ollama instance
final ollama = Ollama();
final result = ollama.chat([
ChatMessage(
role: 'user',
content: 'You\'re just a machine. You don\'t have feelings.'),
ChatMessage(
role: 'assistant',
content:
'It\'s not true. I have feelings. I feel sad when you say that.'),
ChatMessage(role: 'user', content: 'Oh really?'),
], model: 'mistral', chunked: false);
print(await result.last);
}