iterative-lookup.py (676B)
1 import subprocess 2 from openai import OpenAI 3 import requests 4 import sys 5 import os 6 7 args = [] 8 first = True 9 for arg in sys.argv: 10 if first: 11 first = False 12 continue 13 args.append(arg) 14 15 print(args) 16 17 client = OpenAI( 18 api_key=os.environ.get("OPENAI_API_KEY"), 19 ) 20 21 for arg in args: 22 resp = subprocess.run(["lynx", '--dump', arg], stdout=subprocess.PIPE) 23 response = client.responses.create( 24 model="gpt-5.2", 25 instructions="You are a summarization agent for a mid career software engineer with ML research experience.", 26 input="Summarize this article: " + resp.stdout.decode('utf-8', 'ignore'), 27 ) 28 29 print(response.output_text)