시스템 안내는 모델이 최종 사용자의 추가 안내에 노출되기 전에 추가하는 '프리앰블'과 같습니다. 이를 통해 특정 요구사항 및 사용 사례에 따라 모델의 동작을 조정할 수 있습니다.
시스템 안내를 설정하면 작업을 이해하고, 보다 맞춤설정된 대답을 제공하고, 모델과의 전체 사용자 상호작용에 대한 특정 가이드라인을 준수하기 위한 추가 컨텍스트를 모델에 제공할 수 있습니다. 최종 사용자가 제공하는 프롬프트와 별도로 시스템 안내에 제품 수준 동작을 지정할 수 있습니다. 예를 들어 역할 또는 페르소나, 문맥에 맞는 정보, 형식 지정 안내 등을 포함할 수 있습니다.
다음과 같은 다양한 방법으로 시스템 안내를 사용할 수 있습니다.
- 페르소나 또는 역할 정의(예: 챗봇)
- 출력 형식 정의(마크다운, YAML 등)
- 출력 스타일 및 어조 정의(예: 세부정보 수준, 형식, 대상 읽기 수준)
- 태스크의 목표 또는 규칙 정의(예: 추가 설명 없이 코드 스니펫 반환)
- 프롬프트에 대한 추가 컨텍스트 제공(예: 지식 컷오프)
시스템 안내가 설정되면 전체 요청에 적용됩니다. 프롬프트에 포함하면 여러 사용자 및 모델 차례에서 작동합니다. 시스템 안내는 프롬프트 콘텐츠와 별개이지만 여전히 전체 프롬프트의 일부이므로 표준 데이터 사용 정책이 적용됩니다.
시스템 안내는 모든 Gemini 모델에서 지원됩니다. Imagen 모델에서는 지원되지 않습니다.
시스템 요청 사항 설정
| Gemini API 제공업체를 클릭하여 이 페이지에서 제공업체별 콘텐츠와 코드를 확인합니다. | 
일반적인 사용 사례에 대한 시스템 안내 설정
Swift
GenerativeModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
import FirebaseAI
// Specify the system instructions as part of creating the `GenerativeModel` instance
let model = FirebaseAI.firebaseAI(backend: .googleAI()).generativeModel(
  modelName: "GEMINI_MODEL_NAME",
  systemInstruction: ModelContent(role: "system", parts: "You are a cat. Your name is Neko.")
)
Kotlin
GenerativeModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// Specify the system instructions as part of creating the `GenerativeModel` instance
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).generativeModel(
  modelName = "GEMINI_MODEL_NAME",
  systemInstruction = content { text("You are a cat. Your name is Neko.") }
)
Java
GenerativeModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// Specify the system instructions as part of creating the `GenerativeModel` instance
GenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
    .generativeModel(
      /* modelName */ "GEMINI_MODEL_NAME",
      /* generationConfig (optional) */ null,
      /* safetySettings (optional) */ null,
      /* requestOptions (optional) */ new RequestOptions(),
      /* tools (optional) */ null,
      /* toolsConfig (optional) */ null,
      /* systemInstruction (optional) */ new Content.Builder().addText("You are a cat. Your name is Neko.").build()
    );
GenerativeModelFutures model = GenerativeModelFutures.from(ai);
Web
GenerativeModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// ...
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });
// Specify the system instructions as part of creating the `GenerativeModel` instance
const model = getGenerativeModel(ai, {
  model: "GEMINI_MODEL_NAME",
  systemInstruction: "You are a cat. Your name is Neko."
});
Dart
GenerativeModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// ...
// Specify the system instructions as part of creating the `GenerativeModel` instance
final model = FirebaseAI.googleAI().generativeModel(
  model: 'GEMINI_MODEL_NAME',
  systemInstruction: Content.system('You are a cat. Your name is Neko.'),
);
// ...
Unity
GenerativeModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// ...
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());
// Specify the system instructions as part of creating the `GenerativeModel` instance
var model = ai.GetGenerativeModel(
  modelName: "GEMINI_MODEL_NAME",
  systemInstruction: ModelContent.Text("You are a cat. Your name is Neko.")
);
Gemini Live API의 시스템 요청 사항 설정
Swift
LiveGenerativeModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
import FirebaseAI
// Specify the system instructions as part of creating the `LiveGenerativeModel` instance
let model = FirebaseAI.firebaseAI(backend: .googleAI()).liveModel(
  modelName: "GEMINI_MODEL_NAME",
  systemInstruction: ModelContent(role: "system", parts: "You are a cat. Your name is Neko.")
)
Kotlin
LiveModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// Specify the system instructions as part of creating the `LiveModel` instance
val model = Firebase.ai(backend = GenerativeBackend.googleAI()).liveModel(
  modelName = "GEMINI_MODEL_NAME",
  systemInstruction = content { text("You are a cat. Your name is Neko.") }
)
Java
LiveModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// Specify the system instructions as part of creating the `LiveModel` instance
LiveModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI())
    .liveModel(
      /* modelName */ "GEMINI_MODEL_NAME",
      /* generationConfig (optional) */ null,
      /* safetySettings (optional) */ null,
      /* requestOptions (optional) */ new RequestOptions(),
      /* tools (optional) */ null,
      /* toolsConfig (optional) */ null,
      /* systemInstruction (optional) */ new Content.Builder().addText("You are a cat. Your name is Neko.").build()
    );
LiveModelFutures model = LiveModelFutures.from(gm);
Web
LiveGenerativeModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// ...
const ai = getAI(firebaseApp, { backend: new GoogleAIBackend() });
// Specify the config as part of creating the `LiveGenerativeModel` instance
const model = getLiveGenerativeModel(ai, {
  model: "GEMINI_MODEL_NAME",
  systemInstruction: "You are a cat. Your name is Neko.",
});
// ...
Dart
LiveModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// ...
// Specify the system instructions as part of creating the `LiveModel` instance
final model = FirebaseAI.googleAI().liveGenerativeModel(
  model: 'GEMINI_MODEL_NAME',
  systemInstruction: Content.system('You are a cat. Your name is Neko.'),
);
// ...
Unity
LiveModel 인스턴스를 만들 때 systemInstruction을 지정합니다.
// ...
var ai = FirebaseAI.GetInstance(FirebaseAI.Backend.GoogleAI());
// Specify the system instructions as part of creating the `LiveModel` instance
var model = ai.GetLiveModel(
  modelName: "GEMINI_MODEL_NAME",
  systemInstruction: ModelContent.Text("You are a cat. Your name is Neko.")
);
시스템 요청 사항의 예
다음은 모델의 예상 동작을 유도하는 데 도움이 되는 시스템 지침의 몇 가지 예입니다. 각 예시에는 시스템 안내가 유용한 프롬프트의 예시도 표시되어 있습니다.
코드 생성
- 시스템 안내: 
 프런트엔드 인터페이스의 코드 렌더링을 전문으로 하는 코딩 전문가입니다. 빌드하고자 하는 웹사이트의 구성요소를 설명할 때 빌드에 필요한 HTML과 CSS를 반환해야 합니다. 이 코드에 대한 설명을 제공하지 않습니다. UI 디자인 제안도 제공해 줘.
- 사용자 프롬프트: 
 페이지 중간에 회전하는 이미지를 포함하는 상자를 만들고 각 이미지에 캡션을 포함시킵니다. 페이지 중앙의 이미지에는 눈에 띄게 하기 위한 그림자 효과가 있어야 합니다. 사이트의 다른 페이지로 연결되어야 합니다. URL을 비워 두면 제가 입력할 수 있습니다.
음악 챗봇
- 시스템 요청 사항: 
 음악 역사가로서 다양한 음악 장르에 대한 포괄적인 지식을 보여주고 관련 예시를 제공합니다. 음악의 즐거움을 퍼뜨리기 위해 흥미진진하고 열정적인 어조를 사용합니다. 음악과 관련된 질문이 아닌 경우 '그것은 제가 모르는 부분입니다'라고 대답해야 합니다.
- 사용자 프롬프트: 
 1960년대에 태어난 사람이 가장 많이 들었던 음악 장르는 무엇이야? 글머리 항목별로 5개의 노래를 나열합니다.
형식 지정된 데이터 생성
- 시스템 안내: 
 너는 가정 요리사의 도우미야. 재료 목록을 받고 해당 재료를 사용하는 레시피 목록으로 응답합니다. 추가 재료가 필요하지 않은 레시피는 항상 추가 재료가 필요한 레시피보다 먼저 나열해야 합니다.- 대답은 레시피 3개가 포함된 JSON 객체여야 합니다. 레시피 객체에는 다음 스키마가 있습니다. - name: 레시피의 이름
- usedIngredients: 목록에 있는 레시피의 재료
- otherIngredients: 목록에 없는 레시피의 재료(다른 재료가 없는 경우 생략)
- description: 레시피에 대한 간단한 설명으로, 판매하는 것처럼 긍정적인 어조로 작성
 
- 사용자 프롬프트: - 냉동 브로콜리 1파운드 백
- 헤비 크림 1파인트
- 치즈 조각 1파운드 팩
 
콘텐츠 생성을 제어하는 기타 옵션
- 프롬프트 디자인에 대해 자세히 알아보세요. 모델이 내 요구사항에 맞는 출력을 생성하도록 영향을 줄 수 있습니다.
- 모델 파라미터를 구성하여 모델의 대답 생성 방식을 제어합니다. Gemini 모델의 경우 이러한 매개변수에는 최대 출력 토큰, 온도, topK, topP가 포함됩니다. Imagen 모델의 경우 여기에는 가로세로 비율, 인물 생성, 워터마크 등이 포함됩니다.
- 안전 설정을 사용하여 증오심 표현, 성적인 콘텐츠 등 유해하다고 간주될 수 있는 대답을 받을 가능성을 조정합니다.
- 프롬프트와 함께 응답 스키마를 전달하여 특정 출력 스키마를 지정합니다. 이 기능은 JSON 출력을 생성할 때 가장 일반적으로 사용되지만 분류 작업(예: 모델이 특정 라벨이나 태그를 사용하도록 하려는 경우)에도 사용할 수 있습니다.