diff options
| author | Christian Krinitsin <mail@krinitsin.com> | 2025-05-29 15:10:41 +0000 |
|---|---|---|
| committer | Christian Krinitsin <mail@krinitsin.com> | 2025-05-29 15:10:41 +0000 |
| commit | cb7d17990cf4ed2a1e45b5f92c0209563b87afb4 (patch) | |
| tree | cc578e254f7bfaa1146cf1e355a8f355cfc0e936 /ollama/llm.py | |
| parent | dbbaa64f16cef5a2b32056a67433116dab84ab81 (diff) | |
| download | emulator-bug-study-cb7d17990cf4ed2a1e45b5f92c0209563b87afb4.tar.gz emulator-bug-study-cb7d17990cf4ed2a1e45b5f92c0209563b87afb4.zip | |
add ollama test script
Diffstat (limited to 'ollama/llm.py')
| -rwxr-xr-x | ollama/llm.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/ollama/llm.py b/ollama/llm.py new file mode 100755 index 00000000..acf76421 --- /dev/null +++ b/ollama/llm.py @@ -0,0 +1,31 @@ +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() + + with open("test", "r") as file: + content = 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() |