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 28 29 30 31
""" 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.1, 'candidate_count': 1, 'top_k': 40, 'top_p': 0.95, 'max_output_tokens': 1024, } prompt = """Transform a sentence into a bulleted list. Sentence: I got up, went to the beach, surfed for a bit, and then took a long drive back with the windows down. Bulleted: * I got up * Went to the beach * Surfed for a bit * Took a long drive back with the windows down Sentence: I put my dogs in the back seat, drove to a dog park, played fetch for a few minutes, and then drove home. Bulleted:""" response = genai.generate_text( **defaults, prompt=prompt ) print(response.result)