Spaces:
Sleeping
Sleeping
fix: move type ignore to the correct position for OpenAI call and suppress requests stub warning
Browse files- inference.py +4 -4
inference.py
CHANGED
|
@@ -35,7 +35,7 @@ for stream in [sys.stdout, sys.stderr]:
|
|
| 35 |
pass
|
| 36 |
|
| 37 |
try:
|
| 38 |
-
import requests
|
| 39 |
except ImportError:
|
| 40 |
requests = None
|
| 41 |
|
|
@@ -201,10 +201,10 @@ def call_llm(
|
|
| 201 |
return "I apologize for the inconvenience. Let me look into this for you right away."
|
| 202 |
for attempt in range(max_retries):
|
| 203 |
try:
|
| 204 |
-
# Use type: ignore
|
| 205 |
-
completion = _llm_client.chat.completions.create(
|
| 206 |
model=str(MODEL_NAME),
|
| 207 |
-
messages=messages,
|
| 208 |
temperature=float(temperature),
|
| 209 |
max_tokens=int(max_tokens),
|
| 210 |
)
|
|
|
|
| 35 |
pass
|
| 36 |
|
| 37 |
try:
|
| 38 |
+
import requests # type: ignore
|
| 39 |
except ImportError:
|
| 40 |
requests = None
|
| 41 |
|
|
|
|
| 201 |
return "I apologize for the inconvenience. Let me look into this for you right away."
|
| 202 |
for attempt in range(max_retries):
|
| 203 |
try:
|
| 204 |
+
# Use type: ignore at the end of the call start to suppress overload warnings
|
| 205 |
+
completion = _llm_client.chat.completions.create( # type: ignore
|
| 206 |
model=str(MODEL_NAME),
|
| 207 |
+
messages=messages,
|
| 208 |
temperature=float(temperature),
|
| 209 |
max_tokens=int(max_tokens),
|
| 210 |
)
|