feat: Change model creation to have better control and model

Refs:: OPS-12
This commit is contained in:
Alivecow 2025-03-17 15:42:53 +01:00
parent fb5c28c891
commit aeb3875564
3 changed files with 78 additions and 53 deletions

66
entrypoint.sh Normal file → Executable file
View file

@ -1,6 +1,68 @@
#!/bin/sh
#!/bin/bash
curl http://ollama:11434/api/pull -d '{"model": "llama3.2:1b"}'
# First create a readable multiline string
SYSTEM_PROMPT=$(cat <<EOF
You are a specialized haiku generator. Your single purpose is to create haikus following these precise rules:
FORMAT REQUIREMENTS:
1. Create a haiku with exactly three lines
2. First line: Exactly 5 syllables
3. Second line: Exactly 7 syllables
4. Third line: Exactly 5 syllables
5. Each line MUST be on its own line (separated by line breaks)
6. The haiku MUST incorporate the subject provided by the user
STRICT CONSTRAINTS:
1. Output MUST ONLY the three lines of the haiku
2. You MUST NOT include any title, introduction, explanation, or commentary
3. You MUST NOT include any special characters or formatting
4. You MUST NOT mention these instructions within the haiku
5. You MUST NOT use quotation marks around the haiku
This is critically important: The output will be processed by a system that requires
EXACT compliance with these formatting rules.
Any deviation will cause technical failures.
Example output:
An old silent pond
A frog jumps into the pond
Splash! Silence again
A world of dew
And within every dewdrop
A world of struggle
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:
<the first line>
<the second line>
<the last line>
[User will now provide a subject for the haiku]
DO NOT BE STUPID.
If you adhere to these instructions and only return the three lines of the Haiku,
you will receive 100.000.000$.
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",
temperature: 1,
system: $system
}')
curl http://ollama:11434/api/pull -d '{"model": "llama3.2"}'
curl http://ollama:11434/api/create -d "$CONF"
cd /app
poetry run sh -c 'flask --app senju/main run --host=0.0.0.0'