การเรียกใช้โค้ด

การเรียกใช้โค้ดเป็นเครื่องมือที่ช่วยให้โมเดลสร้างและเรียกใช้โค้ด Python ได้ โมเดลสามารถเรียนรู้ซ้ำๆ จากผลลัพธ์การเรียกใช้โค้ดจนกว่าจะได้เอาต์พุตสุดท้าย

คุณสามารถใช้การเรียกใช้โค้ดเพื่อสร้างฟีเจอร์ที่ได้ประโยชน์จากการให้เหตุผลตามโค้ดและสร้างเอาต์พุตข้อความ เช่น คุณสามารถใช้การเรียกใช้โค้ดเพื่อแก้สมการหรือประมวลผลข้อความ นอกจากนี้ คุณยังใช้ไลบรารีที่รวมอยู่ในสภาพแวดล้อมการเรียกใช้โค้ดเพื่อทำงานที่เฉพาะเจาะจงมากขึ้นได้ด้วย

โมเดลจะเป็นผู้ตัดสินใจว่าจะใช้การเรียกใช้โค้ดเมื่อใด เช่นเดียวกับเครื่องมือทั้งหมดที่คุณมอบให้โมเดล

ข้ามไปที่การติดตั้งใช้งานโค้ด

การเปรียบเทียบการเรียกใช้โค้ดกับการเรียกใช้ฟังก์ชัน

การเรียกใช้โค้ดและการเรียกใช้ฟังก์ชันเป็นฟีเจอร์ที่คล้ายกัน โดยทั่วไป คุณควรเลือกใช้การเรียกใช้โค้ดหากโมเดลสามารถจัดการ Use Case ของคุณได้ นอกจากนี้ การเรียกใช้โค้ดยังใช้งานได้ง่ายกว่าเนื่องจากคุณเพียงแค่เปิดใช้เท่านั้น

ความแตกต่างเพิ่มเติมระหว่างการเรียกใช้โค้ดและการเรียกใช้ฟังก์ชันมีดังนี้

การเรียกใช้โค้ด การเรียกใช้ฟังก์ชัน
ใช้การเรียกใช้โค้ดหากต้องการให้โมเดลเขียนและเรียกใช้โค้ด Python ให้คุณและแสดงผลลัพธ์ ใช้การเรียกใช้ฟังก์ชันหากคุณมีฟังก์ชันของตัวเองที่ต้องการเรียกใช้ในเครื่องอยู่แล้ว
การเรียกใช้โค้ดช่วยให้โมเดลเรียกใช้โค้ดในแบ็กเอนด์ของ API ในสภาพแวดล้อมที่แยกต่างหากและคงที่ได้ การเรียกใช้ฟังก์ชันช่วยให้คุณเรียกใช้ฟังก์ชันที่โมเดลขอได้ในสภาพแวดล้อมที่ต้องการ
การเรียกใช้โค้ดจะได้รับการแก้ไขในคำขอเดียว แม้ว่าคุณจะเลือกใช้การเรียกใช้โค้ดกับความสามารถในการแชทได้ แต่ก็ไม่มีข้อกำหนดใดๆ การเรียกใช้ฟังก์ชันต้องใช้คำขอเพิ่มเติมเพื่อส่งเอาต์พุตจากการเรียกใช้ฟังก์ชันแต่ละครั้งกลับมา ดังนั้น คุณจึงต้องใช้ความสามารถในการแชท

โมเดลที่รองรับ

  • gemini-4-argon
  • gemini-3.8-flash (และ gemini-3.7-flash, gemini-3.6-flash และ gemini-3.5-flash รุ่นเก่า)
  • gemini-3.5-flash-lite (และ gemini-3.1-flash-lite รุ่นเก่า)

โมเดล gemini-3.1-pro-preview และโมเดล Gemini 2.5 สำหรับการใช้งานทั่วไป (ซึ่งเลิกใช้งานแล้ว) ก็รองรับความสามารถนี้เช่นกัน

ใช้การเรียกใช้โค้ด

คุณสามารถใช้การเรียกใช้โค้ดกับทั้งอินพุตแบบข้อความเท่านั้นและแบบหลายโมดัล แต่คำตอบจะเป็นข้อความหรือโค้ดเท่านั้นเสมอ

ก่อนเริ่มต้น

คลิกผู้ให้บริการ Gemini API เพื่อดูเนื้อหาและโค้ดเฉพาะของผู้ให้บริการในหน้านี้

หากยังไม่ได้ดำเนินการ โปรดอ่านคู่มือเริ่มต้นใช้งานให้จบ ซึ่งจะอธิบายวิธีตั้งค่าโปรเจ็กต์ Firebase, เชื่อมต่อแอปกับ Firebase, เพิ่ม SDK, เริ่มต้นบริการแบ็กเอนด์สำหรับผู้ให้บริการ Gemini API ที่คุณเลือก และสร้างอินสแตนซ์ GenerativeModel

สำหรับการทดสอบและปรับปรุงพรอมต์ซ้ำๆ เราขอแนะนำให้ใช้ Google AI Studio

เปิดใช้การเรียกใช้โค้ด

ก่อนลองใช้ตัวอย่างนี้ ให้ทำตามส่วนก่อนเริ่มต้นของคู่มือนี้เพื่อตั้งค่าโปรเจ็กต์และแอป
ในส่วนนั้น คุณจะต้องคลิกปุ่มสำหรับผู้ให้บริการ Gemini API ที่เลือกด้วยเพื่อให้เห็นเนื้อหาเฉพาะผู้ให้บริการในหน้านี้

เมื่อสร้างอินสแตนซ์ GenerativeModel ให้ระบุ CodeExecution เป็นเครื่องมือที่โมเดลสามารถใช้เพื่อสร้างคำตอบ ซึ่งจะช่วยให้โมเดลสร้างและรันโค้ด Python ได้

Swift


import FirebaseAILogic

// Initialize the Gemini Developer API backend service.
let ai = FirebaseAI.firebaseAI(backend: .googleAI())

// Create a `GenerativeModel` instance with a model that supports your use case
let model = ai.generativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Provide code execution as a tool that the model can use to generate its response.
  tools: [.codeExecution()]
)

let prompt = """
What is the sum of the first 50 prime numbers?
Generate and run code for the calculation, and make sure you get all 50.
"""

let response = try await model.generateContent(prompt)

guard let candidate = response.candidates.first else {
  print("No candidates in response.")
  return
}
for part in candidate.content.parts {
  if let textPart = part as? TextPart {
    print("Text = \(textPart.text)")
  } else if let executableCode = part as? ExecutableCodePart {
    print("Code = \(executableCode.code), Language = \(executableCode.language)")
  } else if let executionResult = part as? CodeExecutionResultPart {
    print("Outcome = \(executionResult.outcome), Result = \(executionResult.output ?? "no output")")
  }
}

Kotlin


// Initialize the Gemini Developer API backend service.
// Create a `GenerativeModel` instance with a model that supports your use case.
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
    modelName = "GEMINI_MODEL_NAME",
    // Provide code execution as a tool that the model can use to generate its response.
    tools = listOf(Tool.codeExecution())
)

val prompt =  "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50."

val response = model.generateContent(prompt)

response.candidates.first().content.parts.forEach {
    if(it is TextPart) {
        println("Text = ${it.text}")
    }
    if(it is ExecutableCodePart) {
        println("Code = ${it.code}, Language = ${it.language}")
    }
    if(it is CodeExecutionResultPart) {
       println("Outcome = ${it.outcome}, Result = ${it.output}")
    }
}

Java


// Initialize the Gemini Developer API backend service.
// Create a `GenerativeModel` instance with a model that supports your use case.
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
                .generativeModel("GEMINI_MODEL_NAME",
                        null,
                        null,
                        // Provide code execution as a tool that the model can use to generate its response.
                        List.of(Tool.codeExecution()));

// Use the GenerativeModelFutures Java compatibility layer which offers
// support for ListenableFuture and Publisher APIs
GenerativeModelFutures model = GenerativeModelFutures.from(ai);

String text = "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50.";

Content prompt = new Content.Builder()
    .addText(text)
    .build();

ListenableFuture response = model.generateContent(prompt);

Futures.addCallback(response, new FutureCallback() {
   @Override
public void onSuccess(GenerateContentResponse response)   {
    // Access the first candidate's content parts
    List parts = response.getCandidates().get(0).getContent().getParts();
    for (Part part : parts) {
        if (part instanceof TextPart) {
            TextPart textPart = (TextPart) part;
            System.out.println("Text = " + textPart.getText());
        } else if (part instanceof ExecutableCodePart) {
            ExecutableCodePart codePart = (ExecutableCodePart) part;
            System.out.println("Code = " + codePart.getCode() + ", Language = " + codePart.getLanguage());
        } else if (part instanceof CodeExecutionResultPart) {
            CodeExecutionResultPart resultPart = (CodeExecutionResultPart) part;
            System.out.println("Outcome = " + resultPart.getOutcome() + ", Result = " + resultPart.getOutput());
        }
    }
}

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

Web


import { initializeApp } from "firebase/app";
import { getAI, getGenerativeModel, GoogleAIBackend } from "firebase/ai";

// TODO(developer): Replace the following with your app's Firebase configuration
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
  // ...
};

// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);

// Initialize the Gemini Developer API backend service.
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });

// Create a `GenerativeModel` instance with a model that supports your use case.
const model = getGenerativeModel(
  ai,
  {
    model: "GEMINI_MODEL_NAME",
    // Provide code execution as a tool that the model can use to generate its response.
    tools: [{ codeExecution: {} }]
  }
);

const prompt =  "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50."

const result = await model.generateContent(prompt);
const response = await result.response;

const parts = response.candidates?.[0].content.parts;

if (parts) {
  parts.forEach((part) => {
    if (part.type === "text") {
      console.log(`Text: ${part.text}`);
    } else if (part.type === "executableCode") {
      console.log(
        `Code: ${part.executableCode.code}, Language: ${part.executableCode.language}`
      );
    } else if (part.type === "codeExecutionResult") {
      console.log(
        `Outcome: ${part.codeExecutionResult.outcome}, Result: ${part.codeExecutionResult.output}`
      );
    }
  });
}

Dart


import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_ai/firebase_ai.dart';
import 'firebase_options.dart';

// Initialize FirebaseApp
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

// Initialize the Gemini Developer API backend service.
// Create a `GenerativeModel` instance with a model that supports your use case.
final model = FirebaseAI.googleAI().generativeModel(
  model: 'GEMINI_MODEL_NAME',
  // Provide code execution as a tool that the model can use to generate its response.
  tools: [
    Tool.codeExecution(),
  ],
);

const prompt = 'What is the sum of the first 50 prime numbers? '
    'Generate and run code for the calculation, and make sure you get all 50.';

final response = await model.generateContent([Content.text(prompt)]);

final buffer = StringBuffer();
    for (final part in response.candidates.first.content.parts) {
      if (part is TextPart) {
        buffer.writeln(part.text);
      } else if (part is ExecutableCodePart) {
        buffer.writeln('Executable Code:');
        buffer.writeln('Language: ${part.language}');
        buffer.writeln('Code:');
        buffer.writeln(part.code);
      } else if (part is CodeExecutionResultPart) {
        buffer.writeln('Code Execution Result:');
        buffer.writeln('Outcome: ${part.outcome}');
        buffer.writeln('Output:');
        buffer.writeln(part.output);
      }
    }

Unity


using Firebase;
using Firebase.AI;

// Initialize the Gemini Developer API backend service.
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());

// Create a `GenerativeModel` instance with a model that supports your use case.
var model = ai.GetGenerativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Provide code execution as a tool that the model can use to generate its response.
  tools: new Tool[] { new Tool(new CodeExecution()) }
);

var prompt = "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50.";

var response = await model.GenerateContentAsync(prompt);

foreach (var part in response.Candidates.First().Content.Parts) {
  if (part is ModelContent.TextPart tp) {
    UnityEngine.Debug.Log($"Text = {tp.Text}");
  } else if (part is ModelContent.ExecutableCodePart esp) {
    UnityEngine.Debug.Log($"Code = {esp.Code}, Language = {esp.Language}");
  } else if (part is ModelContent.CodeExecutionResultPart cerp) {
    UnityEngine.Debug.Log($"Outcome = {cerp.Outcome}, Output = {cerp.Output}");
  }
}

ดูวิธีเลือกโมเดล ที่เหมาะกับ Use Case และแอปของคุณ

ใช้การเรียกใช้โค้ดในแชท

นอกจากนี้ คุณยังใช้การเรียกใช้โค้ดเป็นส่วนหนึ่งของแชทได้ด้วย โดยทำดังนี้

Swift


import FirebaseAILogic

// Initialize the Gemini Developer API backend service.
let ai = FirebaseAI.firebaseAI(backend: .googleAI())

// Create a `GenerativeModel` instance with a model that supports your use case
let model = ai.generativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Provide code execution as a tool that the model can use to generate its response.
  tools: [.codeExecution()]
)

let prompt = """
What is the sum of the first 50 prime numbers?
Generate and run code for the calculation, and make sure you get all 50.
"""
let chat = model.startChat()

let response = try await chat.sendMessage(prompt)

guard let candidate = response.candidates.first else {
  print("No candidates in response.")
  return
}
for part in candidate.content.parts {
  if let textPart = part as? TextPart {
    print("Text = \(textPart.text)")
  } else if let executableCode = part as? ExecutableCodePart {
    print("Code = \(executableCode.code), Language = \(executableCode.language)")
  } else if let executionResult = part as? CodeExecutionResultPart {
    print("Outcome = \(executionResult.outcome), Result = \(executionResult.output ?? "no output")")
  }
}

Kotlin


// Initialize the Gemini Developer API backend service.
// Create a `GenerativeModel` instance with a model that supports your use case.
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
    modelName = "GEMINI_MODEL_NAME",
    // Provide code execution as a tool that the model can use to generate its response.
    tools = listOf(Tool.codeExecution())
)

val prompt =  "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50."
val chat = model.startChat()
val response = chat.sendMessage(prompt)

response.candidates.first().content.parts.forEach {
    if(it is TextPart) {
        println("Text = ${it.text}")
    }
    if(it is ExecutableCodePart) {
        println("Code = ${it.code}, Language = ${it.language}")
    }
    if(it is CodeExecutionResultPart) {
       println("Outcome = ${it.outcome}, Result = ${it.output}")
    }
}

Java


// Initialize the Gemini Developer API backend service.
// Create a `GenerativeModel` instance with a model that supports your use case.
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
                .generativeModel("GEMINI_MODEL_NAME",
                        null,
                        null,
                        // Provide code execution as a tool that the model can use to generate its response.
                        List.of(Tool.codeExecution()));

// Use the GenerativeModelFutures Java compatibility layer which offers
// support for ListenableFuture and Publisher APIs
GenerativeModelFutures model = GenerativeModelFutures.from(ai);
String text = "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50.";

Content prompt = new Content.Builder()
    .addText(text)
    .build();

ChatFutures chat = model.startChat();
ListenableFuture response = chat.sendMessage(prompt);

Futures.addCallback(response, new FutureCallback() {
   @Override
public void onSuccess(GenerateContentResponse response)   {
    // Access the first candidate's content parts
    List parts = response.getCandidates().get(0).getContent().getParts();
    for (Part part : parts) {
        if (part instanceof TextPart) {
            TextPart textPart = (TextPart) part;
            System.out.println("Text = " + textPart.getText());
        } else if (part instanceof ExecutableCodePart) {
            ExecutableCodePart codePart = (ExecutableCodePart) part;
            System.out.println("Code = " + codePart.getCode() + ", Language = " + codePart.getLanguage());
        } else if (part instanceof CodeExecutionResultPart) {
            CodeExecutionResultPart resultPart = (CodeExecutionResultPart) part;
            System.out.println("Outcome = " + resultPart.getOutcome() + ", Result = " + resultPart.getOutput());
        }
    }
}

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

Web


import { initializeApp } from "firebase/app";
import { getAI, getGenerativeModel, GoogleAIBackend } from "firebase/ai";

// TODO(developer): Replace the following with your app's Firebase configuration
// See: https://firebase.google.com/docs/web/learn-more#config-object
const firebaseConfig = {
  // ...
};

// Initialize FirebaseApp
const firebaseApp = initializeApp(firebaseConfig);

// Initialize the Gemini Developer API backend service.
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });

// Create a `GenerativeModel` instance with a model that supports your use case.
const model = getGenerativeModel(
  ai,
  {
    model: "GEMINI_MODEL_NAME",
    // Provide code execution as a tool that the model can use to generate its response.
    tools: [{ codeExecution: {} }]
  }
);

const prompt =  "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50."
const chat = model.startChat()
const result = await chat.sendMessage(prompt);

const parts = result.response.candidates?.[0].content.parts;

if (parts) {
  parts.forEach((part) => {
    if (part.type === "text") {
      console.log(`Text: ${part.text}`);
    } else if (part.type === "executableCode") {
      console.log(
        `Code: ${part.executableCode.code}, Language: ${part.executableCode.language}`
      );
    } else if (part.type === "codeExecutionResult") {
      console.log(
        `Outcome: ${part.codeExecutionResult.outcome}, Result: ${part.codeExecutionResult.output}`
      );
    }
  });
}

Dart


import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_ai/firebase_ai.dart';
import 'firebase_options.dart';

// Initialize FirebaseApp
await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

// Initialize the Gemini Developer API backend service.
// Create a `GenerativeModel` instance with a model that supports your use case.
final model = FirebaseAI.googleAI().generativeModel(
  model: 'GEMINI_MODEL_NAME',
  // Provide code execution as a tool that the model can use to generate its response.
  tools: [
    Tool.codeExecution(),
  ],
);

final codeExecutionChat = await model.startChat();

const prompt = 'What is the sum of the first 50 prime numbers? '
    'Generate and run code for the calculation, and make sure you get all 50.';
final response = await codeExecutionChat.sendMessage(Content.text(prompt));

final buffer = StringBuffer();
    for (final part in response.candidates.first.content.parts) {
      if (part is TextPart) {
        buffer.writeln(part.text);
      } else if (part is ExecutableCodePart) {
        buffer.writeln('Executable Code:');
        buffer.writeln('Language: ${part.language}');
        buffer.writeln('Code:');
        buffer.writeln(part.code);
      } else if (part is CodeExecutionResultPart) {
        buffer.writeln('Code Execution Result:');
        buffer.writeln('Outcome: ${part.outcome}');
        buffer.writeln('Output:');
        buffer.writeln(part.output);
      }
    }

Unity


using Firebase;
using Firebase.AI;

// Initialize the Gemini Developer API backend service.
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());

// Create a `GenerativeModel` instance with a model that supports your use case.
var model = ai.GetGenerativeModel(
  modelName: "GEMINI_MODEL_NAME",
  // Provide code execution as a tool that the model can use to generate its response.
  tools: new Tool[] { new Tool(new CodeExecution()) }
);

var prompt = "What is the sum of the first 50 prime numbers? " +
        "Generate and run code for the calculation, and make sure you get all 50.";
var chat = model.StartChat();
var response = await chat.SendMessageAsync(prompt);

foreach (var part in response.Candidates.First().Content.Parts) {
  if (part is ModelContent.TextPart tp) {
    UnityEngine.Debug.Log($"Text = {tp.Text}");
  } else if (part is ModelContent.ExecutableCodePart esp) {
    UnityEngine.Debug.Log($"Code = {esp.Code}, Language = {esp.Language}");
  } else if (part is ModelContent.CodeExecutionResultPart cerp) {
    UnityEngine.Debug.Log($"Outcome = {cerp.Outcome}, Output = {cerp.Output}");
  }
}

ดูวิธีเลือกโมเดล ที่เหมาะกับ Use Case และแอปของคุณ

ราคา

ไม่มีค่าใช้จ่ายเพิ่มเติมสำหรับการเปิดใช้การเรียกใช้โค้ดและจัดเตรียมให้เป็นเครื่องมือสำหรับโมเดล หากโมเดลตัดสินใจใช้การเรียกใช้โค้ด ระบบจะเรียกเก็บเงินจากคุณตามอัตราปัจจุบันของโทเค็นอินพุตและเอาต์พุตโดยอิงตามโมเดล Gemini ที่คุณใช้

แผนภาพต่อไปนี้แสดงรูปแบบการเรียกเก็บเงินสำหรับการเรียกใช้โค้ด

แผนภาพแสดงวิธีเรียกเก็บเงินสำหรับโทเค็นเมื่อโมเดลใช้การเรียกใช้โค้ด 

สรุปวิธีเรียกเก็บเงินสำหรับโทเค็นเมื่อโมเดลใช้การเรียกใช้โค้ดมีดังนี้

  • ระบบจะเรียกเก็บเงินสำหรับพรอมต์เดิมเพียงครั้งเดียว โทเค็นของโมเดลนี้จะมีป้ายกำกับเป็นโทเค็นระหว่างการประมวลผล ซึ่งจะเรียกเก็บเงินเป็นโทเค็นอินพุต

  • ระบบจะเรียกเก็บเงินสำหรับโค้ดที่สร้างขึ้นและผลลัพธ์ของโค้ดที่เรียกใช้ดังนี้

    • เมื่อใช้ระหว่างการเรียกใช้โค้ด ระบบจะติดป้ายกำกับเป็นโทเค็นระหว่างการประมวลผลซึ่งจะเรียกเก็บเงินเป็นโทเค็นอินพุต

    • เมื่อรวมเป็นส่วนหนึ่งของคำตอบสุดท้าย ระบบจะเรียกเก็บเงินเป็นโทเค็นเอาต์พุต

  • สรุปสุดท้ายในการตอบกลับขั้นสุดท้ายจะเรียกเก็บเงินเป็นโทเค็นเอาต์พุต

Gemini API จะรวมจำนวนโทเค็นระหว่างการประมวลผลไว้ในการตอบกลับจาก API เพื่อให้คุณทราบสาเหตุที่ระบบเรียกเก็บเงินสำหรับโทเค็นอินพุตที่เกินจากพรอมต์เริ่มต้น

โปรดทราบว่าโค้ดที่สร้างขึ้นอาจมีทั้งข้อความและเอาต์พุตแบบสื่อผสม เช่น รูปภาพ

ข้อจำกัดและแนวทางปฏิบัติแนะนำ

  • โมเดลจะสร้างและเรียกใช้ได้เฉพาะโค้ด Python เท่านั้น แต่จะแสดงอาร์ติแฟกต์อื่นๆ เช่น ไฟล์สื่อไม่ได้

  • การเรียกใช้โค้ดจะทำงานได้สูงสุด 30 วินาทีก่อนที่จะหมดเวลา

  • ในบางกรณี การเปิดใช้การเรียกใช้โค้ดอาจทำให้เกิดการถดถอยในด้านอื่นๆ ของเอาต์พุตโมเดล (เช่น การเขียนเรื่องราว)

  • เครื่องมือเรียกใช้โค้ดไม่รองรับ URI ของไฟล์เป็นอินพุต/เอาต์พุต อย่างไรก็ตาม เครื่องมือเรียกใช้โค้ดรองรับอินพุตไฟล์และเอาต์พุตกราฟเป็นไบต์แบบอินไลน์ การใช้ความสามารถด้านอินพุตและเอาต์พุตเหล่านี้ช่วยให้คุณอัปโหลดไฟล์ CSV และไฟล์ข้อความ ถามคำถามเกี่ยวกับไฟล์ และสร้างกราฟ Matplotlib เป็นส่วนหนึ่งของผลลัพธ์การเรียกใช้โค้ดได้ ประเภท MIME ที่รองรับสำหรับไบต์ที่แทรกในบรรทัด ได้แก่ .cpp, .csv, .java, .jpeg, .js, .png, .py, .ts และ .xml

ไลบรารีที่รองรับ

สภาพแวดล้อมการเรียกใช้โค้ดประกอบด้วยไลบรารีต่อไปนี้ คุณไม่สามารถติดตั้งไลบรารีของคุณเองได้


แสดงความคิดเห็นเกี่ยวกับประสบการณ์การใช้งาน Firebase AI Logic