mirror of
https://github.com/foss42/apidash.git
synced 2025-12-03 19:39:25 +08:00
REFACTOR: Improved Package Structure
This commit is contained in:
40
packages/genai/lib/llm_model.dart
Normal file
40
packages/genai/lib/llm_model.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'llm_input_payload.dart';
|
||||
import 'llm_provider.dart';
|
||||
import 'llm_request.dart';
|
||||
|
||||
class LLMModel {
|
||||
const LLMModel(this.identifier, this.modelName, this.provider);
|
||||
final String identifier;
|
||||
final String modelName;
|
||||
final LLMProvider provider;
|
||||
|
||||
static Map toJson(LLMModel m) {
|
||||
return {'identifier': m.identifier, 'provider': m.provider.name};
|
||||
}
|
||||
|
||||
static LLMModel fromJson(Map json) {
|
||||
return LLMProvider.fromName(
|
||||
json['provider'],
|
||||
).getLLMByIdentifier(json['identifier']);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class ModelController {
|
||||
LLMInputPayload get inputPayload => throw UnimplementedError();
|
||||
|
||||
LLMRequestDetails createRequest(
|
||||
LLMModel model,
|
||||
LLMInputPayload inputPayload, {
|
||||
bool stream = false,
|
||||
}) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
String? outputFormatter(Map x) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
String? streamOutputFormatter(Map x) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user