किसी मॉडल को हर कॉल में, मॉडल कॉन्फ़िगरेशन भेजा जा सकता है. इससे यह कंट्रोल किया जा सकता है कि मॉडल, जवाब कैसे जनरेट करता है. हर मॉडल, कॉन्फ़िगरेशन के अलग-अलग विकल्प उपलब्ध कराता है.
प्रॉम्प्ट और मॉडल कॉन्फ़िगरेशन के साथ प्रयोग किया जा सकता है. साथ ही, Vertex AI Studio का इस्तेमाल करके, तेज़ी से बदलाव किए जा सकते हैं.
Gemini कॉन्फ़िगरेशन के विकल्पों पर जाएं Imagen कॉन्फ़िगरेशन के विकल्पों पर जाएं
Gemini मॉडल कॉन्फ़िगर करना
इस सेक्शन में, Gemini मॉडल के साथ इस्तेमाल करने के लिए, कॉन्फ़िगरेशन सेट अप करने का तरीका बताया गया है. साथ ही, इसमें हर पैरामीटर की जानकारी भी दी गई है.
मॉडल कॉन्फ़िगरेशन सेट अप करना (Gemini)
सामान्य इस्तेमाल के उदाहरणों के लिए कॉन्फ़िगरेशन
कॉन्फ़िगरेशन, इंस्टेंस के लाइफ़टाइम के लिए बनाए रखा जाता है. अगर आपको किसी दूसरे कॉन्फ़िगरेशन का इस्तेमाल करना है, तो उस कॉन्फ़िगरेशन के साथ नया GenerativeModel
इंस्टेंस बनाएं.
Swift
GenerativeModel
इंस्टेंस बनाने के लिए, GenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// Set parameter values in a `GenerationConfig` (example values shown here)
let config = GenerationConfig(
temperature: 0.9,
topP: 0.1,
topK: 16,
maxOutputTokens: 200,
stopSequences: ["red"]
)
// Specify the config as part of creating the `GenerativeModel` instance
let model = vertex.generativeModel(
modelName: "GEMINI_MODEL_NAME",
generationConfig: config
)
// ...
Kotlin
GenerativeModel
इंस्टेंस बनाने के लिए, GenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// Set parameter values in a `GenerationConfig` (example values shown here)
val config = generationConfig {
maxOutputTokens = 200
stopSequences = listOf("red")
temperature = 0.9f
topK = 16
topP = 0.1f
}
// Specify the config as part of creating the `GenerativeModel` instance
val generativeModel = Firebase.vertexAI.generativeModel(
modelName = "GEMINI_MODEL_NAME",
generationConfig = config
)
// ...
Java
GenerativeModel
इंस्टेंस बनाने के लिए, GenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// Set parameter values in a `GenerationConfig` (example values shown here)
GenerationConfig.Builder configBuilder = new GenerationConfig.Builder();
configBuilder.maxOutputTokens = 200;
configBuilder.stopSequences = List.of("red");
configBuilder.temperature = 0.9f;
configBuilder.topK = 16;
configBuilder.topP = 0.1f;
GenerationConfig generationConfig = configBuilder.build();
// Specify the config as part of creating the `GenerativeModel` instance
GenerativeModel gm = FirebaseVertexAI.getInstance().generativeModel(
"GEMINI_MODEL_NAME",
generationConfig
);
GenerativeModelFutures model = GenerativeModelFutures.from(gm);
// ...
Web
GenerativeModel
इंस्टेंस बनाने के लिए, GenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// Set parameter values in a `GenerationConfig` (example values shown here)
const generationConfig = {
max_output_tokens: 200,
stop_sequences: ["red"],
temperature: 0.9,
top_p: 0.1,
top_k: 16,
};
// Specify the config as part of creating the `GenerativeModel` instance
const model = getGenerativeModel(vertex, { model: "GEMINI_MODEL_NAME", generationConfig });
// ...
Dart
GenerativeModel
इंस्टेंस बनाने के लिए, GenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// Set parameter values in a `GenerationConfig` (example values shown here)
final generationConfig = GenerationConfig(
maxOutputTokens: 200,
stopSequences: ["red"],
temperature: 0.9,
topP: 0.1,
topK: 16,
);
final model = FirebaseVertexAI.instance.generativeModel(
model: 'GEMINI_MODEL_NAME',
// Specify the config as part of creating the `GenerativeModel` instance
config: generationConfig,
);
// ...
इस पेज के अगले सेक्शन में, हर पैरामीटर की जानकारी मिलेगी.
Gemini Live API के लिए कॉन्फ़िगरेशन
कॉन्फ़िगरेशन, इंस्टेंस के लाइफ़टाइम के लिए बनाए रखा जाता है. अगर आपको किसी दूसरे कॉन्फ़िगरेशन का इस्तेमाल करना है, तो उस कॉन्फ़िगरेशन के साथ नया LiveModel
इंस्टेंस बनाएं.
Swift
फ़िलहाल, Live API Apple के प्लैटफ़ॉर्म पर काम नहीं करता. हालांकि, जल्द ही यह सुविधा उपलब्ध होगी!
Kotlin
LiveModel
इंस्टेंस बनाने के लिए, LiveGenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// 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 generativeModel = Firebase.vertexAI.liveModel(
modelName = "gemini-2.0-flash-live-preview-04-09",
generationConfig = config
)
// ...
Java
LiveModel
इंस्टेंस बनाने के लिए, LiveGenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// Set parameter values in a `LiveGenerationConfig` (example values shown here)
LiveGenerationConfig.Builder configBuilder = new LiveGenerationConfig.Builder();
configBuilder.setMaxOutputTokens(200);
configBuilder.setResponseModalities(ResponseModality.AUDIO);
configBuilder.setSpeechConfig(new SpeechConfig(Voices.FENRIR));
configBuilder.setTemperature(0.9f);
configBuilder.setTopK(16);
configBuilder.setTopP(0.1f);
LiveGenerationConfig generationConfig = configBuilder.build();
// Specify the config as part of creating the `LiveModel` instance
LiveGenerativeModel gm = FirebaseVertexAI.getInstance().liveModel(
"gemini-2.0-flash-live-preview-04-09",
generationConfig
);
LiveModelFutures model = LiveModelFutures.from(gm);
// ...
Web
फ़िलहाल, Live API वेब ऐप्लिकेशन के लिए उपलब्ध नहीं है. हालांकि, जल्द ही इसे उपलब्ध कराया जाएगा!
Dart
LiveModel
इंस्टेंस बनाने के लिए, LiveGenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// Set parameter values in a `LiveGenerationConfig` (example values shown here)
final generationConfig = LiveGenerationConfig(
maxOutputTokens: 200,
responseModalities: [ResponseModality.audio],
speechConfig: SpeechConfig(voice: Voice.fenrir),
temperature: 0.9,
topP: 0.1,
topK: 16,
);
// Specify the config as part of creating the `LiveModel` instance
final model = FirebaseVertexAI.instance.LiveModel(
model: 'gemini-2.0-flash-live-preview-04-09',
config: generationConfig,
);
// ...
इस पेज के अगले सेक्शन में, हर पैरामीटर की जानकारी मिलेगी.
पैरामीटर की जानकारी (Gemini)
यहां उपलब्ध पैरामीटर के बारे में खास जानकारी दी गई है. Google Cloud दस्तावेज़ में, पैरामीटर और उनकी वैल्यू की पूरी सूची देखी जा सकती है.
पैरामीटर | ब्यौरा | डिफ़ॉल्ट वैल्यू |
---|---|---|
ऑडियो का टाइमस्टैंप
audioTimestamp
|
यह एक बूलियन है, जो सिर्फ़ ऑडियो वाली इनपुट फ़ाइलों के लिए टाइमस्टैंप की जानकारी समझने की सुविधा चालू करता है. यह सिर्फ़ |
false |
फ़्रीक्वेंसी की वजह से होने वाली समस्या
frequencyPenalty
|
जनरेट किए गए जवाब में बार-बार दिखने वाले टोकन को शामिल करने की संभावना को कंट्रोल करता है. पॉज़िटिव वैल्यू, जनरेट किए गए कॉन्टेंट में बार-बार दिखने वाले टोकन को दंडित करती हैं. इससे, कॉन्टेंट दोहराए जाने की संभावना कम हो जाती है. |
--- |
ज़्यादा से ज़्यादा आउटपुट टोकन
maxOutputTokens
|
इससे पता चलता है कि जवाब में ज़्यादा से ज़्यादा कितने टोकन जनरेट किए जा सकते हैं. | --- |
मौजूदगी की वजह से मिलने वाली पेनल्टी
presencePenalty
|
जनरेट किए गए जवाब में पहले से मौजूद टोकन शामिल करने की संभावना को कंट्रोल करता है. पॉज़िटिव वैल्यू, जनरेट किए गए कॉन्टेंट में पहले से मौजूद टोकन को दंडित करती हैं. इससे अलग-अलग तरह का कॉन्टेंट जनरेट होने की संभावना बढ़ जाती है. |
--- |
सीक्वेंस रोकना
stopSequences
|
इस पैरामीटर में उन स्ट्रिंग की सूची दी जाती है जिनके जवाब में मिलने पर, मॉडल को कॉन्टेंट जनरेट करना बंद करना होता है. यह सिर्फ़ तब लागू होता है, जब
|
--- |
तापमान
temperature
|
इससे, जवाब में कितनी जानकारी शामिल होगी, यह तय होता है. कम तापमान पर, ज़्यादा सटीक जवाब मिलते हैं. वहीं, ज़्यादा तापमान पर, ज़्यादा अलग-अलग या क्रिएटिव जवाब मिलते हैं. |
यह मॉडल पर निर्भर करता है |
Top-K
topK
|
जनरेट किए गए कॉन्टेंट में, सबसे ज़्यादा इस्तेमाल होने वाले शब्दों की संख्या सीमित करता है. अगर टॉप-K की वैल्यू 1 है, तो इसका मतलब है कि चुना गया अगला टोकन, मॉडल की शब्दावली के सभी टोकन में से सबसे ज़्यादा संभावित होना चाहिए. वहीं, अगर टॉप-K की वैल्यू n है, तो इसका मतलब है कि चुना गया अगला टोकन, सबसे ज़्यादा संभावित n टोकन में से चुना जाना चाहिए. यह सभी वैल्यू, सेट किए गए टेम्परेचर पर निर्भर करती हैं.
|
यह मॉडल पर निर्भर करता है |
Top-P
topP
|
इससे जनरेट किए गए कॉन्टेंट की विविधता को कंट्रोल किया जाता है. टोकन, सबसे ज़्यादा संभावना (ऊपर दिए गए टॉप-K देखें) से लेकर सबसे कम संभावना वाले क्रम में चुने जाते हैं. ऐसा तब तक किया जाता है, जब तक उनकी संभावनाओं का योग, टॉप-P वैल्यू के बराबर न हो जाए. |
यह मॉडल पर निर्भर करता है |
जवाब देने का तरीका
responseModality
|
Live API का इस्तेमाल करते समय, स्ट्रीम किए गए आउटपुट के टाइप के बारे में बताता है. उदाहरण के लिए, टेक्स्ट या ऑडियो. यह सिर्फ़ Live API और
|
--- |
बोली (आवाज़)
speechConfig
|
Live API का इस्तेमाल करते समय, स्ट्रीम किए गए ऑडियो आउटपुट के लिए इस्तेमाल की गई आवाज़ के बारे में बताता है. यह सिर्फ़ Live API और
|
Puck |
Imagen मॉडल कॉन्फ़िगर करना
इस सेक्शन में, Imagen मॉडल के साथ इस्तेमाल करने के लिए, कॉन्फ़िगरेशन सेट अप करने का तरीका बताया गया है. साथ ही, इसमें हर पैरामीटर की जानकारी भी दी गई है.
मॉडल कॉन्फ़िगरेशन सेट अप करना (Imagen)
कॉन्फ़िगरेशन, इंस्टेंस के लाइफ़टाइम के लिए बनाए रखा जाता है. अगर आपको किसी दूसरे कॉन्फ़िगरेशन का इस्तेमाल करना है, तो उस कॉन्फ़िगरेशन के साथ नया ImagenModel
इंस्टेंस बनाएं.
Swift
ImagenModel
इंस्टेंस बनाने के लिए, ImagenGenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// 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
)
// Specify the config as part of creating the `ImagenModel` instance
let model = vertex.imagenModel(
modelName: "IMAGEN_MODEL_NAME",
generationConfig: config
)
// ...
Kotlin
ImagenModel
इंस्टेंस बनाने के लिए, ImagenGenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// 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
)
// Specify the config as part of creating the `ImagenModel` instance
val imagenModel = Firebase.vertexAI.imagenModel(
modelName = "IMAGEN_MODEL_NAME",
generationConfig = config
)
// ...
Java
ImagenModel
इंस्टेंस बनाने के लिए, ImagenGenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// 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
ImagenModel m = FirebaseVertexAI.getInstance().imagenModel(
"IMAGEN_MODEL_NAME",
config
);
ImagenModelFutures model = ImagenModelFutures.from(m);
// ...
Web
ImagenModel
इंस्टेंस बनाने के लिए, ImagenGenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// 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 imagenModel = getImagenModel(vertexAI, { model: "IMAGEN_MODEL_NAME", generationConfig });
// ...
Dart
ImagenModel
इंस्टेंस बनाने के लिए, ImagenGenerationConfig
में पैरामीटर की वैल्यू सेट करें.
// ...
// 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
);
// Specify the config as part of creating the `ImagenModel` instance
final model = FirebaseVertexAI.instance.imagenModel(
model: 'IMAGEN_MODEL_NAME',
config: generationConfig,
);
// ...
इस पेज के अगले सेक्शन में, हर पैरामीटर की जानकारी मिलेगी.
पैरामीटर की जानकारी (Imagen)
यहां उपलब्ध पैरामीटर के बारे में खास जानकारी दी गई है. Google Cloud दस्तावेज़ में, पैरामीटर और उनकी वैल्यू की पूरी सूची देखी जा सकती है.
पैरामीटर | ब्यौरा | डिफ़ॉल्ट वैल्यू |
---|---|---|
नेगेटिव प्रॉम्प्ट
negativePrompt
|
जनरेट की गई इमेज में क्या हटाना है, इसकी जानकारी
फ़िलहाल, |
--- |
नतीजों की संख्या
numberOfImages
|
हर अनुरोध के लिए जनरेट की गई इमेज की संख्या | Imagen 3 मॉडल के लिए, डिफ़ॉल्ट रूप से एक इमेज |
आसपेक्ट रेशियो
aspectRatio
|
जनरेट की गई इमेज की चौड़ाई-ऊंचाई का अनुपात | डिफ़ॉल्ट रूप से स्क्वेयर (1:1) |
इमेज का फ़ॉर्मैट
imageFormat
|
आउटपुट के विकल्प, जैसे कि इमेज फ़ॉर्मैट (MIME टाइप) और जनरेट की गई इमेज के कंप्रेस होने का लेवल | डिफ़ॉल्ट MIME टाइप PNG है डिफ़ॉल्ट कम्प्रेशन 75 है (अगर MIME टाइप को JPEG पर सेट किया गया है) |
वॉटरमार्क
addWatermark
|
जनरेट की गई इमेज में, दिखने वाला डिजिटल वॉटरमार्क (जिसे SynthID कहा जाता है) जोड़ना है या नहीं | Imagen 3 मॉडल के लिए डिफ़ॉल्ट तौर पर true सेट होता है
|
लोगों की इमेज जनरेट करना
personGeneration
|
मॉडल की मदद से लोगों की इमेज जनरेट करने की अनुमति है या नहीं | डिफ़ॉल्ट रूप से, यह मॉडल पर निर्भर करता है |
कॉन्टेंट जनरेशन को कंट्रोल करने के अन्य विकल्प
- प्रॉम्प्ट डिज़ाइन के बारे में ज़्यादा जानें, ताकि आप अपनी ज़रूरतों के हिसाब से आउटपुट जनरेट करने के लिए, मॉडल पर असर डाल सकें.
- सुरक्षा सेटिंग का इस्तेमाल करके, ऐसे जवाबों की संभावना को कम करें जिन्हें नुकसान पहुंचाने वाला माना जा सकता है. इनमें नफ़रत फैलाने वाली भाषा और साफ़ तौर पर सेक्शुअल ऐक्ट दिखाने वाला कॉन्टेंट शामिल है.
- मॉडल के व्यवहार को कंट्रोल करने के लिए, सिस्टम के निर्देश सेट करें. यह सुविधा, "प्रीऐब्सटेंस" की तरह है. इसे मॉडल को असली उपयोगकर्ता से मिलने वाले निर्देशों के ज़रिए इस्तेमाल करने से पहले जोड़ा जाता है.
- किसी खास आउटपुट स्कीमा की जानकारी देने के लिए, प्रॉम्प्ट के साथ रिस्पॉन्स स्कीमा पास करें. आम तौर पर, JSON आउटपुट जनरेट करने के लिए इस सुविधा का इस्तेमाल किया जाता है. हालांकि, इसका इस्तेमाल वर्गीकरण के टास्क के लिए भी किया जा सकता है. जैसे, जब आपको मॉडल को किसी खास लेबल या टैग का इस्तेमाल करना हो.