RSSAmplifier

Blog

Ross Masters's weblog

{{ posts }} ...

rossmasters.comRSS feed ↗5 posts

Latest posts

Chat context via an API

ChatGPT offered to create me a PDF on a document we'd been drafting today. At first I thought this might be a new in-built capability, but actually this was leveraging code execution to write a markdown→PDF script. After a couple of minutes, I stepped into the reasoning detail to see why it was taking so long, and as is common, it was generating the markdown inline, despite the markdown already…

Recursive CTEs results as ORM model instances in SQLModel or SQLAlchemy

Given an ORM model like this: class Venue ( SQLModel , table = True ): id : UUID = Field ( primary_key = True , default_factory = uuid7 ) ... parent_id : UUID | None = Field ( foreign_key = "venue.id" , default = None ) parent : "Venue" | None = Relationship ( back_populates = "children" ) children : list [ "Venue" ] = Relationship ( back_populates = "parent" , sa_relationship_kwargs = {…

Justifying my Python annotation habit

I've been refreshing myself on Python annotations - type-hints with additional information attached - after spending some time experimenting with a type-based dependency injection container . Most times you'll see an annotation, it's something typing, or framework related , but the complexity surrounding those shouldn't scare you off. With inspect.get_annotations() and typing.get_args() , you can…

Running ollama & open-webui on Nvidia AGX Orin

It took me about a day to find this, hopefully it comes up in your Google search. I found that out of the box, ollama could not discover the GPU in the Nvidia AGX Orin. Through various tests I found that: Using pytorch, the iGPU was not discovered as a CUDA device import torch torch . cuda . device_count () == 0 nvcc -V correctly reports CUDA drivers are installed ross@ubuntu:~$ nvcc -V nvcc:…

TIL in Python typing

Simpler yield return type If a function returns a generator with the yield keyword, it makes sense to type it with typing.Generator . For example, in Pytest fixtures with cleanup logic: from typing import Generator @pytest . fixture def httpclient () -> Generator [ TestClient , None , None ]: app = create_app () yield TestClient ( app ) app . shutdown () But I've always hated those superfluous…