mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
Reorganized the genai package by removing legacy LLM-related files and introducing a new modular interface under the 'interface' directory. Added provider-specific model classes, centralized constants, and updated the example to use the new API and data structures. Updated exports in genai.dart and improved dependency management.
30 lines
974 B
Dart
30 lines
974 B
Dart
import 'package:better_networking/better_networking.dart';
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
import '../interface/interface.dart';
|
|
import 'model_request_data.dart';
|
|
part 'ai_request_model.freezed.dart';
|
|
part 'ai_request_model.g.dart';
|
|
|
|
@freezed
|
|
class AIRequestModel with _$AIRequestModel {
|
|
const AIRequestModel._();
|
|
|
|
@JsonSerializable(explicitToJson: true, anyMap: true)
|
|
const factory AIRequestModel({
|
|
ModelAPIProvider? modelProvider,
|
|
ModelRequestData? modelRequestData,
|
|
}) = _AIRequestModel;
|
|
|
|
factory AIRequestModel.fromJson(Map<String, Object?> json) =>
|
|
_$AIRequestModelFromJson(json);
|
|
|
|
HttpRequestModel? get httpRequestModel =>
|
|
kModelProvidersMap[modelProvider]?.createRequest(modelRequestData);
|
|
|
|
String? getFormattedOutput(Map x) =>
|
|
kModelProvidersMap[modelProvider]?.outputFormatter(x);
|
|
|
|
String? getFormattedStreamOutput(Map x) =>
|
|
kModelProvidersMap[modelProvider]?.streamOutputFormatter(x);
|
|
}
|