summary refs log tree commit diff stats
path: root/ollama/llm.py
blob: c1a62d9096ca8aeeff493353825876dc14e2ae27 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from ollama import chat, ChatResponse
from re import sub
from os import listdir, path

model : str = "deepseek-r1:70b"
directory : str = "../mailinglist/output_mailinglist"

with open("preambel", "r") as file:
    preambel = file.read()

for name in listdir(directory):
    with open(path.join(directory, name)) as file:
        content = preambel + "\n" + file.read()

    response : ChatResponse = chat(
        model=model, messages=[
            {
                'role': 'user',
                'content': content,
            }
        ]
    )

    no_think_response : str = sub(r'<think>(.|\n)*</think>\n\n', '', response.message.content)

    print(no_think_response)
    print("\n")
    exit()