Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
import os
|
| 2 |
from openai import OpenAI
|
| 3 |
|
| 4 |
-
api_key = os.getenv("sk-869724fffbf74cc4a0225d0c90df4fd3")
|
| 5 |
-
|
| 6 |
client = OpenAI(
|
| 7 |
-
|
| 8 |
-
|
| 9 |
)
|
| 10 |
|
| 11 |
-
|
| 12 |
-
model="
|
| 13 |
messages=[
|
| 14 |
-
{
|
|
|
|
|
|
|
|
|
|
| 15 |
],
|
| 16 |
-
stream=False
|
| 17 |
)
|
| 18 |
|
| 19 |
-
print(
|
|
|
|
| 1 |
import os
|
| 2 |
from openai import OpenAI
|
| 3 |
|
|
|
|
|
|
|
| 4 |
client = OpenAI(
|
| 5 |
+
base_url="https://router.huggingface.co/v1",
|
| 6 |
+
api_key=os.environ["HF_TOKEN"],
|
| 7 |
)
|
| 8 |
|
| 9 |
+
completion = client.chat.completions.create(
|
| 10 |
+
model="dphn/dolphin-2.9.1-llama-3-8b:featherless-ai",
|
| 11 |
messages=[
|
| 12 |
+
{
|
| 13 |
+
"role": "user",
|
| 14 |
+
"content": "What is the capital of algeria?"
|
| 15 |
+
}
|
| 16 |
],
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
+
print(completion.choices[0].message)
|