API dành cho nhà phát triển Gemini

Gemini Developer API cho phép bạn truy cập vào các mô hình Gemini của Google, giúp bạn xây dựng các tính năng AI tạo sinh tiên tiến trong ứng dụng Android, bao gồm cả tính năng trò chuyện, tạo hình ảnh (bằng Nano Banana) và tạo văn bản dựa trên dữ liệu đầu vào là văn bản, hình ảnh, âm thanh và video.

Để truy cập vào các mô hình Gemini Pro và Flash, bạn có thể sử dụng Gemini Developer API với Firebase AI Logic. Nền tảng này cho phép bạn bắt đầu mà không cần phương thức thanh toán (như thẻ tín dụng) và cung cấp một cấp miễn phí hào phóng. Sau khi xác thực việc tích hợp với một cơ sở người dùng nhỏ, bạn có thể mở rộng quy mô bằng cách nâng cấp lên gói có tính phí.

Hình minh hoạ cho thấy một ứng dụng Android sử dụng SDK của Firebase cho Android để gửi yêu cầu đến phần phụ trợ Firebase trên đám mây. Các yêu cầu được
    định tuyến đến Gemini Developer API,
    có thể tận dụng cả mô hình Gemini Pro và Flash.
Hình 1. Kiến trúc tích hợp Firebase AI Logic để truy cập vào Gemini Developer API.

Bắt đầu

Trước khi tương tác trực tiếp với Gemini API từ ứng dụng, bạn cần thực hiện một số việc trước, bao gồm cả việc làm quen với câu lệnh cũng như thiết lập Firebase và ứng dụng để sử dụng SDK.

Thử nghiệm câu lệnh

Việc thử nghiệm các câu lệnh có thể giúp bạn tìm ra cách diễn đạt, nội dung và định dạng phù hợp nhất cho ứng dụng Android của mình. Google AI Studio là một Môi trường phát triển tích hợp (IDE) mà bạn có thể dùng để tạo nguyên mẫu và thiết kế câu lệnh cho các trường hợp sử dụng của ứng dụng.

Để tạo câu lệnh hiệu quả cho trường hợp sử dụng của bạn, bạn cần phải thử nghiệm nhiều lần. Đây là một phần quan trọng trong quy trình. Bạn có thể tìm hiểu thêm về cách đặt câu lệnh trong tài liệu về Firebase.

Khi bạn hài lòng với câu lệnh của mình, hãy nhấp vào nút <> để lấy các đoạn mã mà bạn có thể thêm vào mã của mình.

Thiết lập dự án Firebase và kết nối ứng dụng với Firebase

Khi bạn đã sẵn sàng gọi API từ ứng dụng, hãy làm theo hướng dẫn trong "Bước 1" của hướng dẫn bắt đầu sử dụng Firebase AI Logic để thiết lập Firebase và bật các API cũng như dịch vụ cần thiết.

Thêm phần phụ thuộc Gradle

Thêm các phần phụ thuộc Gradle sau đây vào mô-đun ứng dụng:

Kotlin

dependencies {
  // ... other androidx dependencies

  // Import the BoM for the Firebase platform
  implementation(platform("com.google.firebase:firebase-bom:35.1.0"))

  // Add the dependencies for the Firebase AI Logic and App Check libraries
  // When using the BoM, you don't specify versions in Firebase library dependencies
  implementation("com.google.firebase:firebase-ai")
  implementation("com.google.firebase:firebase-appcheck-debug")
}

Java

dependencies {
  // Import the BoM for the Firebase platform
  implementation(platform("com.google.firebase:firebase-bom:35.1.0"))

  // Add the dependencies for the Firebase AI Logic and App Check libraries
  // When using the BoM, you don't specify versions in Firebase library dependencies
  implementation("com.google.firebase:firebase-ai")
  implementation("com.google.firebase:firebase-appcheck-debug")

  // Required for one-shot operations (to use `ListenableFuture` from Guava Android)
  implementation("com.google.guava:guava:31.0.1-android")

  // Required for streaming operations (to use `Publisher` from Reactive Streams)
  implementation("org.reactivestreams:reactive-streams:1.0.4")
}

Định cấu hình nhà cung cấp dịch vụ gỡ lỗi Kiểm tra ứng dụng cho hoạt động phát triển cục bộ

Kể từ đầu tháng 7 năm 2026, trong quy trình thiết lập có hướng dẫn cho AI Logic trong bảng điều khiển của Firebase, tính năng Kiểm tra ứng dụng Firebase sẽ tự động được thực thi để bảo vệ Gemini API. Để phát triển cục bộ, bạn cần định cấu hình nhà cung cấp dịch vụ gỡ lỗi của tính năng Kiểm tra ứng dụng để bỏ qua quy trình chứng thực trong khi vẫn duy trì việc thực thi tính năng Kiểm tra ứng dụng.

  1. Trong bản gỡ lỗi, hãy định cấu hình Kiểm tra ứng dụng để sử dụng nhà máy của nhà cung cấp dịch vụ gỡ lỗi:

    Kotlin

    Firebase.initialize(context = this)
    Firebase.appCheck.installAppCheckProviderFactory(
        DebugAppCheckProviderFactory.getInstance(),
    )
    

    Java

    FirebaseApp.initializeApp(/*context=*/ this);
    FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
    firebaseAppCheck.installAppCheckProviderFactory(
            DebugAppCheckProviderFactory.getInstance());
    
  2. Lấy mã thông báo gỡ lỗi:

    1. Chạy ứng dụng trong trình mô phỏng hoặc trên thiết bị thử nghiệm.

    2. Tìm mã thông báo gỡ lỗi Kiểm tra ứng dụng trong nhật ký. Ví dụ:

      D DebugAppCheckProvider: Enter this debug secret into the allow list
      in the Firebase Console for your project: 123a4567-b89c-12d3-e456-789012345678
      
    3. Sao chép mã thông báo (ví dụ: 123a4567-b89c-12d3-e456-789012345678).

  3. Đăng ký mã thông báo gỡ lỗi của bạn với tính năng Kiểm tra ứng dụng:

    1. Trong bảng điều khiển của Firebase, hãy chuyển đến thẻ Security (Bảo mật) > App Check (Kiểm tra ứng dụng) > Apps (Ứng dụng).

    2. Tìm ứng dụng của bạn, nhấp vào trình đơn mục bổ sung (), rồi chọn Manage debug tokens (Quản lý mã gỡ lỗi).

    3. Làm theo hướng dẫn trên màn hình để đăng ký mã thông báo gỡ lỗi.

Để biết thông tin chi tiết về nhà cung cấp dịch vụ gỡ lỗi (bao gồm cả cách lấy mã thông báo gỡ lỗi mới), hãy xem tài liệu chính thức về Kiểm tra ứng dụng.

Khởi chạy mô hình tạo sinh

Bắt đầu bằng cách tạo thực thể cho GenerativeModel và chỉ định tên mô hình:

Kotlin

// Start by instantiating a GenerativeModel and specifying the model name:
val model = Firebase.ai(backend = GenerativeBackend.googleAI())
    .generativeModel("gemini-3.5-flash")

Java

GenerativeModel firebaseAI = FirebaseAI.getInstance(GenerativeBackend.googleAI())
        .generativeModel("gemini-3.5-flash");

GenerativeModelFutures model = GenerativeModelFutures.from(firebaseAI);

Tìm hiểu thêm về các mô hình hiện có để sử dụng với Gemini Developer API. Bạn cũng có thể tìm hiểu thêm về cách định cấu hình tham số mô hình.

Tương tác với Gemini Developer API từ ứng dụng của bạn

Giờ đây, khi đã thiết lập Firebase và ứng dụng để sử dụng SDK, bạn đã sẵn sàng tương tác với Gemini Developer API từ ứng dụng của mình.

Tạo văn bản

Để tạo câu trả lời dạng văn bản, hãy gọi generateContent() bằng câu lệnh của bạn.

Kotlin

scope.launch {
    val response = model.generateContent("Write a story about a magic backpack.")
}

Java

Content prompt = new Content.Builder()
        .addText("Write a story about a magic backpack.")
        .build();

ListenableFuture<GenerateContentResponse> response = model.generateContent(prompt);
Futures.addCallback(response, new FutureCallback<GenerateContentResponse>() {
    @Override
    public void onSuccess(GenerateContentResponse result) {
        String resultText = result.getText();
    }

    @Override
    public void onFailure(Throwable t) {
        t.printStackTrace();
    }
}, executor);

Tạo văn bản do AI tạo từ hình ảnh và các nội dung nghe nhìn khác

Bạn cũng có thể tạo văn bản do AI tạo từ một câu lệnh bao gồm văn bản cùng với hình ảnh hoặc nội dung nghe nhìn khác. Khi gọi generateContent(), bạn có thể truyền nội dung nghe nhìn dưới dạng dữ liệu cùng dòng.

Ví dụ: để sử dụng bitmap, hãy dùng loại nội dung image:

Kotlin

scope.launch {
    val response = model.generateContent(
        content {
            image(bitmap)
            text("what is the object in the picture?")
        }
    )
}

Java

Content content = new Content.Builder()
        .addImage(bitmap)
        .addText("what is the object in the picture?")
        .build();

ListenableFuture<GenerateContentResponse> response = model.generateContent(content);
Futures.addCallback(response, new FutureCallback<GenerateContentResponse>() {
    @Override
    public void onSuccess(GenerateContentResponse result) {
        String resultText = result.getText();
    }

    @Override
    public void onFailure(Throwable t) {
        t.printStackTrace();
    }
}, executor);

Để truyền tệp âm thanh, hãy sử dụng loại nội dung inlineData:

Kotlin

scope.launch {
    val contentResolver = applicationContext.contentResolver
    contentResolver.openInputStream(audioUri).use { stream ->
        stream?.let {
            val bytes = it.readBytes()

            val prompt = content {
                inlineData(bytes, "audio/mpeg") // Specify the appropriate audio MIME type
                text("Transcribe this audio recording.")
            }

            val response = model.generateContent(prompt)
        }
    }
}

Java

ContentResolver resolver = applicationContext.getContentResolver();

try (InputStream stream = resolver.openInputStream(audioUri)) {
    File audioFile = new File(new URI(audioUri.toString()));
    int audioSize = (int) audioFile.length();
    byte[] audioBytes = new byte[audioSize];
    if (stream != null) {
        stream.read(audioBytes, 0, audioBytes.length);
        stream.close();

        // Provide a prompt that includes audio specified earlier and text
        Content prompt = new Content.Builder()
                .addInlineData(audioBytes, "audio/mpeg")  // Specify the appropriate audio MIME type
                .addText("Transcribe what's said in this audio recording.")
                .build();

        // To generate text output, call `generateContent` with the prompt
        ListenableFuture<GenerateContentResponse> response = model.generateContent(prompt);
        Futures.addCallback(response, new FutureCallback<GenerateContentResponse>() {
            @Override
            public void onSuccess(GenerateContentResponse result) {
                String text = result.getText();
                Log.d(TAG, (text == null) ? "" : text);
            }
            @Override
            public void onFailure(Throwable t) {
                Log.e(TAG, "Failed to generate a response", t);
            }
        }, executor);
    } else {
        Log.e(TAG, "Error getting input stream for file.");
        // Handle the error appropriately
    }
} catch (IOException e) {
    Log.e(TAG, "Failed to read the audio file", e);
} catch (URISyntaxException e) {
    Log.e(TAG, "Invalid audio file", e);
}

Để cung cấp tệp video, hãy tiếp tục sử dụng loại nội dung inlineData:

Kotlin

scope.launch {
    val contentResolver = applicationContext.contentResolver
    contentResolver.openInputStream(videoUri).use { stream ->
        stream?.let {
            val bytes = it.readBytes()

            val prompt = content {
                inlineData(bytes, "video/mp4") // Specify the appropriate video MIME type
                text("Describe the content of this video")
            }

            val response = model.generateContent(prompt)
        }
    }
}

Java

ContentResolver resolver = applicationContext.getContentResolver();

try (InputStream stream = resolver.openInputStream(videoUri)) {
    File videoFile = new File(new URI(videoUri.toString()));
    int videoSize = (int) videoFile.length();
    byte[] videoBytes = new byte[videoSize];
    if (stream != null) {
        stream.read(videoBytes, 0, videoBytes.length);
        stream.close();

        // Provide a prompt that includes video specified earlier and text
        Content prompt = new Content.Builder()
                .addInlineData(videoBytes, "video/mp4")
                .addText("Describe the content of this video")
                .build();

        // To generate text output, call generateContent with the prompt
        ListenableFuture<GenerateContentResponse> response = model.generateContent(prompt);
        Futures.addCallback(response, new FutureCallback<GenerateContentResponse>() {
            @Override
            public void onSuccess(GenerateContentResponse result) {
                String resultText = result.getText();
                System.out.println(resultText);
            }

            @Override
            public void onFailure(Throwable t) {
                t.printStackTrace();
            }
        }, executor);
    }
} catch (IOException e) {
    e.printStackTrace();
} catch (URISyntaxException e) {
    e.printStackTrace();
}

Tương tự, bạn cũng có thể truyền tài liệu PDF (application/pdf) và văn bản thuần túy (text/plain) bằng cách truyền Loại MIME tương ứng dưới dạng tham số.

Trò chuyện nhiều lượt

Bạn cũng có thể hỗ trợ các cuộc trò chuyện nhiều lượt. Khởi chạy một cuộc trò chuyện bằng hàm startChat(). Bạn có thể cung cấp cho mô hình nhật ký tin nhắn (không bắt buộc). Sau đó, hãy gọi hàm sendMessage() để gửi tin nhắn trò chuyện.

Kotlin

val chat = model.startChat(
    history = listOf(
        content(role = "user") { text("Hello, I have 2 dogs in my house.") },
        content(role = "model") { text("Great to meet you. What would you like to know?") }
    )
)

scope.launch {
    val response = chat.sendMessage("How many paws are in my house?")
}

Java

Content.Builder userContentBuilder = new Content.Builder();
userContentBuilder.setRole("user");
userContentBuilder.addText("Hello, I have 2 dogs in my house.");
Content userContent = userContentBuilder.build();

Content.Builder modelContentBuilder = new Content.Builder();
modelContentBuilder.setRole("model");
modelContentBuilder.addText("Great to meet you. What would you like to know?");
Content modelContent = modelContentBuilder.build();

List<Content> history = Arrays.asList(userContent, modelContent);

// Initialize the chat
ChatFutures chat = model.startChat(history);

// Create a new user message
Content.Builder messageBuilder = new Content.Builder();
messageBuilder.setRole("user");
messageBuilder.addText("How many paws are in my house?");

Content message = messageBuilder.build();

// Send the message
ListenableFuture<GenerateContentResponse> response = chat.sendMessage(message);
Futures.addCallback(response, new FutureCallback<GenerateContentResponse>() {
    @Override
    public void onSuccess(GenerateContentResponse result) {
        String resultText = result.getText();
        System.out.println(resultText);
    }

    @Override
    public void onFailure(Throwable t) {
        t.printStackTrace();
    }
}, executor);

Tạo hình ảnh trên Android bằng Nano Banana

Các mô hình Gemini Image (hay còn gọi là mô hình Nano Banana) có thể tạo và chỉnh sửa hình ảnh bằng cách tận dụng kiến thức và khả năng suy luận về thế giới. Các mô hình này tạo ra hình ảnh phù hợp với bối cảnh, kết hợp hoặc xen kẽ văn bản và hình ảnh một cách mượt mà. Mô hình này cũng có thể tạo hình ảnh chính xác với các chuỗi văn bản dài và hỗ trợ chỉnh sửa hình ảnh bằng ngôn ngữ tự nhiên trong khi vẫn duy trì ngữ cảnh.

Hướng dẫn này mô tả cách sử dụng các mô hình Gemini Image (mô hình Nano Banana) bằng SDK Firebase AI Logic cho Android. Tìm thêm thông tin chi tiết về việc tạo hình ảnh bằng Gemini trong tài liệu về Firebase.

Giao diện Google AI Studio cho thấy một trường nhập dữ liệu có câu lệnh &quot;Một bức ảnh siêu thực về một con khủng long bạo chúa đeo ba lô màu xanh dương đang lang thang trong một khu rừng thời tiền sử&quot; và một hình ảnh tạo sinh về một con khủng long bạo chúa trong rừng đeo ba lô màu xanh dương.
Hình 2. Dùng Google AI Studio để tinh chỉnh câu lệnh tạo hình ảnh bằng Nano Banana cho ứng dụng Android của bạn

Khởi chạy mô hình tạo sinh

Tạo thực thể cho GenerativeModel và chỉ định tên mô hình Gemini Image (chẳng hạn như gemini-3.1-flash-image). Sau đó, hãy định cấu hình responseModalities để bao gồm cả TEXT và IMAGE nhằm tạo văn bản và hình ảnh xen kẽ. Nếu bạn loại trừ TEXT, thì mô hình sẽ chỉ trả về hình ảnh.

Kotlin

val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
    modelName = "gemini-3.1-flash-image",
    // Configure the model to respond with images (required) and text (optional)
    generationConfig = generationConfig {
        responseModalities = listOf(
            ResponseModality.TEXT,
            ResponseModality.IMAGE
        )
    }
)

Java

GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI()).generativeModel(
        "gemini-3.1-flash-image",
        // Configure the model to respond with text and images (required)
        new GenerationConfig.Builder()
                .setResponseModalities(Arrays.asList(ResponseModality.TEXT, ResponseModality.IMAGE))
                .build()
);
GenerativeModelFutures model = GenerativeModelFutures.from(ai);

Tạo hình ảnh (chỉ nhập văn bản)

Bạn có thể hướng dẫn mô hình Gemini tạo hình ảnh bằng cách cung cấp câu lệnh chỉ có văn bản:

Kotlin

scope.launch {
    // Provide a text prompt instructing the model to generate an image
    val prompt =
        "A hyper realistic picture of a t-rex with a blue bag pack roaming a pre-historic forest."
    // To generate image output, call `generateContent` with the text input
    val generatedImageAsBitmap: Bitmap? = model.generateContent(prompt)
        .candidates.first().content.parts.filterIsInstance<ImagePart>()
        .firstOrNull()?.image
}

Java

// Provide a text prompt instructing the model to generate an image
Content prompt = new Content.Builder()
        .addText("Generate an image of the Eiffel Tower with fireworks in the background.")
        .build();
// To generate an image, call `generateContent` with the text input
ListenableFuture<GenerateContentResponse> response = model.generateContent(prompt);
Futures.addCallback(response, new FutureCallback<GenerateContentResponse>() {
    @Override
    public void onSuccess(GenerateContentResponse result) {
        // iterate over all the parts in the first candidate in the result object
        for (Part part : result.getCandidates().get(0).getContent().getParts()) {
            if (part instanceof ImagePart) {
                ImagePart imagePart = (ImagePart) part;
                // The returned image as a bitmap
                Bitmap generatedImageAsBitmap = imagePart.getImage();
                break;
            }
        }
    }
    @Override
    public void onFailure(Throwable t) {
        t.printStackTrace();
    }
}, executor);

Chỉnh sửa hình ảnh (nhập văn bản và hình ảnh)

Bạn có thể yêu cầu mô hình Gemini chỉnh sửa hình ảnh hiện có bằng cách cung cấp cả văn bản và một hoặc nhiều hình ảnh trong câu lệnh:

Kotlin

scope.launch {
    // Provide a text prompt instructing the model to edit the image
    val prompt = content {
        image(bitmap)
        text("Edit this image to make it look like a cartoon")
    }
    // To edit the image, call `generateContent` with the prompt (image and text input)
    val generatedImageAsBitmap: Bitmap? = model.generateContent(prompt)
        .candidates.first().content.parts.filterIsInstance<ImagePart>().firstOrNull()?.image
    // Handle the generated text and image
}

Java

// Provide an image for the model to edit
Bitmap bitmap = BitmapFactory.decodeResource(resources, R.drawable.scones);
// Provide a text prompt instructing the model to edit the image
Content promptcontent = new Content.Builder()
        .addImage(bitmap)
        .addText("Edit this image to make it look like a cartoon")
        .build();
// To edit the image, call `generateContent` with the prompt (image and text input)
ListenableFuture<GenerateContentResponse> response = model.generateContent(promptcontent);
Futures.addCallback(response, new FutureCallback<GenerateContentResponse>() {
    @Override
    public void onSuccess(GenerateContentResponse result) {
        // iterate over all the parts in the first candidate in the result object
        for (Part part : result.getCandidates().get(0).getContent().getParts()) {
            if (part instanceof ImagePart) {
                ImagePart imagePart = (ImagePart) part;
                Bitmap generatedImageAsBitmap = imagePart.getImage();
                break;
            }
        }
    }
    @Override
    public void onFailure(Throwable t) {
        t.printStackTrace();
    }
}, executor);

Lặp lại và chỉnh sửa hình ảnh thông qua cuộc trò chuyện nhiều lượt

Để chỉnh sửa hình ảnh theo cách trò chuyện, bạn có thể sử dụng tính năng trò chuyện nhiều lượt. Nhờ đó, bạn có thể đưa ra các yêu cầu tiếp theo để tinh chỉnh nội dung chỉnh sửa mà không cần gửi lại hình ảnh gốc.

Trước tiên, hãy khởi chạy một cuộc trò chuyện bằng startChat(), tuỳ ý cung cấp nhật ký tin nhắn. Sau đó, hãy sử dụng sendMessage() cho các thông báo tiếp theo:

Kotlin

scope.launch {
    // Create the initial prompt instructing the model to edit the image
    val prompt = content {
        image(bitmap)
        text("Edit this image to make it look like a cartoon")
    }
    // Initialize the chat
    val chat = model.startChat()
    // To generate an initial response, send a user message with the image and text prompt
    var response = chat.sendMessage(prompt)
    // Inspect the returned image
    var generatedImageAsBitmap: Bitmap? = response
        .candidates.first().content.parts.filterIsInstance<ImagePart>().firstOrNull()?.image
    // Follow up requests do not need to specify the image again
    response = chat.sendMessage("But make it old-school line drawing style")
    generatedImageAsBitmap = response
        .candidates.first().content.parts.filterIsInstance<ImagePart>().firstOrNull()?.image
}

Java

// Provide an image for the model to edit
Bitmap bitmap = BitmapFactory.decodeResource(resources, R.drawable.scones);
// Initialize the chat
ChatFutures chat = model.startChat();
// Create the initial prompt instructing the model to edit the image
Content prompt = new Content.Builder()
        .setRole("user")
        .addImage(bitmap)
        .addText("Edit this image to make it look like a cartoon")
        .build();
// To generate an initial response, send a user message with the image and text prompt
ListenableFuture<GenerateContentResponse> response = chat.sendMessage(prompt);
// Extract the image from the initial response
ListenableFuture<Bitmap> initialRequest = Futures.transform(response,
        result -> {
            for (Part part : result.getCandidates().get(0).getContent().getParts()) {
                if (part instanceof ImagePart) {
                    ImagePart imagePart = (ImagePart) part;
                    return imagePart.getImage();
                }
            }
            return null;
        }, executor);
// Follow up requests do not need to specify the image again
ListenableFuture<GenerateContentResponse> modelResponseFuture = Futures.transformAsync(
        initialRequest,
        generatedImage -> {
            Content followUpPrompt = new Content.Builder()
                    .addText("But make it old-school line drawing style")
                    .build();
            return chat.sendMessage(followUpPrompt);
        }, executor);
// Add a final callback to check the reworked image
Futures.addCallback(modelResponseFuture, new FutureCallback<GenerateContentResponse>() {
    @Override
    public void onSuccess(GenerateContentResponse result) {
        for (Part part : result.getCandidates().get(0).getContent().getParts()) {
            if (part instanceof ImagePart) {
                ImagePart imagePart = (ImagePart) part;
                Bitmap generatedImageAsBitmap = imagePart.getImage();
                break;
            }
        }
    }
    @Override
    public void onFailure(Throwable t) {
        t.printStackTrace();
    }
}, executor);

Những điểm cần lưu ý và hạn chế

Hãy lưu ý những điểm cần cân nhắc và hạn chế sau:

  • Định dạng đầu ra: Hình ảnh được tạo dưới dạng PNG với kích thước tối đa là 1024 px.
  • Loại dữ liệu đầu vào: Mô hình này không hỗ trợ dữ liệu đầu vào dạng âm thanh hoặc video để tạo hình ảnh.
  • Hỗ trợ ngôn ngữ: Để có hiệu suất tốt nhất, hãy sử dụng các ngôn ngữ sau: Tiếng Anh (en), tiếng Tây Ban Nha Mexico (es-mx), tiếng Nhật (ja-jp), tiếng Trung giản thể (zh-cn) và tiếng Hindi (hi-in).
  • Vấn đề về việc tạo:
    • Tính năng tạo hình ảnh có thể không phải lúc nào cũng được kích hoạt, đôi khi chỉ cho ra kết quả dạng văn bản. Hãy thử yêu cầu rõ ràng về kết quả hình ảnh (ví dụ: "tạo hình ảnh", "cung cấp hình ảnh khi bạn thực hiện", "cập nhật hình ảnh").
    • Mô hình có thể ngừng tạo giữa chừng. Hãy thử lại hoặc thử một câu lệnh khác.
    • Mô hình có thể tạo văn bản dưới dạng hình ảnh. Hãy thử yêu cầu rõ ràng về kết quả dạng văn bản (ví dụ: "tạo văn bản tường thuật cùng với hình minh hoạ").

Để biết thêm thông tin, hãy xem tài liệu về Firebase.

Các bước tiếp theo

Sau khi thiết lập ứng dụng, hãy cân nhắc các bước tiếp theo sau đây: