Spaces:
Sleeping
Sleeping
Update api_utils.py
Browse files- api_utils.py +4 -3
api_utils.py
CHANGED
@@ -1,17 +1,18 @@
|
|
1 |
import requests
|
2 |
|
3 |
-
api_key = "
|
4 |
|
5 |
def call_api(prompt: str) -> str:
|
6 |
"""
|
7 |
-
Call
|
|
|
8 |
"""
|
9 |
headers = {
|
10 |
'Authorization': f'Bearer {api_key}',
|
11 |
'Content-Type': 'application/json'
|
12 |
}
|
13 |
payload = {
|
14 |
-
'model': 'gpt-3.5-turbo',
|
15 |
'messages': [{'role': 'user', 'content': prompt}],
|
16 |
'max_tokens': 500
|
17 |
}
|
|
|
1 |
import requests
|
2 |
|
3 |
+
api_key = "sw-xyz1234567891213" # Replace with your actual API key
|
4 |
|
5 |
def call_api(prompt: str) -> str:
|
6 |
"""
|
7 |
+
Call an API with the given prompt and return the response.
|
8 |
+
Note: This assumes a generic API endpoint. Adjust the URL and payload based on your API.
|
9 |
"""
|
10 |
headers = {
|
11 |
'Authorization': f'Bearer {api_key}',
|
12 |
'Content-Type': 'application/json'
|
13 |
}
|
14 |
payload = {
|
15 |
+
'model': 'gpt-3.5-turbo', # Adjust model based on your API
|
16 |
'messages': [{'role': 'user', 'content': prompt}],
|
17 |
'max_tokens': 500
|
18 |
}
|