Last active
February 4, 2025 13:13
-
-
Save jeansymolanza/3a19136d8c729ddcacf63a6422e1c95d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Define the API endpoint and headers | |
API_HOST="http://localhost:11434" | |
HEADERS=( | |
"-H" "Content-Type: application/json" | |
"-H" "x-some-header: some-value" | |
) | |
# Define the JSON payload | |
JSON_PAYLOAD='{ | |
"model": "llama3.2", | |
"messages": [ | |
{ | |
"role": "user", | |
"content": "Why is the sky blue?" | |
} | |
] | |
}' | |
# Send the request using curl | |
response=$(curl -s -X POST "$API_HOST/api/chat" "${HEADERS[@]}" -d "$JSON_PAYLOAD") | |
# Print the response | |
echo "$response" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment