import baserun
import openai
def get_activities():
response = openai.chat.completions.create(
model="gpt-3.5-turbo",
temperature=0.7,
messages=[
{
"role": "user",
"content": "What are three activities to do on the Moon?"
}
],
)
return response.choices[0].message.content
@baserun.trace
def find_best_activity():
moon_activities = get_activities()
response = openai.chat.completions.create(
model="gpt-3.5-turbo",
temperature=0.7,
messages=[
{
"role": "user",
"content": "Pick the best activity to do on the moon from the following, including a convincing reason to do so.\n + {moon_activities}"
}
],
)
output = response.choices[0].message.content
baserun.eval.includes("include_eiffel_tower", output, "Eiffel Tower")
return output
if __name__ == "__main__":
baserun.api_key = YOUR_BASERUN_API_KEY_HERE
openai.api_key = YOUR_OPEANI_API_KEY_HERE
baserun.init()
print(find_best_activity())