test1.git | req.py


import os
from groq import Groq
import sys
from pathlib import Path

# good article on groq
# https://ya.zerocoder.ru/groq-key/

#print(sys.argv)

if len(sys.argv) >= 2:
    message_hex = sys.argv[1]
    decoded_message = bytes.fromhex(message_hex).decode('utf-8')
else:
    decoded_message = "Please create DSCI pipeline for typical Python project"


file_path = Path.home() / "artifacts/question.txt"

with open(file_path, "w", encoding="utf-8") as file:
    file.writelines(decoded_message)
    
print("===")
print(decoded_message)
print("===")

with open("context.md", "r", encoding="utf-8") as file:
    context = file.read()

client = Groq(api_key=os.environ["GROQ_API_KEY"])


#model="openai/gpt-oss-20b"
model="openai/gpt-oss-120b"
#model="qwen/qwen3.8-27b"

resp = client.chat.completions.create(
    model=model,
    messages=[
        {"role": "user", "content": "#Task\n\n "+ decoded_message + "\n\n" + context }
    ]
)

answer = resp.choices[0].message.content

print(answer)

file_path = Path.home() / "artifacts/answer.md"

with open(file_path, "w", encoding="utf-8") as file:
    file.writelines(answer)