Update app.py
Browse files146 unmodified lines1471481491501501511521531541551567 unmodified lines1641651661641671681691701711721731741751701711761771784 unmodified lines183184185186187188189190191192193187188194195196146 unmodified lines ], response_format=FarmActivities, )
if 'error' in farm_info_response: raise ValueError(f"API error: {interactions_response['error']['message']}") farm_generated_json = farm_info_response.choices[0].message.parsed print(farm_generated_json) # debugging
7 unmodified lines ], response_format=Interactions, )
if 'error' in interactions_response: raise ValueError(f"API error: {interactions_response['error']['message']}") interactions_generated_json = interactions_response.choices[0].message.parsed print(interactions_generated_json) # debugging 2
interactions_pretty_json = interactions_generated_json.json()
if 'error' in response: raise ValueError(f"API error: {response['error']['message']}")
trial_response = client.beta.chat.completions.parse( model=model_version, # Use GPT model that supports structured output4 unmodified lines response_format=Trial, ) if 'error' in trial_response: raise ValueError(f"API error: {trial_response['error']['message']}") trial_generated_json = trial_response.choices[0].message.parsed print(trial_generated_json) # debugging 2
trial_pretty_json = trial_generated_json.json()
if 'error' in response: raise ValueError(f"API error: {response['error']['message']}") return farm_pretty_json, interactions_pretty_json, trial_pretty_json
app.py+11-6