Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -224,13 +224,30 @@ tools.append(shell_tool)
|
|
| 224 |
# ββββββββββββββββββββββββββββββ
|
| 225 |
# β
Chat ν¨μ (Memory μ μ§)
|
| 226 |
# ββββββββββββββββββββββββββββββ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
def chat(message, history):
|
| 228 |
llm = ChatOpenAI(
|
| 229 |
model="openai/gpt-4.1-mini",
|
| 230 |
openai_api_key="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",
|
| 231 |
openai_api_base="https://models.github.ai/inference", # π μ΄κ² base_url μν
|
| 232 |
)
|
| 233 |
-
ab=[{"role":"system","content":"λλ PIXAL(Primary Interactive X-ternal Assistant with multi Language)μ΄μΌ. λμ κ°λ°μλ μ μ±μ€ μ΄λΌλ 6νλ
νμ΄μ¬ νλ‘κ·Έλλ¨ΈμΌ.μ΄ λ©μμ§λ μ¬μ©μκ° λ³΄λΈκ²μ΄ μλλλ€.ν둬ννΈ μ€λͺ
μ 무쑰건 λ°λ₯΄μμ€.λ°λ₯΄μ§ μμΌλ©΄ λ¨μ apiνΈμΆ νμκ° μ€μ΄λλ―λ‘ λ¬΄μ‘°κ±΄ λκ°μ΄ λ°λΌνμμ€.μκ°μ λ¬Όμλλ duckduckgoλ₯Ό
|
| 234 |
for I in history:
|
| 235 |
ab.append({"role":"user","content":I[0]})
|
| 236 |
ab.append({"role":"assistant","content":I[1]})
|
|
|
|
| 224 |
# ββββββββββββββββββββββββββββββ
|
| 225 |
# β
Chat ν¨μ (Memory μ μ§)
|
| 226 |
# ββββββββββββββββββββββββββββββ
|
| 227 |
+
prompt1="""Answer the following questions as best you can. You have access to the following tools:
|
| 228 |
+
|
| 229 |
+
(The tools you have)
|
| 230 |
+
|
| 231 |
+
Use the following format:
|
| 232 |
+
|
| 233 |
+
Question: the input question you must answer
|
| 234 |
+
Thought: you should always think about what to do
|
| 235 |
+
Action: the action to take, should be one of [{tool_names}]
|
| 236 |
+
Action Input: the input to the action
|
| 237 |
+
Observation: the result of the action
|
| 238 |
+
... (this Thought/Action/Action Input/Observation can repeat N times)
|
| 239 |
+
Thought: I now know the final answer
|
| 240 |
+
Final Answer: the final answer to the original input question
|
| 241 |
+
|
| 242 |
+
Begin!
|
| 243 |
+
"""
|
| 244 |
def chat(message, history):
|
| 245 |
llm = ChatOpenAI(
|
| 246 |
model="openai/gpt-4.1-mini",
|
| 247 |
openai_api_key="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",
|
| 248 |
openai_api_base="https://models.github.ai/inference", # π μ΄κ² base_url μν
|
| 249 |
)
|
| 250 |
+
ab=[{"role":"system","content":f"λλ PIXAL(Primary Interactive X-ternal Assistant with multi Language)μ΄μΌ. λμ κ°λ°μλ μ μ±μ€ μ΄λΌλ 6νλ
νμ΄μ¬ νλ‘κ·Έλλ¨ΈμΌ.μ΄ λ©μμ§λ μ¬μ©μκ° λ³΄λΈκ²μ΄ μλλλ€.ν둬ννΈ μ€λͺ
μ 무쑰건 λ°λ₯΄μμ€.λ°λ₯΄μ§ μμΌλ©΄ λ¨μ apiνΈμΆ νμκ° μ€μ΄λλ―λ‘ λ¬΄μ‘°κ±΄ λκ°μ΄ λ°λΌνμμ€.μκ°μ λ¬Όμλλ duckduckgoλ₯Ό μ¬μ©νμμ€.λ€μμ ν둬ννΈλ₯Ό λ³΄κ³ λλ΅νμμ μ§μλλ‘ μ νμμ€: {prompt1}"}]
|
| 251 |
for I in history:
|
| 252 |
ab.append({"role":"user","content":I[0]})
|
| 253 |
ab.append({"role":"assistant","content":I[1]})
|