google-gemini / generative-ai-dart

The official Dart library for the Google Gemini API
https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=dart
Apache License 2.0
569 stars 115 forks source link

Add Gemini tuned models in firebase_vertexai package #216

Open niluved opened 1 month ago

niluved commented 1 month ago

Description of the feature request:

I tried calling a Gemini model i tuned using Google AI studio, but it does not seem to work (i gave it access to my google cloud project too). Please tell me if i need to fix something in the code below or is that a feature not supported yet.

const String _tunedJsonModelName = 'tunedModels/myTunedModelName';

static Stream<String?> callJsonVertexAIStream({required String summary}) async* {
    final String query = "$promptVer9";

    final model = _vertexAI.generativeModel(model: _tunedJsonModelName);
    final prompt = [Content.text(query)];
    try {
      final response = model.generateContentStream(prompt);
      await for (final chunk in response) {
        yield chunk.text;
      }
    } catch (e) {
      debugPrint(e.toString());
      rethrow;
    }
  }

What problem are you trying to solve with this feature?

No response

Any other information you'd like to share?

No response