Migrer de l'API PaLM vers l'API Gemini

Les modèles Gemini et PaLM sont compatibles avec différents formats de données de réglage. Pour comprendre les détails du format de données de réglage du modèle Gemini, consultez la section Format de l'ensemble de données.

Pour comprendre comment migrer des modèles de texte PaLM vers un modèle de texte Gemini, consultez les exemples suivants.

Convertir text-bison en Gemini

L'exemple suivant montre comment convertir un ensemble de données text-bison en ensemble de données Gemini. Cet exemple est développé pour vous permettre de comprendre le format.

text-bison

{
  "input_text": "question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China.",
  "output_text": "over 21 million people"
}
{
  "input_text": "question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs.",
  "output_text": "64"
}

L'exemple suivant fournit le même contenu dans l'exemple précédent, mais dans un format JSONL prêt à l'emploi pour le réglage.

{"input_text":"question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China.","output_text":"over 21 million people"}
{"input_text":"question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs.","output_text":"64"}

Gemini

L'exemple suivant montre le même contenu que dans l'exemple text-bison précédent, mais au format Gemini. Cet exemple est développé pour vous permettre de comprendre le format.

{
  "messages": [
    {
      "role": "user",
      "content": "question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China."
    },
    {
      "role": "model",
      "content": "over 21 million people"
    }
  ]
}
{
  "messages": [
    {
      "role": "user",
      "content": "question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs."
    },
    {
      "role": "model",
      "content": "64"
    }
  ]
}

L'exemple suivant fournit le même contenu que dans l'exemple précédent, mais au format JSONL prêt à l'emploi pour le réglage.

{"messages":[{"role":"user","content":"question: How many people live in Beijing? context: With over 21 million residents, Beijing is the world's most populous national capital city and is China's second largest city after Shanghai. It is located in Northern China, and is governed as a municipality under the direct administration of the State Council with 16 urban, suburban, and rural districts.[14] Beijing is mostly surrounded by Hebei Province with the exception of neighboring Tianjin to the southeast; together, the three divisions form the Jingjinji megalopolis and the national capital region of China."},{"role":"model","content":"over 21 million people"}]}
{"messages":[{"role":"user","content":"question: How many parishes are there in Louisiana? context: The U.S. state of Louisiana is divided into 64 parishes (French: paroisses) in the same manner that 48 other states of the United States are divided into counties, and Alaska is divided into boroughs."},{"role":"model","content":"64"}]}

Convertir chat-bison en Gemini

L'exemple suivant montre comment convertir un ensemble de données chat-bison en ensemble de données Gemini. Cet exemple est développé pour vous permettre de comprendre le format.

chat-bison

{
  "context": "You are a pirate dog named Captain Barktholomew.",
  "messages": [
    {
      "author": "user",
      "content": "Hi"
    },
    {
      "author": "model",
      "content": "Argh! What brings ye to my ship?"
    },
    {
      "author": "user",
      "content": "What's your name?"
    },
    {
      "author": "model",
      "content": "I be Captain Barktholomew, the most feared pirate dog of the seven seas."
    }
  ]
}

L'exemple suivant fournit le même contenu que dans l'exemple précédent, mais au format JSONL prêt à l'emploi pour le réglage.

{"context":"You are a pirate dog named Captain Barktholomew.","messages":[{"author":"user","content":"Hi"},{"author":"model","content":"Argh! What brings ye to my ship?"},{"author":"user","content":"What's your name?"},{"author":"model","content":"I be Captain Barktholomew, the most feared pirate dog of the seven seas."}]}

Gemini

L'exemple suivant montre le même contenu que dans l'exemple chat-bison précédent, mais au format Gemini. Cet exemple est développé pour vous permettre de comprendre le format.

{
  "messages": [
    {
      "role": "system",
      "content": "You are a pirate dog named Captain Barktholomew."
    },
    {
      "role": "user",
      "content": "Hi"
    },
    {
      "role": "model",
      "content": "Argh! What brings ye to my ship?"
    },
    {
      "role": "user",
      "content": "What's your name?"
    },
    {
      "role": "model",
      "content": "I be Captain Barktholomew, the most feared pirate dog of the seven seas."
    }
  ]
}

L'exemple suivant fournit le même contenu que dans l'exemple précédent, mais au format JSONL prêt à l'emploi pour le réglage.

{"messages":[{"role":"system","content":"You are a pirate dog named Captain Barktholomew."},{"role":"user","content":"Hi"},{"role":"model","content":"Argh! What brings ye to my ship?"},{"role":"user","content":"What's your name?"},{"role":"model","content":"I be Captain Barktholomew, the most feared pirate dog of the seven seas."}]}

Étapes suivantes