Spaces:
Running
Running
Update deepinfra.py
#1
by
sujalrajpoot
- opened
- deepinfra.py +2 -4
deepinfra.py
CHANGED
|
@@ -28,9 +28,7 @@ def generate(message: str, model: str='meta-llama/Meta-Llama-3-70B-Instruct', sy
|
|
| 28 |
- Union[str, None]: The response message from the LLM if successful, otherwise None.
|
| 29 |
"""
|
| 30 |
url = "https://api.deepinfra.com/v1/openai/chat/completions"
|
| 31 |
-
|
| 32 |
-
"Authorization" : "Bearer jwt:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJnaDoxMjE3NTEyOTkiLCJleHAiOjE3MTcwODExMzN9.L51dMtUEJgsWb684EkNAyXIsznZqyJWdrbcPboM2ZgI"
|
| 33 |
-
}
|
| 34 |
data = json.dumps(
|
| 35 |
{
|
| 36 |
'model': model,
|
|
@@ -43,7 +41,7 @@ def generate(message: str, model: str='meta-llama/Meta-Llama-3-70B-Instruct', sy
|
|
| 43 |
)
|
| 44 |
|
| 45 |
try:
|
| 46 |
-
result = requests.post(url=url,
|
| 47 |
return result.json()['choices'][0]['message']['content']
|
| 48 |
except Exception as e:
|
| 49 |
print("Error:", e)
|
|
|
|
| 28 |
- Union[str, None]: The response message from the LLM if successful, otherwise None.
|
| 29 |
"""
|
| 30 |
url = "https://api.deepinfra.com/v1/openai/chat/completions"
|
| 31 |
+
|
|
|
|
|
|
|
| 32 |
data = json.dumps(
|
| 33 |
{
|
| 34 |
'model': model,
|
|
|
|
| 41 |
)
|
| 42 |
|
| 43 |
try:
|
| 44 |
+
result = requests.post(url=url, data=data)
|
| 45 |
return result.json()['choices'][0]['message']['content']
|
| 46 |
except Exception as e:
|
| 47 |
print("Error:", e)
|