.
This commit is contained in:
parent
a2306115bf
commit
7e2570acbc
1 changed files with 54 additions and 61 deletions
|
|
@ -27,70 +27,63 @@ jobs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Validate with Ollama
|
- name: Validate with Ollama
|
||||||
if: steps.extract.outputs.content_found == 'true'
|
if: steps.extract.outputs.content_found == 'true'
|
||||||
id: validate
|
id: validate
|
||||||
run: |
|
run: |
|
||||||
RESUME=$(cat /tmp/resume.txt)
|
RESUME=$(cat /tmp/resume.txt)
|
||||||
|
|
||||||
PROMPT="You are a recruiting manager evaluating candidates for a Technical Writing position.
|
PROMPT="You are a recruiting manager evaluating candidates for a Technical Writing position.
|
||||||
|
|
||||||
Assess this resume on:
|
Assess this resume on:
|
||||||
1. Tone: Is it professional, confident, and appropriate for technical communication roles?
|
1. Tone: Is it professional, confident, and appropriate for technical communication roles?
|
||||||
2. Understandability: Is the writing clear, well-organized, and easy to follow?
|
2. Understandability: Is the writing clear, well-organized, and easy to follow?
|
||||||
3. Technical Writing Skills: Does the candidate demonstrate ability to explain complex concepts clearly?
|
3. Technical Writing Skills: Does the candidate demonstrate ability to explain complex concepts clearly?
|
||||||
|
|
||||||
Resume:
|
Resume:
|
||||||
$RESUME
|
$RESUME
|
||||||
|
|
||||||
Respond with JSON:
|
Respond with JSON:
|
||||||
{
|
{
|
||||||
\"tone\": \"brief assessment\",
|
\"tone\": \"brief assessment\",
|
||||||
\"understandability\": \"brief assessment\",
|
\"understandability\": \"brief assessment\",
|
||||||
\"assessment\": \"PASS or FAIL\",
|
\"assessment\": \"PASS or FAIL\",
|
||||||
\"reason\": \"one sentence explaining your decision\"
|
\"reason\": \"one sentence explaining your decision\"
|
||||||
}"
|
}"
|
||||||
|
|
||||||
RESPONSE=$(curl -s -X POST http://ollama:11434/api/generate \
|
echo "Testing Ollama connectivity..."
|
||||||
-H "Content-Type: application/json" \
|
curl -v http://ollama:11434/api/tags || echo "Ollama unreachable"
|
||||||
-d "{
|
|
||||||
\"model\": \"phi:2.7b\",
|
|
||||||
\"prompt\": $(echo "$PROMPT" | jq -Rs .),
|
|
||||||
\"stream\": false
|
|
||||||
}")
|
|
||||||
|
|
||||||
RESULT=$(echo "$RESPONSE" | jq -r '.response')
|
echo "Sending validation request to Ollama..."
|
||||||
echo "validation_result=$RESULT" >> $GITHUB_OUTPUT
|
RESPONSE=$(curl -s -X POST http://ollama:11434/api/generate \
|
||||||
echo "$RESULT"
|
-H "Content-Type: application/json" \
|
||||||
|
--max-time 300 \
|
||||||
|
-d "{
|
||||||
|
\"model\": \"phi:2.7b\",
|
||||||
|
\"prompt\": $(echo "$PROMPT" | jq -Rs .),
|
||||||
|
\"stream\": false
|
||||||
|
}")
|
||||||
|
|
||||||
- name: Parse validation result
|
echo "Raw response:"
|
||||||
if: steps.extract.outputs.content_found == 'true'
|
echo "$RESPONSE"
|
||||||
id: parse
|
echo "---"
|
||||||
run: |
|
|
||||||
RESULT="${{ steps.validate.outputs.validation_result }}"
|
|
||||||
|
|
||||||
JSON=$(echo "$RESULT" | grep -o '{.*}' | head -1)
|
if [ -z "$RESPONSE" ]; then
|
||||||
|
echo "Error: No response from Ollama"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$JSON" ]; then
|
RESULT=$(echo "$RESPONSE" | jq -r '.response' 2>/dev/null)
|
||||||
echo "Could not parse response as JSON"
|
|
||||||
echo "assessment=FAIL" >> $GITHUB_OUTPUT
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
ASSESSMENT=$(echo "$JSON" | jq -r '.assessment')
|
if [ -z "$RESULT" ] || [ "$RESULT" = "null" ]; then
|
||||||
TONE=$(echo "$JSON" | jq -r '.tone')
|
echo "Error: Could not extract response from Ollama"
|
||||||
UNDERSTANDABILITY=$(echo "$JSON" | jq -r '.understandability')
|
echo "Response was: $RESPONSE"
|
||||||
REASON=$(echo "$JSON" | jq -r '.reason')
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "assessment=$ASSESSMENT" >> $GITHUB_OUTPUT
|
echo "Ollama response:"
|
||||||
echo "tone=$TONE" >> $GITHUB_OUTPUT
|
echo "$RESULT"
|
||||||
echo "understandability=$UNDERSTANDABILITY" >> $GITHUB_OUTPUT
|
echo "validation_result=$RESULT" >> $GITHUB_OUTPUT
|
||||||
echo "reason=$REASON" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
echo "---"
|
|
||||||
echo "Assessment: $ASSESSMENT"
|
|
||||||
echo "Tone: $TONE"
|
|
||||||
echo "Understandability: $UNDERSTANDABILITY"
|
|
||||||
echo "Reason: $REASON"
|
|
||||||
|
|
||||||
- name: Block if assessment fails
|
- name: Block if assessment fails
|
||||||
if: steps.extract.outputs.content_found == 'true'
|
if: steps.extract.outputs.content_found == 'true'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue