Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -102,26 +102,23 @@ def explain_improvement(
|
|
102 |
):
|
103 |
llm = get_llm()
|
104 |
|
105 |
-
chat_session = llm.start_chat(
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
Zwięźle wyjaśnij ulepszenie."""},
|
122 |
-
]
|
123 |
)
|
124 |
-
response = chat_session.send_message("")
|
125 |
|
126 |
prompt_teacher += [
|
127 |
[
|
@@ -143,13 +140,10 @@ def improve_prompt(
|
|
143 |
metaprompt_template = metaprompts_dict[metaprompt].template
|
144 |
|
145 |
llm = get_llm()
|
146 |
-
chat_session = llm.start_chat(
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
{"content": metaprompt_template},
|
151 |
-
]
|
152 |
-
)
|
153 |
|
154 |
explanation_history += [
|
155 |
[
|
@@ -170,7 +164,8 @@ def improve_prompt(
|
|
170 |
for key, value in input_message.items():
|
171 |
input_str += f"{key}: {value}\n"
|
172 |
|
173 |
-
|
|
|
174 |
|
175 |
explanation_history[-1][1] += response.text
|
176 |
improved_prompt += response.text
|
|
|
102 |
):
|
103 |
llm = get_llm()
|
104 |
|
105 |
+
chat_session = llm.start_chat() # Usunięto argument 'messages'
|
106 |
+
|
107 |
+
response = chat_session.send_message( # Dodano wiadomości do send_message()
|
108 |
+
f"""Następujący prompt:
|
109 |
+
---
|
110 |
+
{prompt}
|
111 |
+
---
|
112 |
+
został ulepszony za pomocą metapromptu:
|
113 |
+
---
|
114 |
+
{metaprompt}
|
115 |
+
---
|
116 |
+
W rezultacie powstała następująca ulepszona wersja:
|
117 |
+
---
|
118 |
+
{improved_prompt}
|
119 |
+
---
|
120 |
+
Zwięźle wyjaśnij ulepszenie."""
|
|
|
|
|
121 |
)
|
|
|
122 |
|
123 |
prompt_teacher += [
|
124 |
[
|
|
|
140 |
metaprompt_template = metaprompts_dict[metaprompt].template
|
141 |
|
142 |
llm = get_llm()
|
143 |
+
chat_session = llm.start_chat() # Usunięto argument 'messages'
|
144 |
+
|
145 |
+
# Przesłanie system_message do send_message()
|
146 |
+
chat_session.send_message(system_message)
|
|
|
|
|
|
|
147 |
|
148 |
explanation_history += [
|
149 |
[
|
|
|
164 |
for key, value in input_message.items():
|
165 |
input_str += f"{key}: {value}\n"
|
166 |
|
167 |
+
# Przesłanie metaprompt_template i input_str do send_message()
|
168 |
+
response = chat_session.send_message(metaprompt_template + "\n" + input_str)
|
169 |
|
170 |
explanation_history[-1][1] += response.text
|
171 |
improved_prompt += response.text
|