diff options
author | terminaldweller <devi@terminaldweller.com> | 2024-05-06 17:38:52 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2024-05-06 17:38:52 +0000 |
commit | 9f5ea956fa3c68f3e73c673f66bdeca58ca74699 (patch) | |
tree | 3fe2d7db8b4ce92ed6bc2642a6b3aa35e001c4df /runpod/main.py | |
parent | initial version of the prettier service (diff) | |
download | milla-9f5ea956fa3c68f3e73c673f66bdeca58ca74699.tar.gz milla-9f5ea956fa3c68f3e73c673f66bdeca58ca74699.zip |
runpod serverless ollama - WIP
Diffstat (limited to '')
-rwxr-xr-x | runpod/main.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/runpod/main.py b/runpod/main.py new file mode 100755 index 0000000..ae12ba4 --- /dev/null +++ b/runpod/main.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +"""ollama-runpod endpoint""" + + +import runpod +import requests + + +def ollama(job): + """the endpoint handler""" + headers = {"Content-Type": "application/json"} + data = { + "model": job["model"], + "system": job["prompt_system"], + "prompt": job["prompt_user"] + job["content"], + "stream": False, + "format": "json", + "options": { + "temperature": job["temp"], + }, + } + + response = requests.post( + "http://127.0.0.1:11434/api/generate", data=data, headers=headers, timeout=10 + ) + + return response + + +def main() -> None: + """entrypoint""" + runpod.serverless({"handler": ollama}) |