{ pkgs, ... }: { home.packages = with pkgs; [ ollama (writers.writePython3Bin "ooo" { libraries = [ pkgs.python3Packages.ollama ]; flakeIgnore = [ "E501" "E305" "E701" "E704" "E302" "E114" "F841" "E121" ]; } /* python */ '' import sys import ollama if len(sys.argv) < 2: print("Usage: ./ooo.py ") sys.exit(1) system_message = sys.argv[1] input_text = sys.stdin.read() try: response = ollama.chat(model='llama3.1:8b', messages=[ { 'role': 'system', 'content': "You are a text transformer. Follow the folling instruction:\n\n" + system_message + "\n\nOnly output the transformed text. Do not add any addidional conversation around the output. Just the result.", }, { 'role': 'user', 'content': input_text, }, ]) print(response['message']['content']) sys.exit(0) except Exception as e: print(f"An error occurred: {e}", file=sys.stderr) sys.exit(1) '') ]; }