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…
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…
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:…
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…