Spaces:
Sleeping
Sleeping
Use Prompt class as parameter type
Browse files
app.py
CHANGED
@@ -19,14 +19,14 @@ async def test():
|
|
19 |
return {"Test"}
|
20 |
|
21 |
@app.post("/chat")
|
22 |
-
async def chat(
|
23 |
print("Received POST request")
|
24 |
-
print("Message:", message)
|
25 |
system_prompt = (
|
26 |
"You are a beginner programming student helping a peer. "
|
27 |
"Offer hints, ask questions, and support understanding—don’t give full solutions."
|
28 |
)
|
29 |
-
full_prompt = f"<s>[INST] <<SYS>>{system_prompt}<</SYS>>\n{message} [/INST]"
|
30 |
|
31 |
print("Full Prompt:", full_prompt)
|
32 |
|
|
|
19 |
return {"Test"}
|
20 |
|
21 |
@app.post("/chat")
|
22 |
+
async def chat(prompt: Prompt):
|
23 |
print("Received POST request")
|
24 |
+
print("Message:", prompt.message)
|
25 |
system_prompt = (
|
26 |
"You are a beginner programming student helping a peer. "
|
27 |
"Offer hints, ask questions, and support understanding—don’t give full solutions."
|
28 |
)
|
29 |
+
full_prompt = f"<s>[INST] <<SYS>>{system_prompt}<</SYS>>\n{prompt.message} [/INST]"
|
30 |
|
31 |
print("Full Prompt:", full_prompt)
|
32 |
|