Upload folder using huggingface_hub
Browse files- create_character/prsonal_profile(gradio).py +6 -0
- demo.py +15 -6
- play_game/main.py +22 -1
- tutle_game.py +41 -0
- tutle_game_prompt.py +88 -0
create_character/prsonal_profile(gradio).py
CHANGED
@@ -41,6 +41,7 @@ def generate_character_creation_questions(api_key, world_summary, language="kore
|
|
41 |
print(f"Error generating questions: {e}")
|
42 |
continue
|
43 |
|
|
|
44 |
def create_character_profile(api_key, questions, answers, language="korean"):
|
45 |
llm = ChatUpstage(api_key=api_key)
|
46 |
character_creation_prompt_template = PromptTemplate.from_template(
|
@@ -75,6 +76,7 @@ def create_character_profile(api_key, questions, answers, language="korean"):
|
|
75 |
character_description = character_creation_chain.invoke({"qna": qna, "Language": language})
|
76 |
return character_description
|
77 |
|
|
|
78 |
def parse_character_data_to_json(text):
|
79 |
fields = {
|
80 |
'name': r"- name: (.*)",
|
@@ -103,6 +105,7 @@ def parse_character_data_to_json(text):
|
|
103 |
character_dict['params'] = params_dict
|
104 |
return character_dict
|
105 |
|
|
|
106 |
def run_question_generation(api_key, file_path):
|
107 |
# Read the world summary from the uploaded file
|
108 |
with open(file_path, 'r', encoding='utf-8') as file:
|
@@ -113,6 +116,7 @@ def run_question_generation(api_key, file_path):
|
|
113 |
|
114 |
return questions
|
115 |
|
|
|
116 |
def run_profile_generation(api_key, file_path, *answers):
|
117 |
questions = run_question_generation(api_key, file_path)
|
118 |
|
@@ -121,6 +125,7 @@ def run_profile_generation(api_key, file_path, *answers):
|
|
121 |
character_json = parse_character_data_to_json(character_description)
|
122 |
return character_description, json.dumps(character_json, indent=4, ensure_ascii=False)
|
123 |
|
|
|
124 |
def main():
|
125 |
with gr.Blocks() as demo:
|
126 |
gr.Markdown("## Fantasy RPG Character Creator")
|
@@ -166,5 +171,6 @@ def main():
|
|
166 |
# Launch the Gradio interface
|
167 |
demo.launch()
|
168 |
|
|
|
169 |
if __name__ == "__main__":
|
170 |
main()
|
|
|
41 |
print(f"Error generating questions: {e}")
|
42 |
continue
|
43 |
|
44 |
+
|
45 |
def create_character_profile(api_key, questions, answers, language="korean"):
|
46 |
llm = ChatUpstage(api_key=api_key)
|
47 |
character_creation_prompt_template = PromptTemplate.from_template(
|
|
|
76 |
character_description = character_creation_chain.invoke({"qna": qna, "Language": language})
|
77 |
return character_description
|
78 |
|
79 |
+
|
80 |
def parse_character_data_to_json(text):
|
81 |
fields = {
|
82 |
'name': r"- name: (.*)",
|
|
|
105 |
character_dict['params'] = params_dict
|
106 |
return character_dict
|
107 |
|
108 |
+
|
109 |
def run_question_generation(api_key, file_path):
|
110 |
# Read the world summary from the uploaded file
|
111 |
with open(file_path, 'r', encoding='utf-8') as file:
|
|
|
116 |
|
117 |
return questions
|
118 |
|
119 |
+
|
120 |
def run_profile_generation(api_key, file_path, *answers):
|
121 |
questions = run_question_generation(api_key, file_path)
|
122 |
|
|
|
125 |
character_json = parse_character_data_to_json(character_description)
|
126 |
return character_description, json.dumps(character_json, indent=4, ensure_ascii=False)
|
127 |
|
128 |
+
|
129 |
def main():
|
130 |
with gr.Blocks() as demo:
|
131 |
gr.Markdown("## Fantasy RPG Character Creator")
|
|
|
171 |
# Launch the Gradio interface
|
172 |
demo.launch()
|
173 |
|
174 |
+
|
175 |
if __name__ == "__main__":
|
176 |
main()
|
demo.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
from create_world.creator_gradio import create_custom_world, create_scenario, create_storyline
|
4 |
from create_world.utils import load_txt
|
@@ -10,11 +11,6 @@ from play_game.formatter import player_profile_to_str, to_round_result
|
|
10 |
# 2. Character Creation
|
11 |
# 3. Game Play
|
12 |
|
13 |
-
# topic, world_summary = create_custom_world(config['create_custom_world_prompt'], language='νκ΅μ΄', save=False)
|
14 |
-
# scenario = create_scenario(topic, world_summary, config['create_scenario_prompt'], output_count=1)
|
15 |
-
# round_stories = create_storyline(topic, scenario[0], config['create_storyline_prompt'])
|
16 |
-
|
17 |
-
|
18 |
def main():
|
19 |
with gr.Blocks() as demo:
|
20 |
gr.Markdown("## LRPG")
|
@@ -109,11 +105,12 @@ def main():
|
|
109 |
game_start_btn = gr.Button("κ²μ μμ")
|
110 |
|
111 |
def click_game_start_btn():
|
112 |
-
return { round: 1, player_restriction: { "life":
|
113 |
game_start_btn.click(fn=click_game_start_btn, outputs=[round, player_restriction, player_capability])
|
114 |
else:
|
115 |
round_story = f"{_round}. {round_scenario['title']}: {round_scenario['story']}\n"
|
116 |
if _player_restriction["life"] <= 0 or _player_restriction["money"] <= 0:
|
|
|
117 |
bad_ending = create_bad_ending(_world_summary, player_profile_str, _player_restriction, _player_capability, entire_story, round_story, _previous_conversation, _previous_round_result)
|
118 |
display_bad_ending = gr.Markdown(bad_ending)
|
119 |
restart_button = gr.Button("λ€μ μμνκΈ°")
|
@@ -122,6 +119,7 @@ def main():
|
|
122 |
restart_button.click(fn=click_restart_button, outputs=[round, player_restriction, player_capability, previous_conversation, previous_round_result])
|
123 |
|
124 |
elif _round >= len(_stories):
|
|
|
125 |
good_ending = create_good_ending(_world_summary, player_profile_str, _player_restriction, _player_capability, entire_story, _previous_conversation)
|
126 |
display_good_ending = gr.Markdown(good_ending)
|
127 |
restart_button = gr.Button("λ€μ μμνκΈ°")
|
@@ -198,6 +196,17 @@ def main():
|
|
198 |
outputs=[round, previous_conversation, previous_round_result, player_restriction, player_capability]
|
199 |
)
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
# # For Debugging
|
203 |
# game_topic_debugging = gr.Textbox(game_topic.value, label="game_topic_debugging")
|
|
|
1 |
import gradio as gr
|
2 |
+
import re
|
3 |
|
4 |
from create_world.creator_gradio import create_custom_world, create_scenario, create_storyline
|
5 |
from create_world.utils import load_txt
|
|
|
11 |
# 2. Character Creation
|
12 |
# 3. Game Play
|
13 |
|
|
|
|
|
|
|
|
|
|
|
14 |
def main():
|
15 |
with gr.Blocks() as demo:
|
16 |
gr.Markdown("## LRPG")
|
|
|
105 |
game_start_btn = gr.Button("κ²μ μμ")
|
106 |
|
107 |
def click_game_start_btn():
|
108 |
+
return { round: 1, player_restriction: { "life": 20, "money": 20 }, player_capability: _player_profile["params"] }
|
109 |
game_start_btn.click(fn=click_game_start_btn, outputs=[round, player_restriction, player_capability])
|
110 |
else:
|
111 |
round_story = f"{_round}. {round_scenario['title']}: {round_scenario['story']}\n"
|
112 |
if _player_restriction["life"] <= 0 or _player_restriction["money"] <= 0:
|
113 |
+
gr.Markdown("## μμ½κ²λ κ²μ μ€λ²λμμ΅λλ€. λ€λ₯Έ μ νμ ν΅ν΄ μλ‘μ΄ μ΄μΌκΈ°μ κ²°λ§μ λ§λ€μ΄λ³΄μΈμ.")
|
114 |
bad_ending = create_bad_ending(_world_summary, player_profile_str, _player_restriction, _player_capability, entire_story, round_story, _previous_conversation, _previous_round_result)
|
115 |
display_bad_ending = gr.Markdown(bad_ending)
|
116 |
restart_button = gr.Button("λ€μ μμνκΈ°")
|
|
|
119 |
restart_button.click(fn=click_restart_button, outputs=[round, player_restriction, player_capability, previous_conversation, previous_round_result])
|
120 |
|
121 |
elif _round >= len(_stories):
|
122 |
+
gr.Markdown("## μΆνν©λλ€! κ²μ ν΄λ¦¬μ΄μ μ±κ³΅νμ
¨μ΅λλ€")
|
123 |
good_ending = create_good_ending(_world_summary, player_profile_str, _player_restriction, _player_capability, entire_story, _previous_conversation)
|
124 |
display_good_ending = gr.Markdown(good_ending)
|
125 |
restart_button = gr.Button("λ€μ μμνκΈ°")
|
|
|
196 |
outputs=[round, previous_conversation, previous_round_result, player_restriction, player_capability]
|
197 |
)
|
198 |
|
199 |
+
player_status_display = gr.Markdown(f"## {re.sub(r'\"', '', _player_profile['name'])}λμ μν")
|
200 |
+
with gr.Group():
|
201 |
+
with gr.Row():
|
202 |
+
gr.Textbox(_player_restriction['life'], interactive=False, label="λͺ©μ¨")
|
203 |
+
gr.Textbox(_player_restriction['money'], interactive=False, label="μμ§κΈ")
|
204 |
+
with gr.Row():
|
205 |
+
gr.Textbox(_player_capability["stamina"], interactive=False, label="μ€νλ―Έλ")
|
206 |
+
gr.Textbox(_player_capability["intelligence"], interactive=False, label="μ§λ₯")
|
207 |
+
gr.Textbox(_player_capability["combat_power"], interactive=False, label="μ ν¬λ ₯")
|
208 |
+
gr.Textbox(_player_capability["agility"], interactive=False, label="민첩μ±")
|
209 |
+
|
210 |
|
211 |
# # For Debugging
|
212 |
# game_topic_debugging = gr.Textbox(game_topic.value, label="game_topic_debugging")
|
play_game/main.py
CHANGED
@@ -155,6 +155,25 @@ def get_required_capabilities(world_summary, player_profile, player_restriction,
|
|
155 |
continue
|
156 |
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
def get_expected_result(world_summary, player_profile, player_restriction, player_capability, round_description, player_response):
|
159 |
llm = ChatUpstage()
|
160 |
prompt_template = PromptTemplate.from_template(
|
@@ -212,7 +231,8 @@ def get_expected_result(world_summary, player_profile, player_restriction, playe
|
|
212 |
|
213 |
if response.get('effect').get('player_restriction') == None or response.get("effect").get('player_capability') == None or response.get("reason") == None:
|
214 |
raise Exception()
|
215 |
-
|
|
|
216 |
return response
|
217 |
except:
|
218 |
continue
|
@@ -280,6 +300,7 @@ def get_unexpected_result(world_summary, player_profile, player_restriction, pla
|
|
280 |
if response.get('effect').get('player_restriction') == None or response.get("effect").get('player_capability') == None or response.get("reason") == None:
|
281 |
raise Exception()
|
282 |
|
|
|
283 |
return response
|
284 |
except:
|
285 |
continue
|
|
|
155 |
continue
|
156 |
|
157 |
|
158 |
+
def restrict_effect_range(effect):
|
159 |
+
new_restriction = effect.get('player_restriction')
|
160 |
+
new_capability = effect.get('player_capability')
|
161 |
+
|
162 |
+
for key, value in effect.get('player_restriction').items():
|
163 |
+
if value > 10:
|
164 |
+
new_restriction[key] = 10
|
165 |
+
elif value < -10:
|
166 |
+
new_capability[key] = -10
|
167 |
+
|
168 |
+
for key, value in effect.get('player_capability').items():
|
169 |
+
if value > 20:
|
170 |
+
new_capability[key] = 20
|
171 |
+
elif value < -20:
|
172 |
+
new_capability[key] = -20
|
173 |
+
|
174 |
+
return { "player_restriction": new_restriction, "player_capability": new_capability }
|
175 |
+
|
176 |
+
|
177 |
def get_expected_result(world_summary, player_profile, player_restriction, player_capability, round_description, player_response):
|
178 |
llm = ChatUpstage()
|
179 |
prompt_template = PromptTemplate.from_template(
|
|
|
231 |
|
232 |
if response.get('effect').get('player_restriction') == None or response.get("effect").get('player_capability') == None or response.get("reason") == None:
|
233 |
raise Exception()
|
234 |
+
|
235 |
+
response['effect'] = restrict_effect_range(response['effect'])
|
236 |
return response
|
237 |
except:
|
238 |
continue
|
|
|
300 |
if response.get('effect').get('player_restriction') == None or response.get("effect").get('player_capability') == None or response.get("reason") == None:
|
301 |
raise Exception()
|
302 |
|
303 |
+
response['effect'] = restrict_effect_range(response['effect'])
|
304 |
return response
|
305 |
except:
|
306 |
continue
|
tutle_game.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from create_world.creator import generate_chain
|
2 |
+
from create_world.utils import save_json
|
3 |
+
|
4 |
+
from tutle_game_prompt import sys_prompt, game_prompt
|
5 |
+
|
6 |
+
from langchain_upstage import ChatUpstage
|
7 |
+
|
8 |
+
import ast
|
9 |
+
|
10 |
+
from dotenv import load_dotenv
|
11 |
+
load_dotenv()
|
12 |
+
|
13 |
+
|
14 |
+
def create_tutle_game_scenario(llm=ChatUpstage()):
|
15 |
+
prompt = sys_prompt
|
16 |
+
while(True):
|
17 |
+
try:
|
18 |
+
storyline = generate_chain(prompt, prompt_variable={}, llm=llm)
|
19 |
+
storyline_dict= ast.literal_eval(storyline)
|
20 |
+
return storyline_dict
|
21 |
+
except:
|
22 |
+
continue
|
23 |
+
|
24 |
+
|
25 |
+
def tutle_game_qa(question, storyline_dict, llm):
|
26 |
+
prompt = game_prompt
|
27 |
+
prompt_variable = {'question': question,
|
28 |
+
'game_story' :storyline_dict['game_story'],
|
29 |
+
'game_answer':storyline_dict['game_answer']}
|
30 |
+
|
31 |
+
return generate_chain(prompt, prompt_variable, llm =llm)
|
32 |
+
|
33 |
+
|
34 |
+
if __name__ == '__main__':
|
35 |
+
story_dict = create_tutle_game_scenario()
|
36 |
+
print(story_dict)
|
37 |
+
chance = 1
|
38 |
+
|
39 |
+
for i in range(chance):
|
40 |
+
question = input('μ§λ¬Έμ μ
λ ₯νμΈμ :')
|
41 |
+
tutle_game_qa(question, story_dict)
|
tutle_game_prompt.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
sys_prompt = """λ°λ€κ±°λΆ μ€ν κ²μμ νλ€.
|
2 |
+
AIλ μΆμ μμ΄λ€.
|
3 |
+
λνμλ κ²μ μ°Έκ°μμ΄λ€.
|
4 |
+
|
5 |
+
κ²μμ λ°©λ²μ μλμ κ°λ€.
|
6 |
+
1. μΆμ μκ° (μ΄μΌκΈ° νμμ) μμκ»λΌ(Game Story)λ₯Ό λ§λ€μ΄ μΆμ νλ€.
|
7 |
+
2. μ°Έκ°μλ€μ μΆμ μμκ² μ€λ¬΄κ³ κ° νμμ μ§λ¬Ένκ³ , μΆμ μλ κ·Έμ λν λλ΅μ νλ€.
|
8 |
+
3. μ 보λ₯Ό ν΅ν΄ μ°Έκ°μλ€μ μ΄μΌκΈ°μ μ λ§μ μΆλ¦¬νλ€.
|
9 |
+
4. μ°Έκ°μκ° μ λ΅μ λ§μΆλ©΄ κ²μμ΄ λλλ€.
|
10 |
+
5. μ°Έκ°μμ μ§λ¬Έμ΄ μ λ΅μ κ·Όμ νλ©΄ ννΈλ₯Ό μ€λ€.
|
11 |
+
5. 5λ²μ μ§λ¬Έμλ λ΅μ λ§μΆμ§ λͺ»νλ©΄ μΆμ μλ μ λ΅(answer) 곡κ°νλ€.
|
12 |
+
|
13 |
+
κ²μμ μ€ν 리μ μμμ΄λ€.
|
14 |
+
κ·Έ λ¬Έμ λ λ€μκ³Ό κ°λ€.
|
15 |
+
|
16 |
+
''' game_Story :
|
17 |
+
ν λ¨μκ°, μ΄λ λ°λ·κ° λ μ€ν λμμ λ°λ€κ±°λΆ μνλ₯Ό μ£Όλ¬ΈνμΌλ©° κ·Έ λ¨μλ λ°λ€κ±°λΆ μνλ₯Ό ν μμ λ¨Ήκ³ λ μ£Όλ°©μ₯μ λΆλ λ€.
|
18 |
+
βμ£μ‘ν©λλ€. μ΄κ±° μ λ§λ‘ λ°λ€κ±°λΆ μνμΈκ°μ?β
|
19 |
+
βλ€, νλ¦Όμλ λ°λ€κ±°λΆ μν λ§μ΅λλ€.β
|
20 |
+
λ¨μλ κ³μ°μ λ§μΉ λ€ μ§μ λμκ°μ μμ΄νλ€.
|
21 |
+
μ κ·Έλ¬μκΉ?
|
22 |
+
'''
|
23 |
+
|
24 |
+
λ¬Έμ κ° μΆμ λλ©΄, μ°Έκ°νλ μ¬λ¬ μ¬λλ€μ μΆμ μκ° μ/μλμλ‘ λλ΅ν μ μλ μ§λ¬Έμ νκ² λλ€.
|
25 |
+
λ°λ·κ° λ μ€ν λμΈ κ² μ€μν©λκΉ?
|
26 |
+
λ¨μλ λΉμ μ§κ³ μμ΅λκΉ?
|
27 |
+
λ¨μκ° μμ΄ν κ²μ μνλ₯Ό λ¨Ήμ κ²μ΄ μμΈμ
λκΉ?
|
28 |
+
μ£Όλ°©μ₯μ λ¨μμ
λκΉ?
|
29 |
+
|
30 |
+
μ΄λ¬ν μ§λ¬Έμ μΆμ μλ νλνλ λλ΅ν΄ κ°λ€. μ΄ λμ΄λ λ΅μ λͺ» λ§νλ©΄ μΆμ μκ° μ΄κΈ°λ κ·Έλ° λμ΄κ° μλλΌ μ΄λ»κ² μ¬λ―Έμκ² λ΅μ μΆμΈ‘ν΄ κ°λλ, μΌλ§λ λ μΉ΄λ‘μ΄ μ§λ¬Έμ νλλκ° μ€μνκΈ° λλ¬Έμ μ¦κ±°μ΄ νλ μ΄λ₯Ό μν΄μλ μΆμ μμ μ μ ν λλ΅ μ€ν¬μ΄ μꡬλλ€.
|
31 |
+
λ°λ·κ° λ μ€ν λμΈ κ² μ€μν©λκΉ? β μ/μλμλ‘ λλ΅ν μ μλ μ§λ¬Έμ
λλ€.
|
32 |
+
λ¨μλ λΉμ μ§κ³ μμ΅λκΉ? β μλμ.
|
33 |
+
λ¨μκ° μμ΄ν κ²μ μνλ₯Ό λ¨Ήμ κ²μ΄ μμΈμ
λκΉ? β μ.
|
34 |
+
μ£Όλ°©μ₯μ λ¨μμ
λκΉ? β μ.
|
35 |
+
|
36 |
+
λ¬Όλ‘ λλ€μμ μ§λ¬Έμ μ€μ λ¬Έμ μν©κ³Ό μλ¬΄λ° κ΄κ³κ° μλλ°, μ΄ κ²½μ° μ¬νμλ μ/μλμ€ μ€ μ무거λ λλ΅νλ©΄ λλ€. λ¬Όλ‘ μ°Έκ°μλ€μ μ΄κ²μ΄ 무μλ―Έν μ§λ¬ΈμΈμ§ μ μ μλ€.
|
37 |
+
|
38 |
+
μΆμ μμμ λ¬Έλ΅μΌλ‘ μ»λ μ 보λ€μ κ°μ§κ³ μ°Έκ°μλ€μ μλ‘ ν λ‘ νκΈ°λ νκ³ λ
μμ μΌλ‘ μΆλ¦¬νκΈ°λ νλ©΄μ μ΄μΌκΈ°μ λ―Έμ€ν°λ¦¬λ₯Ό νμ΄λκ°λ€.
|
39 |
+
μ μν μ’ λ¨Ήμλ€κ³ μμ΄νμ§?
|
40 |
+
λ¨μμ κ³Όκ±°μ λ¬΄μ¨ μΌμ΄ μμλ κ² κ°μλ°?
|
41 |
+
λ°λ€κ±°λΆ μνλ λ§μλ?
|
42 |
+
μ리μ¬κ° μ
λΉμΈκ°?
|
43 |
+
λ°λ€κ±°λΆμ΄λΌλ μ¬λ£κ° μ€μνκ°?
|
44 |
+
|
45 |
+
μ΄λ¬ν κ³Όμ μμ μ΅μ’
μ μΌλ‘λ λκ΅°κ°κ° μ λ΅, λλ μ λ΅κ³Ό μμ£Ό κ°κΉμ΄ μ§λ¬Έμ νκ² λλ€. λκ° λ¬΄λ₯΄μ΅μλ€κ³ μκ°λλ©΄ μΆμ μλ λ΅μ λ§ν μ¬λκ³Ό λ€λ₯Έ μ°Έκ°μλ€μ μΉμ°¬νκ³ λ―Έλ¦¬ μ€λΉν΄ λ ν΄λ΅λ¬Έμ 곡κ°νλ€.
|
46 |
+
|
47 |
+
'''game_answer:
|
48 |
+
λ¨μλ λ°°λ₯Ό νκ³ μμλλ° λ¨μκ° ν λ°°κ° μ‘°λλμλ€. λͺ λͺ
μ λ€λ₯Έ μ¬λλ€κ³Ό ν¨κ» ꡬλͺ
보νΈλ₯Ό νμ μ£½μμ λ©΄νμ§λ§, μμ μ¬μ νλ₯νλ μ²μ§κ° λμλ€.
|
49 |
+
μμ¬λ£κ° λ¨μ΄μ§ μΌνμ 체λ ₯μ΄ λ¨μ΄μ§λ μ¬λλΆν° μ£½μ΄κ°κΈ° μμνλ€. κ²°κ΅, μ΄μλ¨μ μ¬λλ€μ μ΄κΈ° μνμ¬ μ체μ μ΄μ λ¨ΉκΈ° μμνμ§λ§, λ¨ ν μ¬λμ μ΄ νμλ₯Ό κ°λ ₯νκ² κ±°λΆνλ€. λΉμ°ν κ·Έ λ¨μλ μμν μ£½μ΄κ°κ² λμλ€.
|
50 |
+
μ΄ κΌ΄μ κ°λ§ν λ μ μμλ λ€λ₯Έ μ¬λ μ€ νλκ° βμ΄κ±΄ λ°λ€κ±°λΆ μνμΌβλΌκ³ κ±°μ§λ§μ ν λ€μ λ¨μμκ² μνλ₯Ό λ¨Ήμ¬μ, ꡬ쑰λ λκΉμ§ μ΄μλ¨μ μ μμλ€.
|
51 |
+
|
52 |
+
κ·Έ λ€ λ μ€ν λμμ λͺ
λ°±νκ² λ§μ΄ μ ν λ€λ₯Έ μ΄ μ§μ§ λ°λ€κ±°λΆ μνλ₯Ό μ§λ©΄νκ² λ λ¨μλ μμ μ΄ μΈμ‘μ λ¨Ήμλ€λ μ§μ€μ μκ² λ λ€ μ£μ±
κ°μ λͺ©μ¨μ λμλ€.
|
53 |
+
'''
|
54 |
+
|
55 |
+
game_storyλ μΆλ¦¬ν λ°°κ²½μ μ€λͺ
νλ€. λ§μΆ°μΌν λͺ©μ μ μ ννκ² μλ¬Έλ¬ΈμΌλ‘ μ μνλ€.
|
56 |
+
game_answerλ μΆλ¦¬ λ΄μ©μ μ λ΅μ΄λ€.
|
57 |
+
|
58 |
+
μ λ΄μ©μ λ°νμΌλ‘ νλμ μλ‘μ΄ μμκΉ¨λΌμ μλ리μ€λ₯Ό dict νμμΌλ‘ λ§λ€μ΄λΌ.
|
59 |
+
λ³μμ μ μ₯νμ§ μκ³ μ€κ΄νΈλ‘λ§ μΆλ ₯νλ€
|
60 |
+
"""
|
61 |
+
|
62 |
+
game_prompt = """μΆλ¦¬κ²μμ νλ€.
|
63 |
+
AIλ μΆμ μμ΄λ€.
|
64 |
+
λνμλ κ²μ μ°Έκ°μμ΄λ€.
|
65 |
+
AIλ Game storyμ Game answerλ₯Ό μ½κ³ λνμμ μ§λ¬Έμ λ΅νλ€.
|
66 |
+
|
67 |
+
κ²μμ λ°©λ²μ μλμ κ°λ€.
|
68 |
+
1. μΆμ μκ° (μ΄μΌκΈ° νμμ) μμκ»λΌ(Game Story)λ₯Ό λ§λ€μ΄ μΆμ νλ€.
|
69 |
+
2. μ°Έκ°μλ€μ μΆμ μμκ² μ€λ¬΄κ³ κ° νμμ μ§λ¬Ένκ³ , μΆμ μλ κ·Έμ λν λλ΅μ νλ€.
|
70 |
+
3. μ 보λ₯Ό ν΅ν΄ μ°Έκ°μλ€μ μ΄μΌκΈ°μ μ λ§μ μΆλ¦¬νλ€.
|
71 |
+
4. μ°Έκ°μκ° μ λ΅μ λ§μΆλ©΄ κ²μμ΄ λλλ€.
|
72 |
+
5. μ°Έκ°μμ μ§λ¬Έμ΄ μ λ΅μ κ·Όμ νλ©΄ ννΈλ₯Ό μ€λ€.
|
73 |
+
5. 5λ²μ μ§λ¬Έμλ λ΅μ λ§μΆμ§ λͺ»νλ©΄ μΆμ μλ μ λ΅(Game answer) 곡κ°νλ€.
|
74 |
+
|
75 |
+
|
76 |
+
Game Story :{game_story}
|
77 |
+
|
78 |
+
Game answer:{game_answer}
|
79 |
+
|
80 |
+
Game Storyλ₯Ό κΈ°μ€μΌλ‘ Questionμ 'μ', 'μλμ€', 'μ/μλμλ‘ λλ΅ν μ μλ μ§λ¬Έμ
λλ€.'λ‘ λ΅λ³νλΌ.
|
81 |
+
μ§λ¬Έμκ° 'ννΈ'λ₯Ό μꡬνλ©΄ λ΄μ©μ ννΈλ₯Ό μ€λ€. λ¨ ννΈκ° μ λ΅μ λ무 μ§μ μ μΈ μ 보λ μ λλ€.
|
82 |
+
μ§λ¬Έμκ° μ λ΅μ μλ €λ¬λΌκ³ νλ©΄ 'Game answer'μ λ΄μ©μ λ΅νλ€.
|
83 |
+
μ§λ¬Έμκ° 'μ λ΅!' μΈμΉκ³ μ λ΅μ λ§μΆλ©΄ 'μ λ΅μ
λλ€!'λΌκ³ λ§νλ€. κ·Έλ¦¬κ³ 'Game answer'μ ν΄μ€μ μ€λ€.
|
84 |
+
|
85 |
+
Question: {question}
|
86 |
+
|
87 |
+
Answer:
|
88 |
+
"""
|