Update app.py
Browse files
app.py
CHANGED
|
@@ -50,15 +50,29 @@ import os
|
|
| 50 |
load_dotenv()
|
| 51 |
|
| 52 |
# Get API key from env
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
# Make a test call
|
| 64 |
response = client.chat.completions.create(
|
|
|
|
| 50 |
load_dotenv()
|
| 51 |
|
| 52 |
# Get API key from env
|
| 53 |
+
url = "https://api.fireworks.ai/inference/v1/chat/completions"
|
| 54 |
+
payload = {
|
| 55 |
+
"model": "accounts/fireworks/models/llama-v3p1-405b-instruct",
|
| 56 |
+
"max_tokens": 16384,
|
| 57 |
+
"top_p": 1,
|
| 58 |
+
"top_k": 40,
|
| 59 |
+
"presence_penalty": 0,
|
| 60 |
+
"frequency_penalty": 0,
|
| 61 |
+
"temperature": 0.6,
|
| 62 |
+
"messages": [
|
| 63 |
+
{
|
| 64 |
+
"role": "user",
|
| 65 |
+
"content": "Hello, how are you?"
|
| 66 |
+
}
|
| 67 |
+
]
|
| 68 |
+
}
|
| 69 |
+
headers = {
|
| 70 |
+
"Accept": "application/json",
|
| 71 |
+
"Content-Type": "application/json",
|
| 72 |
+
"Authorization": "Bearer <FIREWORKS_API_KEY>"
|
| 73 |
+
}
|
| 74 |
+
requests.request("POST", url, headers=headers, data=json.dumps(payload))
|
| 75 |
+
|
| 76 |
|
| 77 |
# Make a test call
|
| 78 |
response = client.chat.completions.create(
|