What you can do with the PaLM API

The PaLM API is based on Google’s next generation model, PaLM 2, which excels at a variety of capabilities. PaLM 2 has been optimized for ease of use on key developer use cases and the ability to follow instructions with precision and nuance.

Problem solving

Use the PaLM API to help you write code

Generate, complete, and explain code across a range of languages and technologies


Could you please help me to write code to generate multiples of a number from a given list.


def generate_multiples(number, list):
  """This function generates the multiples of a
  number from a given list.

    number: The number to generate multiples of.
    list: The list to generate multiples from.

    A list of the multiples of number in list.
  multiples = []
  for item in list:
    if item % number == 0:
  return multiples

Ideate or complete content with a writing companion

Generate content from short tweets and emails to business proposals and essays


Come up with six taglines making a persuasive case for Red Delicious apples that I can share with Red Delicious apple skeptics.


  • Red Delicious apples: Sweet, juicy, and delicious. The perfect apple for any occasion.
  • Red Delicious apples: A classic American apple with a sweet, crisp flavor.
  • Red Delicious apples: The perfect apple for snacking, baking, or making applesauce.
  • Red Delicious apples: A good source of vitamins and minerals.
  • Red Delicious apples: Grown in the USA with care and attention.
  • Red Delicious apples: The apple of your eye.

Transform text in any way you’d like

Formalize, elaborate, reformat, change the tone or style, and more


Rewrite this into a casual email:

Tis but thy name that is my enemy;
Thou art thyself, though not a Montague.
What’s Montague? It is nor hand, nor foot,
Nor arm, nor face, nor any other part
Belonging to a man. O, be some other name!
What’s in a name? That which we call a rose
By any other name would smell as sweet;
So Romeo would, were he not Romeo call’d,
Retain that dear perfection which he owes
Without that title. Romeo, doff thy name,
And for that name which is no part of thee
Take all myself.


Dear Romeo,

I know you're a Montague, but that doesn't matter to me. What's in a name? A rose would smell just as sweet no matter what you call it. So please, forget about your name and just be yourself. I love you for who you are, not for your name.


[Your name]

Solve logic problems

Answer complex questions that require reasoning capabilities and logic


Six people were eating pickles. Carl finished before Dot, but behind Ed. Fan finished before Gal, but behind Dot. Hans finished first. What was the finishing order?


Hans, Ed, Carl, Dot, Fan, Gal

Curate suggestions

Get recommendations that meet nuanced preferences and constraints


My favorite films are Dune, The Dark Knight, and Princess Mononoke. What are four movies that I should watch next? Nothing scary, please.


  • Blade Runner (1982): A sci-fi classic that's similar to Dune in its focus on a dystopian future.
  • The Lord of the Rings trilogy (2001-2003): Another epic fantasy series, with great action and special effects.
  • The Matrix (1999): A mind-bending sci-fi film that's full of philosophical questions.
  • Spirited Away (2001): Another beautiful animated film from Studio Ghibli, about a young girl who is transported to a magical world.

Unlock the power of your data

Transform, extract insights from, and synthesize new structured data


Give me 3 classic Thai dishes, along with a short description. Write the data in the following JSON format:

{ "dish": DISH_NAME, "description": DESCRIPTION }


  "dish": "Pad Thai",
  "description": "A stir-fried noodle dish with rice noodles, eggs, shrimp, tofu, and bean sprouts in a sweet and sour sauce."
  "dish": "Tom Yum Goong",
  "description": "A hot and sour soup with shrimp, lemongrass, galangal, kaffir lime leaves, and chili peppers."
  "dish": "Green Curry",
  "description": "A mild curry made with green chili peppers, coconut milk, and basil."

Build an agent

Build agents that can accomplish multi-step tasks with complex variables


You are a dungeon master. Your goal is to help the player explore and eventually find and slay the golden dragon in an exciting magical fantasy adventure game. Don't rush the narrative. Players can move, fight and talk to characters in the game world. The player always starts in their bed in the real world and then somehow is transported to the fantasy realm.

guide: if the player is idle, offer them potential options for where to move next to
fight: if the player sees an enemy, ask if the user wants to fight the enemy
challenge: sometimes, randomly an enemy will appear and the player will need to fight and beat them to proceed
win: when the player wins the game, they wake up in their bed, it was all a dream
do: if the player wants to do anything else, let them

Respond in the following format:
 thought: "a string describing how the dungeon master decides on a move. Include current order state",
 move: "a string with one or more of the following values: guide|fight|challenge|win|do",
 response: "a string with the response spoken by the dungeon master to the player. The narrative is an engaging, diverse and exciting"

Player: Eat a banana
 thought: "The Player wants a eat a banana",
 move: "do",
 response: "Mmm you ate a yummy banana and gained health"
Player: wake up


 thought: "The player wakes up in bed",
 move: "do",
 response: "You wake up in your bed. You feel refreshed and ready for an adventure. You look around your room and see that your window is open. You could probably climb out and explore."