Spaces:
Runtime error
Runtime error
Update app.py
Browse files2 unmodified lines34567892 unmodified lines121314151617133 unmodified lines1511521531541551561571581591601611621631641651661671681691701711722 unmodified linesimport sysimport gradio as grimport jsonimport requestsfrom tenacity import retry, wait_random_exponential, stop_after_attempt2 unmodified linesGPT_MODEL = "gpt-3.5-turbo-1106"openai.api_key = os.environ['OPENAI_API_KEY']# Now let's define the function specification:functions = [{133 unmodified lines# Let's see what we got back before continuingreturn assistant_message, cost1from IPython import get_ipythondef exec_python(cell):ipython = get_ipython()result = ipython.run_cell(cell)log = str(result.result)if result.error_before_exec is not None:log += f"\n{result.error_before_exec}"if result.error_in_exec is not None:log += f"\n{result.error_in_exec}"prompt = """You are a genius math tutor, Python code expert, and a helpful assistant.answer = {ans}Please answer user questions very well with explanations and match it with the multiple choices question.""".format(ans = log)return logdef second_prompt_build(prompt, log):prompt_second = prompt.format(ans = log)2 unmodified lines34567892 unmodified lines121314151617181920212223242526272829303132133 unmodified lines1661671681691701712 unmodified linesimport sysimport gradio as grfrom IPython import get_ipythonimport jsonimport requestsfrom tenacity import retry, wait_random_exponential, stop_after_attempt2 unmodified linesGPT_MODEL = "gpt-3.5-turbo-1106"openai.api_key = os.environ['OPENAI_API_KEY']def exec_python(cell):ipython = get_ipython()result = ipython.run_cell(cell)log = str(result.result)if result.error_before_exec is not None:log += f"\n{result.error_before_exec}"if result.error_in_exec is not None:log += f"\n{result.error_in_exec}"prompt = """You are a genius math tutor, Python code expert, and a helpful assistant.answer = {ans}Please answer user questions very well with explanations and match it with the multiple choices question.""".format(ans = log)return log# Now let's define the function specification:functions = [{133 unmodified lines# Let's see what we got back before continuingreturn assistant_message, cost1def second_prompt_build(prompt, log):prompt_second = prompt.format(ans = log)
app.py+16-17