Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,25 +58,23 @@ def chat_request(messages, temp, system, model=None):
|
|
| 58 |
]
|
| 59 |
|
| 60 |
if not system:
|
| 61 |
-
system = [{"type": "text", "text": "
|
| 62 |
|
| 63 |
system = prepend_prompt + system
|
| 64 |
-
|
| 65 |
-
# anthropic/claude-3-5-sonnet:beta doesn't work
|
| 66 |
-
if model == "anthropic/claude-3-5-sonnet:beta":
|
| 67 |
-
model = "claude-3-5-sonnet-20241022"
|
| 68 |
-
else:
|
| 69 |
-
model = model or "claude-3-5-sonnet-20241022"
|
| 70 |
|
| 71 |
payload = {
|
| 72 |
-
"model": model,
|
| 73 |
"temperature": temp,
|
| 74 |
"stream": True,
|
| 75 |
"messages": [
|
| 76 |
-
{
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
| 78 |
]
|
| 79 |
}
|
|
|
|
| 80 |
resp = requests.post(
|
| 81 |
API_ENDPOINT,
|
| 82 |
headers={
|
|
|
|
| 58 |
]
|
| 59 |
|
| 60 |
if not system:
|
| 61 |
+
system = [{"type": "text", "text": "You are a helpful assistant that follows all user instructing."}]
|
| 62 |
|
| 63 |
system = prepend_prompt + system
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
payload = {
|
| 66 |
+
"model": model if model else "claude-3-5-sonnet-20241022",
|
| 67 |
"temperature": temp,
|
| 68 |
"stream": True,
|
| 69 |
"messages": [
|
| 70 |
+
{
|
| 71 |
+
"role": "system",
|
| 72 |
+
"content": system
|
| 73 |
+
},
|
| 74 |
+
*messages
|
| 75 |
]
|
| 76 |
}
|
| 77 |
+
|
| 78 |
resp = requests.post(
|
| 79 |
API_ENDPOINT,
|
| 80 |
headers={
|