Generate endless dad jokes with Groq's lightning-fast inference technology!
Endpoint: /dad_joke
Method: POST
Content-Type: application/json
Request Body:
{ "dad_joke_topic": "pizza" }
Example Response:
{ "joke": "Why did the pizza maker go to jail? Because he kneaded the dough!" }
const fetch = require('node-fetch'); async function getDadJoke(topic) { const response = await fetch('http://your-api-url.com/dad_joke', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ dad_joke_topic: topic }), }); const reader = response.body.getReader(); const decoder = new TextDecoder(); let joke = ''; while (true) { const { done, value } = await reader.read(); if (done) break; joke += decoder.decode(value); } console.log(joke); } getDadJoke('pizza');
import requests def get_dad_joke(topic): url = 'http://your-api-url.com/dad_joke' headers = {'Content-Type': 'application/json'} data = {'dad_joke_topic': topic} response = requests.post(url, headers=headers, json=data, stream=True) joke = '' for chunk in response.iter_content(chunk_size=None): joke += chunk.decode('utf-8') print(joke) get_dad_joke('pizza')
async function getDadJoke(topic) { const response = await fetch('http://your-api-url.com/dad_joke', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ dad_joke_topic: topic }), }); const reader = response.body.getReader(); const decoder = new TextDecoder(); let joke = ''; while (true) { const { done, value } = await reader.read(); if (done) break; joke += decoder.decode(value); } console.log(joke); } getDadJoke('pizza');
curl -X POST http://your-api-url.com/dad_joke \ -H "Content-Type: application/json" \ -d '{"dad_joke_topic": "pizza"}'