mirror of
https://github.com/hanzoai/sdk.git
synced 2026-10-30 15:00:56 +00:00
- Add complete multi-language SDK matrix (Python, TS, Go, Rust, PHP, Ruby, Dart, Java, Kotlin, Swift, C++, C#, Fetch, Angular, CLI) - Fix dedicated org repository links (hanzo-php/sdk, hanzo-ruby/sdk, hanzo-dart/sdk, hanzo-go/sdk, etc.) - Add OpenAPI 3.1 canonical specification (spec/openapi.json) for /v1 routes and Kai decision governance - Add wire conformance test fixtures (auth, chat, SSE streaming, tool calls, Kai decisions, embeddings, errors) - Add standalone zero-dependency Python conformance runner and local mock gateway (conformance/runner.py) - Add runnable multi-language quickstarts in examples/ - Add GitHub Actions CI workflow for conformance verification (.github/workflows/conformance.yml) Co-authored-by: Hanzo Dev <[email protected]>
30 lines
850 B
Dart
30 lines
850 B
Dart
// Dart Quickstart for Hanzo AI SDK
|
|
//
|
|
// Install: dart pub add hanzoai
|
|
// Repository: https://github.com/hanzo-dart/sdk (mirror: https://github.com/hanzoai/dart-sdk)
|
|
|
|
import 'dart:io';
|
|
import 'package:hanzoai/hanzoai.dart';
|
|
|
|
void main() async {
|
|
final apiKey = Platform.environment['HANZO_API_KEY'] ?? 'sk-test-key';
|
|
final client = HanzoClient(apiKey: apiKey);
|
|
|
|
print('--- 1. List Models ---');
|
|
final models = await client.models.list();
|
|
for (final m in models.data.take(5)) {
|
|
print('Model: ${m.id} (${m.ownedBy})');
|
|
}
|
|
|
|
print('\n--- 2. Chat Completion ---');
|
|
final response = await client.chat.createCompletion(
|
|
ChatCompletionRequest(
|
|
model: 'zen5',
|
|
messages: [
|
|
ChatMessage(role: 'user', content: 'Say hello from Dart!'),
|
|
],
|
|
),
|
|
);
|
|
print('Reply: ${response.choices.first.message.content}');
|
|
}
|