llamacpp_rpc_client 0.2.0
llamacpp_rpc_client: ^0.2.0 copied to clipboard
HTTP client bindings to call the llama.cpp RPC server
import 'package:llamacpp_rpc_client/llamacpp_rpc_client.dart';
void main() async {
final client = LlamacppRpcClient('http://localhost:8080');
// Text completion
final completion = await client.completion(
'The capital of France is',
options: CompletionOptions(maxTokens: 50, temperature: 0.7),
);
print(completion.content);
// Streaming completion
await for (final chunk in client.streamCompletion('Tell me a story')) {
print(chunk.content);
}
// Text embedding
final embedding = await client.embedding('Hello world');
print(embedding.embedding.length);
client.close();
}