Spaces:
Running
Running
Lohia, Aditya
commited on
Commit
·
8c7bf64
1
Parent(s):
7faf2cf
modifying payload for gemma
Browse files- gateway.py +12 -2
gateway.py
CHANGED
@@ -53,8 +53,17 @@ def request_generation(
|
|
53 |
payload = {
|
54 |
"model": "google/gemma-3-27b-it",
|
55 |
"messages": [
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
],
|
59 |
"max_tokens": max_new_tokens,
|
60 |
"temperature": temperature,
|
@@ -83,6 +92,7 @@ def request_generation(
|
|
83 |
# Parse the chunk into a JSON object
|
84 |
try:
|
85 |
chunk_json = json.loads(chunk_str)
|
|
|
86 |
# Extract the "content" field from the choices
|
87 |
content = chunk_json["choices"][0]["delta"].get("content", "")
|
88 |
|
|
|
53 |
payload = {
|
54 |
"model": "google/gemma-3-27b-it",
|
55 |
"messages": [
|
56 |
+
*(
|
57 |
+
[
|
58 |
+
{
|
59 |
+
"role": "system",
|
60 |
+
"content": [{"type": "text", "text": system_prompt}],
|
61 |
+
}
|
62 |
+
]
|
63 |
+
if system_prompt
|
64 |
+
else []
|
65 |
+
),
|
66 |
+
{"role": "user", "content": [{"type": "text", "text": message}]},
|
67 |
],
|
68 |
"max_tokens": max_new_tokens,
|
69 |
"temperature": temperature,
|
|
|
92 |
# Parse the chunk into a JSON object
|
93 |
try:
|
94 |
chunk_json = json.loads(chunk_str)
|
95 |
+
|
96 |
# Extract the "content" field from the choices
|
97 |
content = chunk_json["choices"][0]["delta"].get("content", "")
|
98 |
|