You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
726 B
30 lines
726 B
5 months ago
|
import requests
|
||
|
import json
|
||
|
import os
|
||
|
|
||
|
url = "https://swarms.world/api/add-prompt"
|
||
|
headers = {
|
||
|
"Content-Type": "application/json",
|
||
|
"Authorization": f"Bearer {os.getenv('SWARMS_API_KEY')}",
|
||
|
}
|
||
|
|
||
|
data = {
|
||
|
"name": "Example Prompt",
|
||
|
"prompt": "This is an example prompt from an API route.",
|
||
|
"description": "Description of the prompt.",
|
||
|
"useCases": [
|
||
|
{
|
||
|
"title": "Use case 1",
|
||
|
"description": "Description of use case 1",
|
||
|
},
|
||
|
{
|
||
|
"title": "Use case 2",
|
||
|
"description": "Description of use case 2",
|
||
|
},
|
||
|
],
|
||
|
"tags": "example, prompt",
|
||
|
}
|
||
|
|
||
|
response = requests.post(url, headers=headers, data=json.dumps(data))
|
||
|
print(response.json())
|