Spaces:
Runtime error
Runtime error
import pprint | |
import google.generativeai as palm | |
palm.configure(api_key='AIzaSyCLy2IgNwMBDbhYH_zvUDo0AMWQdRLQI0E') | |
prompt = input("Ask: ") | |
#prompt = """ | |
#You are an expert at solving coding interview problems in Python. | |
#Describe how you arrived at the most optimal solution. | |
#Break the question down into manageable segments. | |
#Think about it step by step, and show your work. | |
#Say yes and ask for problem when ready. | |
#""" | |
#Here is the problem: | |
completion = palm.generate_text( | |
model='models/text-bison-001', | |
prompt=prompt, | |
temperature=0, | |
# The maximum length of the response | |
max_output_tokens=800, | |
).result | |
print(completion) | |
breakpoint() | |
prompt += ' ' + completion | |
while True: | |
ask = input("Ask: ") | |
prompt += ' ' + ask | |
answer = palm.generate_text( | |
model='models/text-bison-001', | |
prompt=prompt, | |
temperature=0, | |
# The maximum length of the response | |
max_output_tokens=800, | |
).result | |
print(answer) | |
prompt += ' ' + answer | |