ใช้การกําหนดค่าโมเดลเพื่อควบคุมคําตอบ

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

นอกจากนี้ คุณยังทดลองใช้พรอมต์และการกำหนดค่าโมเดลได้โดยใช้ Google AI Studio

ไปที่ตัวเลือกการกำหนดค่า Gemini ไปที่ตัวเลือกการกำหนดค่า Imagen (เลิกใช้งานแล้ว)



กำหนดค่าโมเดล Gemini

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

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

ตั้งค่าการกำหนดค่าโมเดล (Gemini)

การกำหนดค่าสำหรับ Gemini Use Case ทั่วไป

ระบบจะเก็บรักษาการกำหนดค่าไว้ตลอดอายุการใช้งานของอินสแตนซ์ หากต้องการใช้การกำหนดค่าอื่น ให้สร้างอินสแตนซ์ GenerativeModel ใหม่ด้วยการกำหนดค่าดังกล่าว

Swift

ตั้งค่าพารามิเตอร์ใน GenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ GenerativeModel


import FirebaseAILogic

// Set parameter values in a `GenerationConfig`.
// IMPORTANT: Example values shown here. Make sure to update for your use case.
let config = GenerationConfig(
  candidateCount: 1,
  temperature: 0.9,
  topP: 0.1,
  topK: 16,
  maxOutputTokens: 200,
  stopSequences: ["red"]
)

// Initialize the Gemini Developer API backend service
// Specify the config as part of creating the `GenerativeModel` instance
let model = FirebaseAI.firebaseAI(backend: .googleAI()).generativeModel(
  modelName: "GEMINI_MODEL_NAME",
  generationConfig: config
)

// ...

Kotlin

ตั้งค่าพารามิเตอร์ใน GenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ GenerativeModel


// ...

// Set parameter values in a `GenerationConfig`.
// IMPORTANT: Example values shown here. Make sure to update for your use case.
val config = generationConfig {
    candidateCount = 1
    maxOutputTokens = 200
    stopSequences = listOf("red")
    temperature = 0.9f
    topK = 16
    topP = 0.1f
}

// Initialize the Gemini Developer API backend service
// Specify the config as part of creating the `GenerativeModel` instance
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
    modelName = "GEMINI_MODEL_NAME",
    generationConfig = config
)

// ...

Java

ตั้งค่าพารามิเตอร์ใน GenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ GenerativeModel


// ...

// Set parameter values in a `GenerationConfig`.
// IMPORTANT: Example values shown here. Make sure to update for your use case.
GenerationConfig.Builder configBuilder = new GenerationConfig.Builder();
configBuilder.candidateCount = 1;
configBuilder.maxOutputTokens = 200;
configBuilder.stopSequences = List.of("red");
configBuilder.temperature = 0.9f;
configBuilder.topK = 16;
configBuilder.topP = 0.1f;

GenerationConfig config = configBuilder.build();

// Specify the config as part of creating the `GenerativeModel` instance
GenerativeModelFutures model = GenerativeModelFutures.from(
        FirebaseAI.getInstance(GenerativeBackend.googleAI())
                .generativeModel(
                    "GEMINI_MODEL_NAME",
                    config
                );
);

// ...

Web

ตั้งค่าพารามิเตอร์ใน GenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ GenerativeModel


// ...

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

// Set parameter values in a `GenerationConfig`.
// IMPORTANT: Example values shown here. Make sure to update for your use case.
const generationConfig = {
  candidate_count: 1,
  maxOutputTokens: 200,
  stopSequences: ["red"],
  temperature: 0.9,
  topP: 0.1,
  topK: 16,
};

// Specify the config as part of creating the `GenerativeModel` instance
const model = getGenerativeModel(ai, { model: "GEMINI_MODEL_NAME",  generationConfig });

// ...

Dart

ตั้งค่าพารามิเตอร์ใน GenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ GenerativeModel


// ...

// Set parameter values in a `GenerationConfig`.
// IMPORTANT: Example values shown here. Make sure to update for your use case.
final generationConfig = GenerationConfig(
  candidateCount: 1,
  maxOutputTokens: 200,
  stopSequences: ["red"],
  temperature: 0.9,
  topP: 0.1,
  topK: 16,
);

// Initialize the Gemini Developer API backend service
// Specify the config as part of creating the `GenerativeModel` instance
final model = FirebaseAI.googleAI().generativeModel(
  model: 'GEMINI_MODEL_NAME',
  config: generationConfig,
);

// ...

Unity

ตั้งค่าพารามิเตอร์ใน GenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ GenerativeModel


// ...

// Set parameter values in a `GenerationConfig`.
// IMPORTANT: Example values shown here. Make sure to update for your use case.
var generationConfig = new GenerationConfig(
  candidateCount: 1,
  maxOutputTokens: 200,
  stopSequences: new string[] { "red" },
  temperature: 0.9f,
  topK: 16,
  topP: 0.1f
);

// Specify the config as part of creating the `GenerativeModel` instance
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());
var model = ai.GetGenerativeModel(
  modelName: "GEMINI_MODEL_NAME",
  generationConfig: generationConfig
);

คุณดูคำอธิบายของพารามิเตอร์แต่ละรายการได้ในส่วนถัดไปของหน้านี้

การกำหนดค่าสำหรับ Gemini Live API

ระบบจะเก็บรักษาการกำหนดค่าไว้ตลอดอายุการใช้งานของอินสแตนซ์ หากต้องการใช้การกำหนดค่าอื่น ให้สร้างอินสแตนซ์ LiveModel ใหม่ด้วยการกำหนดค่าดังกล่าว

Swift

ตั้งค่าพารามิเตอร์ใน liveGenerationConfig ระหว่างการเริ่มต้นอินสแตนซ์ LiveModel โดยทำดังนี้


// ...

// Set parameter values in a `LiveGenerationConfig` (example values shown here)
let config = LiveGenerationConfig(
  temperature: 0.9,
  topP: 0.1,
  topK: 16,
  maxOutputTokens: 200,
  responseModalities: [.audio],
  speech: SpeechConfig(voiceName: "Fenrir"),
)

// Specify the config as part of creating the `liveModel` instance
let liveModel = FirebaseAI.firebaseAI(backend: .googleAI()).liveModel(
  modelName: "GEMINI_LIVE_MODEL_NAME",
  generationConfig: config
)

// ...

Kotlin

ตั้งค่าพารามิเตอร์ใน LiveGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ LiveModel


// ...

// Set parameter values in a `LiveGenerationConfig` (example values shown here)
val config = liveGenerationConfig {
    maxOutputTokens = 200
    responseModality = ResponseModality.AUDIO
    speechConfig = SpeechConfig(voice = Voices.FENRIR)
    temperature = 0.9f
    topK = 16
    topP = 0.1f
}

// Specify the config as part of creating the `LiveModel` instance
val liveModel = Firebase.ai(backend = GenerativeBackend.googleAI()).liveModel(
    modelName = "GEMINI_LIVE_MODEL_NAME",
    generationConfig = config
)

// ...

Java

ตั้งค่าพารามิเตอร์ใน LiveGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ LiveModel


// ...

// Set parameter values in a `LiveGenerationConfig` (example values shown here)
LiveGenerationConfig.Builder configBuilder = new LiveGenerationConfig.Builder();
configBuilder.setMaxOutputTokens(200);
configBuilder.setResponseModality(ResponseModality.AUDIO);

configBuilder.setSpeechConfig(new SpeechConfig(Voices.FENRIR));
configBuilder.setTemperature(0.9f);
configBuilder.setTopK(16);
configBuilder.setTopP(0.1f);

LiveGenerationConfig config = configBuilder.build();

// Specify the config as part of creating the `LiveModel` instance
LiveGenerativeModel lm = FirebaseAI.getInstance(GenerativeBackend.googleAI()).liveModel(
          "GEMINI_LIVE_MODEL_NAME",
          config
);

// ...

Web

ตั้งค่าพารามิเตอร์ใน LiveGenerationConfig ระหว่างการเริ่มต้นอินสแตนซ์ LiveGenerativeModel โดยทำดังนี้


// ...

const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });

// Set parameter values in a `LiveGenerationConfig` (example values shown here)
const liveGenerationConfig = {
  maxOutputTokens: 200,
  responseModalities: [ResponseModality.AUDIO],
  speechConfig: {
    voiceConfig: {
      prebuiltVoiceConfig: { voiceName: "Fenrir" },
    },
  },
  temperature: 0.9,
  topP: 0.1,
  topK: 16,
};

// Specify the config as part of creating the `LiveGenerativeModel` instance
const liveModel = getLiveGenerativeModel(ai, {
  model: "GEMINI_LIVE_MODEL_NAME",
  liveGenerationConfig,
});

// ...

Dart

ตั้งค่าพารามิเตอร์ใน LiveGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ LiveGenerativeModel


// ...

// Set parameter values in a `LiveGenerationConfig` (example values shown here)
final config = LiveGenerationConfig(
  maxOutputTokens: 200,
  responseModalities: [ResponseModalities.audio],
  speechConfig: SpeechConfig(voiceName: 'Fenrir'),
  temperature: 0.9,
  topP: 0.1,
  topK: 16,
);

// Specify the config as part of creating the `liveGenerativeModel` instance
final liveModel = FirebaseAI.googleAI().liveGenerativeModel(
  model: 'GEMINI_LIVE_MODEL_NAME',
  liveGenerationConfig: config,
);

// ...

Unity

ตั้งค่าพารามิเตอร์ใน LiveGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ LiveModel


// ...

// Set parameter values in a `LiveGenerationConfig` (example values shown here)
var config = new LiveGenerationConfig(
  maxOutputTokens: 200,
  responseModalities: new[] { ResponseModality.Audio },
  speechConfig: SpeechConfig.UsePrebuiltVoice("Fenrir"),
  temperature: 0.9f,
  topK: 16,
  topP: 0.1f
);

// Specify the config as part of creating the `LiveModel` instance
var liveModel = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI()).GetLiveModel(
  modelName: "GEMINI_LIVE_MODEL_NAME",
  liveGenerationConfig: config
);

// ...

คุณดูคำอธิบายของพารามิเตอร์แต่ละรายการได้ในส่วนถัดไปของหน้านี้

คำอธิบายพารามิเตอร์ (Gemini)

ต่อไปนี้เป็นภาพรวมระดับสูงของพารามิเตอร์ที่มีให้ใช้งาน (หากมี) คุณดู รายการพารามิเตอร์และค่าต่างๆ ทั้งหมด ได้ในเอกสารประกอบGemini Developer API

พารามิเตอร์ คำอธิบาย ค่าเริ่มต้น
การประทับเวลาเสียง
audioTimestamp

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

ใช้ได้เฉพาะเมื่อใช้ generateContent หรือ generateContentStream การเรียก และประเภทอินพุตเป็นไฟล์เสียงเท่านั้น

false
จำนวนตัวเลือก
candidateCount

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

ค่าที่รองรับ: 1 - 8 (รวมทุกค่าในช่วง)

ใช้ได้เฉพาะเมื่อใช้ generateContent และ โมเดล Gemini ล่าสุด ไม่รองรับโมเดล Live API และ generateContentStream

1
ค่าปรับความถี่
frequencyPenalty
ควบคุมความน่าจะเป็นที่จะรวมโทเค็นที่ปรากฏซ้ำๆ ใน การตอบกลับที่สร้างขึ้น
ค่าที่เป็นบวกจะปรับโทเค็นที่ปรากฏซ้ำๆ ในเนื้อหาที่สร้างขึ้น ซึ่งจะลดความน่าจะเป็นที่จะเกิดเนื้อหาซ้ำ
---
โทเค็นเอาต์พุตสูงสุด
maxOutputTokens
ระบุจำนวนโทเค็นสูงสุดที่สร้างได้ในการตอบกลับ ---
ค่าปรับการแสดง
presencePenalty
ควบคุมความน่าจะเป็นที่จะรวมโทเค็นที่ปรากฏในการตอบกลับที่สร้างขึ้นแล้ว
ค่าที่เป็นบวกจะปรับโทเค็นที่ปรากฏในเนื้อหาที่สร้างขึ้นแล้ว ซึ่งจะเพิ่มความน่าจะเป็นที่จะสร้างเนื้อหาที่หลากหลายมากขึ้น
---
ลำดับการหยุด
stopSequences

ระบุรายการสตริงที่บอกให้โมเดลหยุดสร้าง เนื้อหาหากพบสตริงใดสตริงหนึ่งในการตอบกลับ

ใช้ได้เฉพาะเมื่อใช้การกำหนดค่า GenerativeModel

---
อุณหภูมิ
temperature
ควบคุมระดับความสุ่มในการตอบกลับ
อุณหภูมิต่ำจะทำให้การตอบกลับมีความแน่นอนมากขึ้น และอุณหภูมิสูง จะทำให้การตอบกลับมีความหลากหลายหรือสร้างสรรค์มากขึ้น
ขึ้นอยู่กับโมเดล
Top-K
topK
จำกัดจำนวนคำที่มีความน่าจะเป็นสูงสุดที่ใช้ใน เนื้อหาที่สร้างขึ้น
ค่า Top-K เป็น 1 หมายความว่าโทเค็นถัดไปที่เลือกควรเป็น โทเค็นที่มีความน่าจะเป็นสูงสุด ในบรรดาโทเค็นทั้งหมดในคำศัพท์ของโมเดล ในขณะที่ค่า Top-K เป็น n หมายความว่าโทเค็นถัดไปควร เลือกจากโทเค็น ที่มีความน่าจะเป็นสูงสุด n รายการ (ทั้งหมดนี้อิงตามอุณหภูมิที่ตั้งไว้)
ขึ้นอยู่กับโมเดล
Top-P
topP
ควบคุมความหลากหลายของเนื้อหาที่สร้างขึ้น
ระบบจะเลือกโทเค็นจากโทเค็นที่มีความน่าจะเป็นสูงสุด (ดู Top-K ด้านบน) ไปจนถึงโทเค็นที่มีความน่าจะเป็นต่ำสุดจนกว่าผลรวมของความน่าจะเป็นจะเท่ากับค่า Top-P
ขึ้นอยู่กับโมเดล
รูปแบบการตอบกลับ
responseModality

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

ใช้ได้เฉพาะเมื่อใช้โมเดล Live API หรือเมื่อใช้ โมเดล Gemini ที่สามารถแสดงเอาต์พุตหลายรูปแบบได้

---
คำพูด (เสียง)
speechConfig

ระบุเสียงที่ใช้สำหรับเอาต์พุตเสียงที่สตรีมเมื่อใช้ Live API

ใช้ได้เฉพาะเมื่อใช้โมเดล Live API

Puck



กำหนดค่าโมเดล Imagen

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

ส่วนนี้จะแสดงวิธี ตั้งค่าการกำหนดค่าเพื่อใช้กับ Imagenโมเดลและให้ คำอธิบายของแต่ละพารามิเตอร์

ตั้งค่าการกำหนดค่าโมเดล (Imagen)

ระบบจะเก็บรักษาการกำหนดค่าไว้ตลอดอายุการใช้งานของอินสแตนซ์ หากต้องการใช้การกำหนดค่าอื่น ให้สร้างอินสแตนซ์ ImagenModel ใหม่ด้วยการกำหนดค่าดังกล่าว

Swift

ตั้งค่าพารามิเตอร์ใน ImagenGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ ImagenModel


import FirebaseAILogic

// Set parameter values in a `ImagenGenerationConfig` (example values shown here)
let config = ImagenGenerationConfig(
  negativePrompt: "frogs",
  numberOfImages: 2,
  aspectRatio: .landscape16x9,
  imageFormat: .jpeg(compressionQuality: 100),
  addWatermark: false
)

// Initialize the Gemini Developer API backend service
// Specify the config as part of creating the `ImagenModel` instance
let model = FirebaseAI.firebaseAI(backend: .googleAI()).imagenModel(
  modelName: "IMAGEN_MODEL_NAME",
  generationConfig: config
)

// ...

Kotlin

ตั้งค่าพารามิเตอร์ใน ImagenGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ ImagenModel


// ...

// Set parameter values in a `ImagenGenerationConfig` (example values shown here)
val config = ImagenGenerationConfig {
    negativePrompt = "frogs",
    numberOfImages = 2,
    aspectRatio = ImagenAspectRatio.LANDSCAPE_16x9,
    imageFormat = ImagenImageFormat.jpeg(compressionQuality = 100),
    addWatermark = false
}

// Initialize the Gemini Developer API backend service
// Specify the config as part of creating the `GenerativeModel` instance
val model = Firebase.ai(backend = GenerativeBackend.vertexAI()).imagenModel(
    modelName = "IMAGEN_MODEL_NAME",
    generationConfig = config
)

// ...

Java

ตั้งค่าพารามิเตอร์ใน ImagenGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ ImagenModel


// ...

// Set parameter values in a `ImagenGenerationConfig` (example values shown here)
ImagenGenerationConfig config = new ImagenGenerationConfig.Builder()
    .setNegativePrompt("frogs")
    .setNumberOfImages(2)
    .setAspectRatio(ImagenAspectRatio.LANDSCAPE_16x9)
    .setImageFormat(ImagenImageFormat.jpeg(100))
    .setAddWatermark(false)
    .build();

// Specify the config as part of creating the `ImagenModel` instance
ImagenModelFutures model = ImagenModelFutures.from(
        FirebaseAI.getInstance(GenerativeBackend.googleAI())
                .imagenModel(
                    "IMAGEN_MODEL_NAME",
                    config
                );
);

// ...

Web

ตั้งค่าพารามิเตอร์ใน ImagenGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ ImagenModel


// ...

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

// Set parameter values in a `ImagenGenerationConfig` (example values shown here)
const generationConfig = {
  negativePrompt: "frogs",
  numberOfImages: 2,
  aspectRatio: ImagenAspectRatio.LANDSCAPE_16x9,
  imageFormat: ImagenImageFormat.jpeg(100),
  addWatermark: false
};

// Specify the config as part of creating the `ImagenModel` instance
const model = getImagenModel(ai, { model: "IMAGEN_MODEL_NAME", generationConfig });

// ...

Dart

ตั้งค่าพารามิเตอร์ใน ImagenGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ ImagenModel


// ...

// Set parameter values in a `ImagenGenerationConfig` (example values shown here)
final generationConfig = ImagenGenerationConfig(
  negativePrompt: 'frogs',
  numberOfImages: 2,
  aspectRatio: ImagenAspectRatio.landscape16x9,
  imageFormat: ImagenImageFormat.jpeg(compressionQuality: 100)
  addWatermark: false
);

// Initialize the Gemini Developer API backend service
// Specify the config as part of creating the `ImagenModel` instance
final model = FirebaseAI.googleAI().imagenModel(
  model: 'IMAGEN_MODEL_NAME',
  config: generationConfig,
);

// ...

Unity

ตั้งค่าพารามิเตอร์ใน ImagenGenerationConfig เป็นส่วนหนึ่งของการสร้างอินสแตนซ์ ImagenModel


using Firebase.AI;

// Set parameter values in a `ImagenGenerationConfig` (example values shown here)
var config = new ImagenGenerationConfig(
  numberOfImages: 2,
  aspectRatio: ImagenAspectRatio.Landscape16x9,
  imageFormat: ImagenImageFormat.Jpeg(100)
);

// Initialize the Gemini Developer API backend service
// Specify the config as part of creating the `ImagenModel` instance
var model = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI()).GetImagenModel(
  modelName: "imagen-4.0-generate-001",
  generationConfig: config
);

// ...

คุณดูคำอธิบายของพารามิเตอร์แต่ละรายการได้ในส่วนถัดไปของหน้านี้

คำอธิบายพารามิเตอร์ (Imagen)

ต่อไปนี้เป็นภาพรวมระดับสูงของพารามิเตอร์ที่มีให้ใช้งาน (หากมี) คุณดูรายการพารามิเตอร์และค่าต่างๆ ทั้งหมดได้ใน เอกสารประกอบ Google Cloud

พารามิเตอร์ คำอธิบาย ค่าเริ่มต้น
พรอมต์เชิงลบ
negativePrompt
คำอธิบายสิ่งที่คุณต้องการละเว้นในรูปภาพที่สร้างขึ้น

imagen-3.0-generate-002 ยังไม่รองรับพารามิเตอร์นี้

---
จำนวนผลลัพธ์
numberOfImages
จำนวนรูปภาพที่สร้างขึ้นซึ่งแสดงผลสำหรับการขอแต่ละครั้ง ค่าเริ่มต้นคือรูปภาพ 1 รายการ
สัดส่วนภาพ
aspectRatio
อัตราส่วนความกว้างต่อความสูงของรูปภาพที่สร้างขึ้น ค่าเริ่มต้นคือสี่เหลี่ยมจัตุรัส (1:1)
รูปแบบรูปภาพ
imageFormat
ตัวเลือกเอาต์พุต เช่น รูปแบบรูปภาพ (ประเภท MIME) และระดับของ การบีบอัดของรูปภาพที่สร้างขึ้น ประเภท MIME เริ่มต้นคือ PNG
การบีบอัดเริ่มต้นคือ 75 (หากตั้งค่าประเภท MIME เป็น JPEG)
ลายน้ำ
addWatermark
จะเพิ่มลายน้ำดิจิทัลที่มองไม่เห็น (เรียกว่า SynthID) ลงในรูปภาพที่สร้างขึ้นหรือไม่ ค่าเริ่มต้นคือ true
การสร้างบุคคล
personGeneration
จะอนุญาตให้โมเดลสร้างบุคคลหรือไม่ ค่าเริ่มต้นขึ้นอยู่กับโมเดล
รวมแอตทริบิวต์ความปลอดภัย
includeSafetyAttributes
จะเปิดใช้คะแนน Responsible AI แบบปัดเศษสำหรับรายการแอตทริบิวต์ความปลอดภัย ในการตอบกลับสำหรับอินพุตและเอาต์พุตที่ไม่ได้กรองหรือไม่

หมวดหมู่แอตทริบิวต์ความปลอดภัย: "Death, Harm & Tragedy", "Firearms & Weapons", "Hate", "Health", "Illicit Drugs", "Politics", "Porn", "Religion & Belief", "Toxic", "Violence", "Vulgarity", "War & Conflict".

ค่าเริ่มต้นคือ false



ตัวเลือกอื่นๆ ในการควบคุมการสร้างเนื้อหา

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