From b0d3330c67b6874a1eaf23978749b26d99fbdfab Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 6 May 2025 18:01:11 -0400 Subject: Switch Python to unstable and add pydantic-ai Pydantic-ai is an agent framework that seems simple and good: well-typed with pydantic, tool usage is just an `@tool` decorator on a function, and so on. While building these I realized there were some deps they needed that were already in nixpkgs unstable, so I just switched to that instead of trying to backport all the versions and stuff. --- Biz/Storybook.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Biz/Storybook.py') diff --git a/Biz/Storybook.py b/Biz/Storybook.py index dbaf82a..57b84c6 100755 --- a/Biz/Storybook.py +++ b/Biz/Storybook.py @@ -309,7 +309,12 @@ def generate_image( size="1024x1024", quality="standard", ) - url = image_response.data[0].url + data = image_response.data + if data is None: + msg = "error getting data from OpenAI" + log.error(msg) + raise ludic.web.exceptions.InternalServerError(msg) + url = data[0].url if url is None: msg = "error getting image from OpenAI" log.error(msg) -- cgit v1.2.3