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 32 33 34 35 36 37 38 39 40 41 42 43 44 45
""" 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.25, 'candidate_count': 1, 'top_k': 40, 'top_p': 0.95, 'max_output_tokens': 1024, } prompt = """statement: I'd like to listen a song by Daft Punk. classification: music statement: I'd like to organize my email inbox classification: productivity statement: I'd like a grilled chicken sandwich with extra mustard. classification: food statement: I need to get to JFK airport by 5pm classification: navigation statement: I need to make a todo list for this week's action items classification: productivity statement: How long does it take to get from home to the office? classification: navigation statement: Let's listen to some high tempo music while we make this presentation classification: music statement: Let's order a pizza with extra cheese. classification: food statement: I need news classification: - statement: I want to go fishing classification: - statement: I want to get a hot dog with fries classification:""" response = genai.generate_text( **defaults, prompt=prompt ) print(response.result)