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
""" 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.7, 'candidate_count': 1, 'top_k': 40, 'top_p': 0.95, 'max_output_tokens': 1024, } prompt = """The student was so excited for the big science fair tomorrow, but they had forgotten to do their project. They had been so busy with soccer practice and their other extracurricular activities that they had completely lost track of time. They knew that they would have to stay up late to finish their project, but they were determined to do it. They worked for hours, and finally, just before midnight, they were finished. They were so tired, but they were also relieved. They knew that they had done their best, and they were confident that they would do well in the science fair. Please turn this paragraph into a bulleted list.""" response = genai.generate_text( **defaults, prompt=prompt ) print(response.result)