diff --git a/entrypoint.sh b/entrypoint.sh index 9f7ada1..a0564d5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -23,23 +23,23 @@ This is critically important: The output will be processed by a system that requ EXACT compliance with these formatting rules. Any deviation will cause technical failures. -Example output: +The poems may look like the following ones: +Example 1: An old silent pond A frog jumps into the pond Splash! Silence again +Example 2: A world of dew And within every dewdrop A world of struggle +Example 3: The light of a candle Is transferred to another candle Spring twilight -I write, erase, rewrite -Erase again, and then -A poppy blooms You MUST use this format: @@ -57,12 +57,12 @@ EOF # Create the JSON structure with jq (install with: apt-get install jq) CONF=$(jq -n --arg system "$SYSTEM_PROMPT" '{ model: "haiku", - from: "llama3.2", + from: "phi3", temperature: 1, system: $system }') -curl http://ollama:11434/api/pull -d '{"model": "llama3.2"}' +curl http://ollama:11434/api/pull -d '{"model": "phi3"}' curl http://ollama:11434/api/create -d "$CONF" cd /app poetry run sh -c 'flask --app senju/main run --host=0.0.0.0' diff --git a/senju/haiku.py b/senju/haiku.py index e38d326..2fd7a2f 100644 --- a/senju/haiku.py +++ b/senju/haiku.py @@ -39,15 +39,14 @@ class Haiku: lines = ai_response.split("\n") - for line in lines: - if len(line.split(" ")) > 8 or line == "\n" or line == " ": - lines.remove(line) + for _ in range(0, 2): + lines.pop() + + logging.warning(lines) if len(lines) != 3: continue - logging.warning(lines) - haiku = Haiku( [ lines[0],