mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 02:39:19 +08:00
genai README update + Basic Testing
This commit is contained in:
30
packages/genai/test/utils.dart/ai_request_utils_test.dart
Normal file
30
packages/genai/test/utils.dart/ai_request_utils_test.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:genai/models/ai_request_model.dart';
|
||||
import 'package:genai/interface/consts.dart';
|
||||
import 'package:genai/utils/ai_request_utils.dart';
|
||||
import 'package:better_networking/better_networking.dart';
|
||||
|
||||
const kTestingAPIKey = "AIzaSyAtmGxNxlbh_MokoDbMjHKDSW-gU6GCMOU";
|
||||
|
||||
void main() {
|
||||
group('ai_request_utils', () {
|
||||
test(
|
||||
'executeGenAIRequest should return formatted output on success',
|
||||
() async {
|
||||
const model = AIRequestModel(
|
||||
modelApiProvider: ModelAPIProvider.gemini,
|
||||
model: 'gemini-2.0-flash',
|
||||
url: kGeminiUrl,
|
||||
userPrompt: 'Convert the Given Number into Binary',
|
||||
systemPrompt: '1',
|
||||
apiKey: kTestingAPIKey,
|
||||
);
|
||||
final result = await executeGenAIRequest(model);
|
||||
expect(result, isNotNull);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user