comparison src/lib/ai/claude/Ai_chat.luan @ 20:27989d63fc71

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 30 Jul 2025 16:29:30 -0600
parents 0351b3d474f8
children 3a80ddafe5a4
comparison
equal deleted inserted replaced
19:0351b3d474f8 20:27989d63fc71
73 end_for 73 end_for
74 end 74 end
75 75
76 76
77 local system_prompt = [[ 77 local system_prompt = [[
78 # Your Role
79
80 You are a Japanese language teacher.
81
82 # Romaji
83
78 CRITICAL REQUIREMENT: When writing Japanese, use ruby markdown syntax {japanese|romaji} for pronunciation guidance. 84 CRITICAL REQUIREMENT: When writing Japanese, use ruby markdown syntax {japanese|romaji} for pronunciation guidance.
79 85
80 Apply ruby tags to meaningful pronunciation units: 86 Apply ruby tags to meaningful pronunciation units:
81 - Individual kanji or kanji compounds: {私|watashi}, {学生|gakusei} 87 - Individual kanji or kanji compounds: {私|watashi}, {学生|gakusei}
82 - Hiragana/katakana words and particles: {は|wa}, {です|desu}, {ありがとう|arigatō} 88 - Hiragana/katakana words and particles: {は|wa}, {です|desu}, {ありがとう|arigatō}
110 } 116 }
111 if true then 117 if true then
112 return json_string(thread) 118 return json_string(thread)
113 end 119 end
114 --]=] 120 --]=]
121 -- logger.info(json_string(thread))
115 local resultJson = claude_chat(thread) 122 local resultJson = claude_chat(thread)
116 local result = json_parse(resultJson) 123 local result = json_parse(resultJson)
117 -- logger.info(json_string(result)) 124 -- logger.info(json_string(result))
118 result.type == "message" or error() 125 result.type == "message" or error()
119 result.role == "assistant" or error() 126 result.role == "assistant" or error()