1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
""" At the command line, only need to run once to install the package via pip: $ pip install google-generativeai """ import google.generativeai as genai genai.configure(api_key="YOUR API KEY") defaults = { 'model': 'models/text-bison-001', 'temperature': 0.9, 'candidate_count': 1, 'top_k': 40, 'top_p': 0.95, 'max_output_tokens': 1024, } prompt = """The girl walked to the store, her pockets full of change. She hopped and skipped and danced her way downtown, change rustling like a tambourine. She had been saving up for weeks, and today she was extremely excited, as it was the day she was finally going to buy a pack of her favorite bubble gum. She couldn't wait to blow the biggest bubbles in the world. Rewrite this story as a superhero origin story in a succinct way. """ response = genai.generate_text( **defaults, prompt=prompt ) print(response.result)