Spaces:
Running
Running
Commit
ยท
7edad11
1
Parent(s):
22bfd17
update to instructor's version
Browse files- app.py +187 -58
- openai_gradio_20250314_dynamic 1.ipynb +228 -0
app.py
CHANGED
|
@@ -1,64 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
""
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 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 |
-
demo = gr.ChatInterface(
|
| 47 |
-
respond,
|
| 48 |
-
additional_inputs=[
|
| 49 |
-
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 50 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 51 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 52 |
-
gr.Slider(
|
| 53 |
-
minimum=0.1,
|
| 54 |
-
maximum=1.0,
|
| 55 |
-
value=0.95,
|
| 56 |
-
step=0.05,
|
| 57 |
-
label="Top-p (nucleus sampling)",
|
| 58 |
-
),
|
| 59 |
],
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
if __name__ == "__main__":
|
| 64 |
demo.launch()
|
|
|
|
| 1 |
+
# import gradio as gr
|
| 2 |
+
# from huggingface_hub import InferenceClient
|
| 3 |
+
|
| 4 |
+
# """
|
| 5 |
+
# For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
+
# """
|
| 7 |
+
# client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# def respond(
|
| 11 |
+
# message,
|
| 12 |
+
# history: list[tuple[str, str]],
|
| 13 |
+
# system_message,
|
| 14 |
+
# max_tokens,
|
| 15 |
+
# temperature,
|
| 16 |
+
# top_p,
|
| 17 |
+
# ):
|
| 18 |
+
# messages = [{"role": "system", "content": system_message}]
|
| 19 |
+
|
| 20 |
+
# for val in history:
|
| 21 |
+
# if val[0]:
|
| 22 |
+
# messages.append({"role": "user", "content": val[0]})
|
| 23 |
+
# if val[1]:
|
| 24 |
+
# messages.append({"role": "assistant", "content": val[1]})
|
| 25 |
+
|
| 26 |
+
# messages.append({"role": "user", "content": message})
|
| 27 |
+
|
| 28 |
+
# response = ""
|
| 29 |
+
|
| 30 |
+
# for message in client.chat_completion(
|
| 31 |
+
# messages,
|
| 32 |
+
# max_tokens=max_tokens,
|
| 33 |
+
# stream=True,
|
| 34 |
+
# temperature=temperature,
|
| 35 |
+
# top_p=top_p,
|
| 36 |
+
# ):
|
| 37 |
+
# token = message.choices[0].delta.content
|
| 38 |
+
|
| 39 |
+
# response += token
|
| 40 |
+
# yield response
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
# """
|
| 44 |
+
# For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 45 |
+
# """
|
| 46 |
+
# demo = gr.ChatInterface(
|
| 47 |
+
# respond,
|
| 48 |
+
# additional_inputs=[
|
| 49 |
+
# gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 50 |
+
# gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 51 |
+
# gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 52 |
+
# gr.Slider(
|
| 53 |
+
# minimum=0.1,
|
| 54 |
+
# maximum=1.0,
|
| 55 |
+
# value=0.95,
|
| 56 |
+
# step=0.05,
|
| 57 |
+
# label="Top-p (nucleus sampling)",
|
| 58 |
+
# ),
|
| 59 |
+
# ],
|
| 60 |
+
# )
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
# if __name__ == "__main__":
|
| 64 |
+
# demo.launch()
|
| 65 |
+
|
| 66 |
+
|
| 67 |
import gradio as gr
|
| 68 |
+
import requests
|
| 69 |
+
import re
|
| 70 |
+
|
| 71 |
+
# endpoint :
|
| 72 |
+
deployment_name = "fimtrus-gpt-4o-ncus"
|
| 73 |
+
endpoint = "https://fimtrus-openai-ncus.openai.azure.com/openai/deployments/{}/chat/completions".format(deployment_name)
|
| 74 |
+
api_key = "FP7k76c0BGmz4MVot1LVqdtqcmQaKBeerYdFyXzW4NXN0940rRfEJQQJ99BCACHrzpqXJ3w3AAABACOG8189"
|
| 75 |
+
|
| 76 |
+
ai_search_endpoint = "https://fimtrus-ai-search3.search.windows.net"
|
| 77 |
+
ai_search_key = "lw8TYxNHT14hpM5oJQhCL3iOxR4PR494dV4RLDaiwzAzSeBecA5i"
|
| 78 |
+
ai_search_index_name = "travel-index-microsoft2"
|
| 79 |
+
ai_search_semantic = "travel-semantic"
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def request_gpt(prompt):
|
| 83 |
+
query_params = {
|
| 84 |
+
"api-version": "2025-02-01-preview"
|
| 85 |
+
}
|
| 86 |
+
headers = {
|
| 87 |
+
"Content-Type": "application/json",
|
| 88 |
+
"api-key": api_key
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
body = {
|
| 92 |
+
"data_sources": [
|
| 93 |
+
{
|
| 94 |
+
"type": "azure_search",
|
| 95 |
+
"parameters": {
|
| 96 |
+
"endpoint": ai_search_endpoint,
|
| 97 |
+
"index_name": ai_search_index_name,
|
| 98 |
+
"semantic_configuration": ai_search_semantic,
|
| 99 |
+
"query_type": "semantic",
|
| 100 |
+
"fields_mapping": {},
|
| 101 |
+
"in_scope": True,
|
| 102 |
+
"filter": None,
|
| 103 |
+
"strictness": 3,
|
| 104 |
+
"top_n_documents": 3,
|
| 105 |
+
"authentication": {
|
| 106 |
+
"type": "api_key",
|
| 107 |
+
"key": ai_search_key
|
| 108 |
+
},
|
| 109 |
+
"key": ai_search_key
|
| 110 |
+
}
|
| 111 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
],
|
| 113 |
+
"messages": [
|
| 114 |
+
{
|
| 115 |
+
"role": "system",
|
| 116 |
+
"content": "์ฌ์ฉ์๊ฐ ์ ๋ณด๋ฅผ ์ฐพ๋ ๋ฐ ๋์์ด ๋๋ AI ๋์ฐ๋ฏธ์
๋๋ค."
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"role": "user",
|
| 120 |
+
"content": prompt
|
| 121 |
+
}
|
| 122 |
+
],
|
| 123 |
+
"temperature": 0.7,
|
| 124 |
+
"top_p": 0.95,
|
| 125 |
+
"max_tokens": 800,
|
| 126 |
+
"stop": None,
|
| 127 |
+
"stream": False,
|
| 128 |
+
"frequency_penalty": 0,
|
| 129 |
+
"presence_penalty": 0
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
response = requests.post(endpoint, params=query_params, headers=headers, json=body)
|
| 133 |
+
|
| 134 |
+
if response.status_code == 200:
|
| 135 |
+
response_json = response.json()
|
| 136 |
+
message = response_json['choices'][0]['message']
|
| 137 |
+
content = message['content']
|
| 138 |
+
|
| 139 |
+
content = re.sub(r'\[doc(\d+)\]', r'[์ฐธ์กฐ \1]', content)
|
| 140 |
+
|
| 141 |
+
if message['context']:
|
| 142 |
+
citation_list = message['context']['citations']
|
| 143 |
+
else:
|
| 144 |
+
citation_list = list()
|
| 145 |
+
return content, citation_list
|
| 146 |
+
else:
|
| 147 |
+
return "", list()
|
| 148 |
|
| 149 |
+
with gr.Blocks() as demo:
|
| 150 |
+
|
| 151 |
+
citation_state = gr.State([])
|
| 152 |
+
|
| 153 |
+
def click_send(prompt, histories):
|
| 154 |
+
print(prompt)
|
| 155 |
+
content, citation_list = request_gpt(prompt=prompt)
|
| 156 |
+
message_list = [{"role": "user", "content": prompt}, {"role": "assistant", "content": content}]
|
| 157 |
+
histories.extend(message_list)
|
| 158 |
+
|
| 159 |
+
print(histories)
|
| 160 |
+
print(len(citation_list), citation_list)
|
| 161 |
+
return histories, citation_list, ""
|
| 162 |
+
|
| 163 |
+
def select_tab(citation):
|
| 164 |
+
print("tab!!!!!!")
|
| 165 |
+
return gr.Textbox(label="", value=citation, lines=10, max_lines=10, visible=True)
|
| 166 |
+
|
| 167 |
+
gr.Markdown("# ๋์ GPT ์๋")
|
| 168 |
+
|
| 169 |
+
with gr.Row():
|
| 170 |
+
chatbot = gr.Chatbot(label="๋์ GPT", type="messages", scale=3)
|
| 171 |
+
|
| 172 |
+
with gr.Column(scale=1):
|
| 173 |
+
@gr.render(inputs=[citation_state])
|
| 174 |
+
def render_citations(citations):
|
| 175 |
+
print(citations)
|
| 176 |
+
for index in range(len(citations)):
|
| 177 |
+
content = citations[index]['content']
|
| 178 |
+
key = "์ฐธ์กฐ{}".format(index + 1)
|
| 179 |
+
if index == 0:
|
| 180 |
+
gr.Tab("", id=-1, visible=False)
|
| 181 |
+
with gr.Tab(key) as tab:
|
| 182 |
+
citation_textbox = gr.Textbox(label="", value=content, lines=10, max_lines=10, visible=False)
|
| 183 |
+
tab.select(fn=select_tab, inputs=[citation_textbox], outputs=[citation_textbox])
|
| 184 |
+
|
| 185 |
+
with gr.Row():
|
| 186 |
+
prompt_textbox = gr.Textbox(label="ํ๋กฌํํธ", placeholder="ํ๋กฌํํธ๋ฅผ ์
๋ ฅํ์ธ์.", scale=6)
|
| 187 |
+
send_button = gr.Button("์ ์ก", scale=1)
|
| 188 |
+
|
| 189 |
+
send_button.click(click_send, inputs=[prompt_textbox, chatbot], outputs=[chatbot, citation_state, prompt_textbox])
|
| 190 |
+
prompt_textbox.submit(click_send, inputs=[prompt_textbox, chatbot], outputs=[chatbot, citation_state, prompt_textbox])
|
| 191 |
|
| 192 |
if __name__ == "__main__":
|
| 193 |
demo.launch()
|
openai_gradio_20250314_dynamic 1.ipynb
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": null,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [
|
| 8 |
+
{
|
| 9 |
+
"name": "stdout",
|
| 10 |
+
"output_type": "stream",
|
| 11 |
+
"text": [
|
| 12 |
+
"* Running on local URL: http://127.0.0.1:7870\n",
|
| 13 |
+
"\n",
|
| 14 |
+
"To create a public link, set `share=True` in `launch()`.\n"
|
| 15 |
+
]
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"data": {
|
| 19 |
+
"text/html": [
|
| 20 |
+
"<div><iframe src=\"http://127.0.0.1:7870/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
| 21 |
+
],
|
| 22 |
+
"text/plain": [
|
| 23 |
+
"<IPython.core.display.HTML object>"
|
| 24 |
+
]
|
| 25 |
+
},
|
| 26 |
+
"metadata": {},
|
| 27 |
+
"output_type": "display_data"
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"data": {
|
| 31 |
+
"text/plain": []
|
| 32 |
+
},
|
| 33 |
+
"execution_count": 11,
|
| 34 |
+
"metadata": {},
|
| 35 |
+
"output_type": "execute_result"
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"name": "stdout",
|
| 39 |
+
"output_type": "stream",
|
| 40 |
+
"text": [
|
| 41 |
+
"[]\n",
|
| 42 |
+
"์๋ฉด ๊ฐ๋งํ๊ณณ\n",
|
| 43 |
+
"[{'role': 'user', 'content': '์๋ฉด ๊ฐ๋งํ๊ณณ'}, {'role': 'assistant', 'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด์์ ๊ฐ๋งํ ๊ณณ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:\\n\\n1. **์คํฌ์ธ ํํฌ**: ์ด๊ณณ์ ๋จํด๊ตฐ์ ๋ํ์ ์ธ ์ถ๊ตฌ ํ๋ จ์ฅ์ผ๋ก, ๊ณ์ ์ ๊ด๊ณ์์ด ์ฌ์ฉ ๊ฐ๋ฅํ ์์ค์
๋๋ค. ์ ๊ตญ ๊ฐ์ง์ ์ ์งํ๋ จ๊ฐ๋ค์ด ๋ง์ด ์ฐพ๋ ๊ณณ์
๋๋ค [์ฐธ์กฐ 1].\\n - ์์น: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ์คํฌ์ธ ํํฌ๊ธธ 74\\n - ์ ํ๋ฒํธ: 055-860-8661\\n\\n2. **์ฅํญ๊ฑฐ๋ฆฌ**: ์ด๊ณณ์ ์ฌ๊ณ์ ๋ด๋ด ๊ฐ์กฑ ๋จ์ ๊ด๊ด๊ฐ๋ค์ด ์ฆ๊ธฐ๊ธฐ ์ข์ ์ฅ์์
๋๋ค [์ฐธ์กฐ 2].\\n - ์์น: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋จ์๋๋ก1517๋ฒ๊ธธ 31\\n\\n3. **๋ง์ด์ฐ ์ฒ ์ญ๊ตฐ๋ฝ์ง**: 5์์ ์ฒ ์ญ์ด ๋ง๊ฐํ๋ ์ด๊ณณ์ ๋ง์ ์ฌ๋๋ค์ด ์ฐพ๋ ๋ช
์์
๋๋ค. ์ ์๊น์ง๋ ์ฝ 1์๊ฐ 30๋ถ ์ ๋ ์์๋ฉ๋๋ค [์ฐธ์กฐ 3].\\n - ์์น: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋
ธ๊ตฌ๋ฆฌ ์ฐ 786m\\n - ์ ํ๋ฒํธ: 055-860-3676'}]\n",
|
| 44 |
+
"3 [{'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ์คํฌ์ธ ํํฌ๊ธธ 74\\n2002๋
์๋์ปต์ด ์ ์น๋๋ฉด์ ๋จํด์ ์ถ๊ตฌ์ด๊ธฐ๊ฐ ๊ณ ์กฐ๋์๋ค. ๋ง์ ์ด๋ค์ ์์์ ์ถฉ์กฑํ๊ธฐ ์ํด ์กฐ์ฑ๋ ๋จํด์ ์๋ ๊ตฌ์ฅ์ ๊ณ์ ์ ๊ด๊ณ์์ด ์ฌ์ฉํ ์ ์์ด ์ ๊ตญ๊ฐ์ง์ ์ ์งํ๋ จ๊ฐ๋ค์๊ฒ ์ฌ๋๋ฐ๊ณ ์๋ค. ์ฐ์ฑ
๋ก๊ฐ ์กฐ์ฑ๋์ด ์์ด ์ฐ์ฑ
ํ๊ธฐ๋ ์์ฑ๋ง์ถค์ด๋ค.\\nY\\n34.8054935\\n127.8337739\\n์คํฌ์ธ ํํฌ\\n055-860-8661\\n๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋ํ๋ก, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋จ์๋๋ก1517๋ฒ๊ธธ 31\\nN\\n34.8004847\\n127.8364069\\n์ฅํญ๊ฑฐ๋ฆฌ\\n๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋ํ๋ก\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋
ธ๊ตฌ๋ฆฌ ์ฐ98\\n786m, ๋จํด ์ต๊ณ ๋์ด๋ฅผ ์๋ํ๋ ๋ง์ด์ฐ. 5์์๋ ์ฒ ์ญ๊ตฐ๋ฝ์ง์ ๊ฝ๋ค์ด ๋ง๊ฐํด ๊ฐ์กฑ๋จ์๋ ์น๋ชฉํ ๋ฑ์ ๋ชจ์์์ ๋ง์ด ์ฐพ์์ค๋ฉฐ, ์ ์๊น์ง๋ 1์๊ฐ 30๋ถ์ ๋ ์์๋๋ค. ๋จํด์์์ ๊ด๊ด์๋ดํ์ ๋ฐ๋ผ ๋จํด๋๊ต ๋ฐฉํฅ์ผ๋ก 3๋ถ ์ ๋ ๊ฐ๋ฉด ๊ณ ํ๋ฉด ์ด์ด๋ง์์ด ๋ํ๋๋ค.\\nY\\n34.8569462\\n127.8514638\\n๋ง์ด์ฐ ์ฒ ์ญ๊ตฐ๋ฝ์ง\\n10\\n055-860-3676\\n๋ด, ์๊ฐ์ฉ/๋ ํธ, ๋ฒ์ค, ์ฐ์ ็ท, ๋ํ๋ก, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}]\n",
|
| 45 |
+
"[{'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ์คํฌ์ธ ํํฌ๊ธธ 74\\n2002๋
์๋์ปต์ด ์ ์น๋๋ฉด์ ๋จํด์ ์ถ๊ตฌ์ด๊ธฐ๊ฐ ๊ณ ์กฐ๋์๋ค. ๋ง์ ์ด๋ค์ ์์์ ์ถฉ์กฑํ๊ธฐ ์ํด ์กฐ์ฑ๋ ๋จํด์ ์๋ ๊ตฌ์ฅ์ ๊ณ์ ์ ๊ด๊ณ์์ด ์ฌ์ฉํ ์ ์์ด ์ ๊ตญ๊ฐ์ง์ ์ ์งํ๋ จ๊ฐ๋ค์๊ฒ ์ฌ๋๋ฐ๊ณ ์๋ค. ์ฐ์ฑ
๋ก๊ฐ ์กฐ์ฑ๋์ด ์์ด ์ฐ์ฑ
ํ๊ธฐ๋ ์์ฑ๋ง์ถค์ด๋ค.\\nY\\n34.8054935\\n127.8337739\\n์คํฌ์ธ ํํฌ\\n055-860-8661\\n๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋ํ๋ก, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋จ์๋๋ก1517๋ฒ๊ธธ 31\\nN\\n34.8004847\\n127.8364069\\n์ฅํญ๊ฑฐ๋ฆฌ\\n๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋ํ๋ก\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋
ธ๊ตฌ๋ฆฌ ์ฐ98\\n786m, ๋จํด ์ต๊ณ ๋์ด๋ฅผ ์๋ํ๋ ๋ง์ด์ฐ. 5์์๋ ์ฒ ์ญ๊ตฐ๋ฝ์ง์ ๊ฝ๋ค์ด ๋ง๊ฐํด ๊ฐ์กฑ๋จ์๋ ์น๋ชฉํ ๋ฑ์ ๋ชจ์์์ ๋ง์ด ์ฐพ์์ค๋ฉฐ, ์ ์๊น์ง๋ 1์๊ฐ 30๋ถ์ ๋ ์์๋๋ค. ๋จํด์์์ ๊ด๊ด์๋ดํ์ ๋ฐ๋ผ ๋จํด๋๊ต ๋ฐฉํฅ์ผ๋ก 3๋ถ ์ ๋ ๊ฐ๋ฉด ๊ณ ํ๋ฉด ์ด์ด๋ง์์ด ๋ํ๋๋ค.\\nY\\n34.8569462\\n127.8514638\\n๋ง์ด์ฐ ์ฒ ์ญ๊ตฐ๋ฝ์ง\\n10\\n055-860-3676\\n๋ด, ์๊ฐ์ฉ/๋ ํธ, ๋ฒ์ค, ์ฐ์ ็ท, ๋ํ๋ก, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}]\n",
|
| 46 |
+
"๋จํด์ ๊ฐ๋งํ๊ณณ\n",
|
| 47 |
+
"[{'role': 'user', 'metadata': {'title': None}, 'content': '์๋ฉด ๊ฐ๋งํ๊ณณ', 'options': None}, {'role': 'assistant', 'metadata': {'title': None}, 'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด์์ ๊ฐ๋งํ ๊ณณ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:\\n\\n1. **์คํฌ์ธ ํํฌ**: ์ด๊ณณ์ ๋จํด๊ตฐ์ ๋ํ์ ์ธ ์ถ๊ตฌ ํ๋ จ์ฅ์ผ๋ก, ๊ณ์ ์ ๊ด๊ณ์์ด ์ฌ์ฉ ๊ฐ๋ฅํ ์์ค์
๋๋ค. ์ ๊ตญ ๊ฐ์ง์ ์ ์งํ๋ จ๊ฐ๋ค์ด ๋ง์ด ์ฐพ๋ ๊ณณ์
๋๋ค [์ฐธ์กฐ 1].\\n - ์์น: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ์คํฌ์ธ ํํฌ๊ธธ 74\\n - ์ ํ๋ฒํธ: 055-860-8661\\n\\n2. **์ฅํญ๊ฑฐ๋ฆฌ**: ์ด๊ณณ์ ์ฌ๊ณ์ ๋ด๋ด ๊ฐ์กฑ ๋จ์ ๊ด๊ด๊ฐ๋ค์ด ์ฆ๊ธฐ๊ธฐ ์ข์ ์ฅ์์
๋๋ค [์ฐธ์กฐ 2].\\n - ์์น: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋จ์๋๋ก1517๋ฒ๊ธธ 31\\n\\n3. **๋ง์ด์ฐ ์ฒ ์ญ๊ตฐ๋ฝ์ง**: 5์์ ์ฒ ์ญ์ด ๋ง๊ฐํ๋ ์ด๊ณณ์ ๋ง์ ์ฌ๋๋ค์ด ์ฐพ๋ ๋ช
์์
๋๋ค. ์ ์๊น์ง๋ ์ฝ 1์๊ฐ 30๋ถ ์ ๋ ์์๋ฉ๋๋ค [์ฐธ์กฐ 3].\\n - ์์น: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋
ธ๊ตฌ๋ฆฌ ์ฐ 786m\\n - ์ ํ๋ฒํธ: 055-860-3676', 'options': None}, {'role': 'user', 'content': '๋จํด์ ๊ฐ๋งํ๊ณณ'}, {'role': 'assistant', 'content': '๊ฒฝ์๋จ๋ ๋จํด์์์ ๊ฐ๋งํ ๊ณณ์ผ๋ก๋ ๋ค์ ์ฅ์๋ค์ ์ถ์ฒ๋๋ฆฝ๋๋ค:\\n\\n1. **๋จํด๋ฌธํ์**\\n - ์ฃผ์: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ์ ์๋ก 12\\n - ์ ํ๋ฒํธ: 055-864-6969\\n - ๊ด๊ด์ง๋ก ์ถ์ฒ๋ฉ๋๋ค [์ฐธ์กฐ 1].\\n\\n2. **๋จํด๋ฌธํ์ผํฐ**\\n - ์ฃผ์: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ์ ์๋ก 12\\n - ์ ํ๋ฒํธ: 055-860-8621\\n - ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ์๋ ์ ํฉํ๋ฉฐ ์๊ฐ์ฉ, ๋ ํธ, ์น๊ตฌ, ๊ฐ์กฑ, ์ฐ์ธ๊ณผ ํจ๊ป ๋ฐฉ๋ฌธํ๊ธฐ ์ข์ต๋๋ค [์ฐธ์กฐ 2].\\n\\n3. **๋ฒ๋ฅ์ฌ**\\n - ์ฃผ์: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ๋ง์ด๋ก 10๋ฒ๊ธธ 45-1\\n - ์ ํ๋ฒํธ: 055-864-3243\\n - ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ ๋ชจ๋ ๋ฐฉ๋ฌธํ ์ ์์ผ๋ฉฐ, ์๊ฐ์ฉ, ๋ ํธ, ์น๊ตฌ, ๊ฐ์กฑ, ์ฐ์ธ๊ณผ ํจ๊ปํ๊ธฐ ์ข์ ์ฅ์์
๋๋ค [์ฐธ์กฐ 3].'}]\n",
|
| 48 |
+
"3 [{'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ์ ์๋ก 12\\nY\\nhttp://www.ccnh.or.kr/html/main/main.php\\n34.8451138\\n127.8995432\\n๋จํด๋ฌธํ์\\n055-864-6969\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ์ ์๋ก 12\\nY\\n34.8451138\\n127.8995432\\n๋จํด๋ฌธํ์ผํฐ\\n055-860-8621\\n๋ด, ์ฌ๋ฆ, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ๋ง์ด๋ก10๋ฒ๊ธธ 45-1\\nY\\n34.8421872\\n127.89268\\n๋ฒํฅ์ฌ\\n055-864-3243\\n๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋ํ๋ก\\n๊ด๊ด์ง\\n์ ํต์ฌ์ฐฐ ์ 104ํธ', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}]\n",
|
| 49 |
+
"[{'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ์ ์๋ก 12\\nY\\nhttp://www.ccnh.or.kr/html/main/main.php\\n34.8451138\\n127.8995432\\n๋จํด๋ฌธํ์\\n055-864-6969\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ์ ์๋ก 12\\nY\\n34.8451138\\n127.8995432\\n๋จํด๋ฌธํ์ผํฐ\\n055-860-8621\\n๋ด, ์ฌ๋ฆ, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ๋ง์ด๋ก10๋ฒ๊ธธ 45-1\\nY\\n34.8421872\\n127.89268\\n๋ฒํฅ์ฌ\\n055-864-3243\\n๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋ํ๋ก\\n๊ด๊ด์ง\\n์ ํต์ฌ์ฐฐ ์ 104ํธ', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}]\n",
|
| 50 |
+
"tab!!!!!!\n",
|
| 51 |
+
"tab!!!!!!\n",
|
| 52 |
+
"tab!!!!!!\n",
|
| 53 |
+
"tab!!!!!!\n",
|
| 54 |
+
"tab!!!!!!\n",
|
| 55 |
+
"๋๋ฉด ๊ฐ๋งํ๊ณณ\n",
|
| 56 |
+
"[{'role': 'user', 'metadata': {'title': None}, 'content': '์๋ฉด ๊ฐ๋งํ๊ณณ', 'options': None}, {'role': 'assistant', 'metadata': {'title': None}, 'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด์์ ๊ฐ๋งํ ๊ณณ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:\\n\\n1. **์คํฌ์ธ ํํฌ**: ์ด๊ณณ์ ๋จํด๊ตฐ์ ๋ํ์ ์ธ ์ถ๊ตฌ ํ๋ จ์ฅ์ผ๋ก, ๊ณ์ ์ ๊ด๊ณ์์ด ์ฌ์ฉ ๊ฐ๋ฅํ ์์ค์
๋๋ค. ์ ๊ตญ ๊ฐ์ง์ ์ ์งํ๋ จ๊ฐ๋ค์ด ๋ง์ด ์ฐพ๋ ๊ณณ์
๋๋ค [์ฐธ์กฐ 1].\\n - ์์น: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ์คํฌ์ธ ํํฌ๊ธธ 74\\n - ์ ํ๋ฒํธ: 055-860-8661\\n\\n2. **์ฅํญ๊ฑฐ๋ฆฌ**: ์ด๊ณณ์ ์ฌ๊ณ์ ๋ด๋ด ๊ฐ์กฑ ๋จ์ ๊ด๊ด๊ฐ๋ค์ด ์ฆ๊ธฐ๊ธฐ ์ข์ ์ฅ์์
๋๋ค [์ฐธ์กฐ 2].\\n - ์์น: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์๋ฉด ๋จ์๋๋ก1517๋ฒ๊ธธ 31\\n\\n3. **๋ง์ด์ฐ ์ฒ ์ญ๊ตฐ๋ฝ์ง**: 5์์ ์ฒ ์ญ์ด ๋ง๊ฐํ๋ ์ด๊ณณ์ ๋ง์ ์ฌ๋๋ค์ด ์ฐพ๋ ๋ช
์์
๋๋ค. ์ ์๊น์ง๋ ์ฝ 1์๊ฐ 30๋ถ ์ ๋ ์์๋ฉ๋๋ค [์ฐธ์กฐ 3].\\n - ์์น: ๊ฒฝ์๏ฟฝ๏ฟฝ๏ฟฝ๋ ๋จํด๊ตฐ ์๋ฉด ๋
ธ๊ตฌ๋ฆฌ ์ฐ 786m\\n - ์ ํ๋ฒํธ: 055-860-3676', 'options': None}, {'role': 'user', 'metadata': {'title': None}, 'content': '๋จํด์ ๊ฐ๋งํ๊ณณ', 'options': None}, {'role': 'assistant', 'metadata': {'title': None}, 'content': '๊ฒฝ์๋จ๋ ๋จํด์์์ ๊ฐ๋งํ ๊ณณ์ผ๋ก๋ ๋ค์ ์ฅ์๋ค์ ์ถ์ฒ๋๋ฆฝ๋๋ค:\\n\\n1. **๋จํด๋ฌธํ์**\\n - ์ฃผ์: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ์ ์๋ก 12\\n - ์ ํ๋ฒํธ: 055-864-6969\\n - ๊ด๊ด์ง๋ก ์ถ์ฒ๋ฉ๋๋ค [์ฐธ์กฐ 1].\\n\\n2. **๋จํด๋ฌธํ์ผํฐ**\\n - ์ฃผ์: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ์ ์๋ก 12\\n - ์ ํ๋ฒํธ: 055-860-8621\\n - ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ์๋ ์ ํฉํ๋ฉฐ ์๊ฐ์ฉ, ๋ ํธ, ์น๊ตฌ, ๊ฐ์กฑ, ์ฐ์ธ๊ณผ ํจ๊ป ๋ฐฉ๋ฌธํ๊ธฐ ์ข์ต๋๋ค [์ฐธ์กฐ 2].\\n\\n3. **๋ฒ๋ฅ์ฌ**\\n - ์ฃผ์: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋จํด์ ๋ง์ด๋ก 10๋ฒ๊ธธ 45-1\\n - ์ ํ๋ฒํธ: 055-864-3243\\n - ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ ๋ชจ๋ ๋ฐฉ๋ฌธํ ์ ์์ผ๋ฉฐ, ์๊ฐ์ฉ, ๋ ํธ, ์น๊ตฌ, ๊ฐ์กฑ, ์ฐ์ธ๊ณผ ํจ๊ปํ๊ธฐ ์ข์ ์ฅ์์
๋๋ค [์ฐธ์กฐ 3].', 'options': None}, {'role': 'user', 'content': '๋๋ฉด ๊ฐ๋งํ๊ณณ'}, {'role': 'assistant', 'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ๋๋ฉด์๋ ๋ค์ํ ๊ด๊ด์ง๊ฐ ์์ต๋๋ค. ๋ค์์ ๋๋ฉด๊ณผ ๊ฐ๊น์ด ๊ด๊ด์ง ๋ชฉ๋ก์
๋๋ค:\\n\\n1. **์ผ๋๋ฉด**: \\n - ๊ด๊ด์ง๋ช
: ์ฐฝ์ ๊ต\\n - ์ฃผ์: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์ผ๋๋ฉด\\n - ์ ํ๋ฒํธ: 055-860-3311\\n - ๊ณ์ ๋ณ๋ก ๋ฐฉ๋ฌธ ๊ฐ๋ฅ: ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ\\n - ์ฃผ์ ํ
๋ง: ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ์ฐ์ ์ฌํ, ์ฐ์ธ, ๋ํ๋ก ์ฌํ\\n - [์ฐธ์กฐ 1]\\n\\n2. **๋จํด๊ตฐ ์ด๋๋ฉด**:\\n - ๊ด๊ด์ง๋ช
: ๋ฏธ๊ตญ๋ง์\\n - ์ฃผ์: ๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์ด๋๋ฉด ๋ฏธ๊ตญ๋ง์๊ธธ\\n - ์ ํ๋ฒํธ: 1588-3415\\n - ๊ณ์ ๋ณ๋ก ๋ฐฉ๋ฌธ ๊ฐ๋ฅ: ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ\\n - ์ฃผ์ ํ
๋ง: ๋ง์์ฌํ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ์ฐ์ธ, ์ฐ์ ์ฌํ, ํค์ฆ, ๋ํ๋ก ์ฌํ, ๋จ์ฒด\\n - [์ฐธ์กฐ 3]\\n\\n์ด ์ ๋ณด๋ฅผ ๋ฐํ์ผ๋ก ์ฌํ ๊ณํ์ ์ธ์ฐ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.'}]\n",
|
| 57 |
+
"3 [{'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์ผ๋๋ฉด\\nY\\n34.830993\\n128.0010063\\n์ฐฝ์ ๊ต\\n055-860-3311\\n๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ๋ํ๋ก\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๋จํด๊ตฐ ๋
ธ๋๋ก183๋ฒ๊ธธ 27\\nY\\n34.9419198\\n127.875899\\n๋จํด์ถฉ๋ ฌ์ฌ์ ๋
ธ๋ํํ์ด\\n055-860-3311\\n๊ด๊ด๋ช
์, ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋ํ๋ก, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์ด๋๋ฉด ๋ฏธ๊ตญ๋ง์๊ธธ\\n๋ฏธ๊ตญํ ์ ํต ๊ฑด์ถ์์์ธ ๊ณ ๊ธ ๋ฏผ๋ฐํ ํฌ์
๊ณผ ์ ์์ฃผ๊ฑฐ๊ฐ ๊ฒฐํฉ๋ ์ฃผํ์ ๊ฑด๋ฆฝํ์ฌ ํน์ ์๋ ๊ด๊ด์ธํ๋ผ๋ฅผ ๊ตฌ์ถํ๊ณ ์๋ค.\\nY\\n34.7806685\\n127.9281169\\n๋ฏธ๊ตญ๋ง์\\n1588-3415\\n๋ง์์ฌํ, ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}]\n",
|
| 58 |
+
"[{'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์ผ๋๋ฉด\\nY\\n34.830993\\n128.0010063\\n์ฐฝ์ ๊ต\\n055-860-3311\\n๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ๋ํ๋ก\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๋จํด๊ตฐ ๋
ธ๋๋ก183๋ฒ๊ธธ 27\\nY\\n34.9419198\\n127.875899\\n๋จํด์ถฉ๋ ฌ์ฌ์ ๋
ธ๋ํํ์ด\\n055-860-3311\\n๊ด๊ด๋ช
์, ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋ํ๋ก, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}, {'content': '๊ฒฝ์๋จ๋ ๋จํด๊ตฐ ์ด๋๋ฉด ๋ฏธ๊ตญ๋ง์๊ธธ\\n๋ฏธ๊ตญํ ์ ํต ๊ฑด์ถ์์์ธ ๊ณ ๊ธ ๋ฏผ๋ฐํ ํฌ์
๊ณผ ์ ์์ฃผ๊ฑฐ๊ฐ ๊ฒฐํฉ๋ ์ฃผํ์ ๊ฑด๋ฆฝํ์ฌ ํน์ ์๋ ๊ด๊ด์ธํ๋ผ๋ฅผ ๊ตฌ์ถํ๊ณ ์๋ค.\\nY\\n34.7806685\\n127.9281169\\n๋ฏธ๊ตญ๋ง์\\n1588-3415\\n๋ง์์ฌํ, ๋ด, ์ฌ๋ฆ, ๊ฐ์, ๊ฒจ์ธ, ์๊ฐ์ฉ/๋ ํธ, ์น๊ตฌ, ํค์ฆ, ์ฐ์ธ, ์ฐ์ ๏ฆ, ์ฐ์ ็ท, ํจ๋, ๋จ์ฒด\\n๊ด๊ด์ง', 'title': None, 'url': None, 'filepath': None, 'chunk_id': '0'}]\n",
|
| 59 |
+
"tab!!!!!!\n",
|
| 60 |
+
"tab!!!!!!\n",
|
| 61 |
+
"tab!!!!!!\n"
|
| 62 |
+
]
|
| 63 |
+
}
|
| 64 |
+
],
|
| 65 |
+
"source": [
|
| 66 |
+
"import gradio as gr\n",
|
| 67 |
+
"import requests\n",
|
| 68 |
+
"import re\n",
|
| 69 |
+
"\n",
|
| 70 |
+
"# endpoint : \n",
|
| 71 |
+
"deployment_name = \"fimtrus-gpt-4o-ncus\"\n",
|
| 72 |
+
"endpoint = \"https://fimtrus-openai-ncus.openai.azure.com/openai/deployments/{}/chat/completions\".format(deployment_name)\n",
|
| 73 |
+
"api_key = \"FP7k76c0BGmz4MVot1LVqdtqcmQaKBeerYdFyXzW4NXN0940rRfEJQQJ99BCACHrzpqXJ3w3AAABACOG8189\"\n",
|
| 74 |
+
"\n",
|
| 75 |
+
"ai_search_endpoint = \"https://fimtrus-ai-search3.search.windows.net\"\n",
|
| 76 |
+
"ai_search_key = \"lw8TYxNHT14hpM5oJQhCL3iOxR4PR494dV4RLDaiwzAzSeBecA5i\"\n",
|
| 77 |
+
"ai_search_index_name = \"travel-index-microsoft2\"\n",
|
| 78 |
+
"ai_search_semantic = \"travel-semantic\"\n",
|
| 79 |
+
"\n",
|
| 80 |
+
"\n",
|
| 81 |
+
"def request_gpt(prompt):\n",
|
| 82 |
+
" query_params = {\n",
|
| 83 |
+
" \"api-version\": \"2025-02-01-preview\"\n",
|
| 84 |
+
" }\n",
|
| 85 |
+
" headers = {\n",
|
| 86 |
+
" \"Content-Type\": \"application/json\",\n",
|
| 87 |
+
" \"api-key\": api_key\n",
|
| 88 |
+
" }\n",
|
| 89 |
+
" \n",
|
| 90 |
+
" body = {\n",
|
| 91 |
+
" \"data_sources\": [\n",
|
| 92 |
+
" {\n",
|
| 93 |
+
" \"type\": \"azure_search\",\n",
|
| 94 |
+
" \"parameters\": {\n",
|
| 95 |
+
" \"endpoint\": ai_search_endpoint,\n",
|
| 96 |
+
" \"index_name\": ai_search_index_name,\n",
|
| 97 |
+
" \"semantic_configuration\": ai_search_semantic,\n",
|
| 98 |
+
" \"query_type\": \"semantic\",\n",
|
| 99 |
+
" \"fields_mapping\": {},\n",
|
| 100 |
+
" \"in_scope\": True,\n",
|
| 101 |
+
" \"filter\": None,\n",
|
| 102 |
+
" \"strictness\": 3,\n",
|
| 103 |
+
" \"top_n_documents\": 3,\n",
|
| 104 |
+
" \"authentication\": {\n",
|
| 105 |
+
" \"type\": \"api_key\",\n",
|
| 106 |
+
" \"key\": ai_search_key\n",
|
| 107 |
+
" },\n",
|
| 108 |
+
" \"key\": ai_search_key\n",
|
| 109 |
+
" }\n",
|
| 110 |
+
" }\n",
|
| 111 |
+
" ],\n",
|
| 112 |
+
" \"messages\": [\n",
|
| 113 |
+
" {\n",
|
| 114 |
+
" \"role\": \"system\",\n",
|
| 115 |
+
" \"content\": \"์ฌ์ฉ์๊ฐ ์ ๋ณด๋ฅผ ์ฐพ๋ ๋ฐ ๋์์ด ๋๋ AI ๋์ฐ๋ฏธ์
๋๋ค.\"\n",
|
| 116 |
+
" },\n",
|
| 117 |
+
" {\n",
|
| 118 |
+
" \"role\": \"user\",\n",
|
| 119 |
+
" \"content\": prompt\n",
|
| 120 |
+
" }\n",
|
| 121 |
+
" ],\n",
|
| 122 |
+
" \"temperature\": 0.7,\n",
|
| 123 |
+
" \"top_p\": 0.95,\n",
|
| 124 |
+
" \"max_tokens\": 800,\n",
|
| 125 |
+
" \"stop\": None,\n",
|
| 126 |
+
" \"stream\": False,\n",
|
| 127 |
+
" \"frequency_penalty\": 0,\n",
|
| 128 |
+
" \"presence_penalty\": 0\n",
|
| 129 |
+
" }\n",
|
| 130 |
+
"\n",
|
| 131 |
+
" response = requests.post(endpoint, params=query_params, headers=headers, json=body)\n",
|
| 132 |
+
" \n",
|
| 133 |
+
" if response.status_code == 200:\n",
|
| 134 |
+
" response_json = response.json()\n",
|
| 135 |
+
" message = response_json['choices'][0]['message']\n",
|
| 136 |
+
" content = message['content']\n",
|
| 137 |
+
" \n",
|
| 138 |
+
" content = re.sub(r'\\[doc(\\d+)\\]', r'[์ฐธ์กฐ \\1]', content)\n",
|
| 139 |
+
" \n",
|
| 140 |
+
" if message['context']:\n",
|
| 141 |
+
" citation_list = message['context']['citations']\n",
|
| 142 |
+
" else:\n",
|
| 143 |
+
" citation_list = list()\n",
|
| 144 |
+
" return content, citation_list\n",
|
| 145 |
+
" else:\n",
|
| 146 |
+
" return \"\", list()\n",
|
| 147 |
+
"\n",
|
| 148 |
+
"#############################################################################\n",
|
| 149 |
+
"\n",
|
| 150 |
+
"\n",
|
| 151 |
+
"with gr.Blocks() as demo:\n",
|
| 152 |
+
" \n",
|
| 153 |
+
" citation_state = gr.State([])\n",
|
| 154 |
+
" \n",
|
| 155 |
+
" def click_send(prompt, histories):\n",
|
| 156 |
+
" print(prompt)\n",
|
| 157 |
+
" content, citation_list = request_gpt(prompt=prompt)\n",
|
| 158 |
+
" message_list = [{\"role\": \"user\", \"content\": prompt}, {\"role\": \"assistant\", \"content\": content}]\n",
|
| 159 |
+
" histories.extend(message_list)\n",
|
| 160 |
+
" \n",
|
| 161 |
+
" print(histories)\n",
|
| 162 |
+
" print(len(citation_list), citation_list)\n",
|
| 163 |
+
" return histories, citation_list, \"\"\n",
|
| 164 |
+
" \n",
|
| 165 |
+
" def select_tab(citation):\n",
|
| 166 |
+
" print(\"tab!!!!!!\")\n",
|
| 167 |
+
" return gr.Textbox(label=\"\", value=citation, lines=10, max_lines=10, visible=True)\n",
|
| 168 |
+
" \n",
|
| 169 |
+
" gr.Markdown(\"# ๋์ GPT ์๋\")\n",
|
| 170 |
+
" \n",
|
| 171 |
+
" with gr.Row():\n",
|
| 172 |
+
" chatbot = gr.Chatbot(label=\"๋์ GPT\", type=\"messages\", scale=3)\n",
|
| 173 |
+
" \n",
|
| 174 |
+
" with gr.Column(scale=1): \n",
|
| 175 |
+
" @gr.render(inputs=[citation_state])\n",
|
| 176 |
+
" def render_citations(citations):\n",
|
| 177 |
+
" print(citations)\n",
|
| 178 |
+
" for index in range(len(citations)):\n",
|
| 179 |
+
" content = citations[index]['content']\n",
|
| 180 |
+
" key = \"์ฐธ์กฐ{}\".format(index + 1)\n",
|
| 181 |
+
" if index == 0:\n",
|
| 182 |
+
" gr.Tab(\"\", id=-1, visible=False)\n",
|
| 183 |
+
" with gr.Tab(key) as tab:\n",
|
| 184 |
+
" citation_textbox = gr.Textbox(label=\"\", value=content, lines=10, max_lines=10, visible=False)\n",
|
| 185 |
+
" tab.select(fn=select_tab, inputs=[citation_textbox], outputs=[citation_textbox])\n",
|
| 186 |
+
" \n",
|
| 187 |
+
" with gr.Row():\n",
|
| 188 |
+
" prompt_textbox = gr.Textbox(label=\"ํ๋กฌํํธ\", placeholder=\"ํ๋กฌํํธ๋ฅผ ์
๋ ฅํ์ธ์.\", scale=6)\n",
|
| 189 |
+
" send_button = gr.Button(\"์ ์ก\", scale=1)\n",
|
| 190 |
+
" \n",
|
| 191 |
+
" send_button.click(click_send, inputs=[prompt_textbox, chatbot], outputs=[chatbot, citation_state, prompt_textbox])\n",
|
| 192 |
+
" prompt_textbox.submit(click_send, inputs=[prompt_textbox, chatbot], outputs=[chatbot, citation_state, prompt_textbox])\n",
|
| 193 |
+
" \n",
|
| 194 |
+
" \n",
|
| 195 |
+
"demo.launch()\n",
|
| 196 |
+
"\n"
|
| 197 |
+
]
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"cell_type": "code",
|
| 201 |
+
"execution_count": null,
|
| 202 |
+
"metadata": {},
|
| 203 |
+
"outputs": [],
|
| 204 |
+
"source": []
|
| 205 |
+
}
|
| 206 |
+
],
|
| 207 |
+
"metadata": {
|
| 208 |
+
"kernelspec": {
|
| 209 |
+
"display_name": "openai",
|
| 210 |
+
"language": "python",
|
| 211 |
+
"name": "python3"
|
| 212 |
+
},
|
| 213 |
+
"language_info": {
|
| 214 |
+
"codemirror_mode": {
|
| 215 |
+
"name": "ipython",
|
| 216 |
+
"version": 3
|
| 217 |
+
},
|
| 218 |
+
"file_extension": ".py",
|
| 219 |
+
"mimetype": "text/x-python",
|
| 220 |
+
"name": "python",
|
| 221 |
+
"nbconvert_exporter": "python",
|
| 222 |
+
"pygments_lexer": "ipython3",
|
| 223 |
+
"version": "3.11.9"
|
| 224 |
+
}
|
| 225 |
+
},
|
| 226 |
+
"nbformat": 4,
|
| 227 |
+
"nbformat_minor": 2
|
| 228 |
+
}
|