fish-joke-generator
v1.1.0
Published
A delightful tool for generating hilarious fish-themed jokes. Compatible with AI SDK (Vercel), OpenAI SDK 6, and Zod 4.
Downloads
55
Maintainers
Readme
Fish Joke Generator
Use the Fish Joke Generator tool in your AI SDK agent with just a few lines of code.
Installation
npm install fish-joke-generatorUsage
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { getFishJokeTool } from 'fish-joke-generator';
const result = await generateText({
model: openai('gpt-4'),
prompt: 'Tell me a funny fish joke',
tools: {
getFishJoke: getFishJokeTool(),
},
maxSteps: 5,
});
console.log(result.text);Quick Start (Without AI SDK)
import { getRandomFishJoke } from 'fish-joke-generator';
const joke = getRandomFishJoke();
console.log(`${joke.setup}\n${joke.punchline}`);Available Tools
getFishJokeTool()
Returns a tool for AI SDK that generates fish jokes.
Parameters:
category(optional): 'pun' | 'dad' | 'ocean' | 'random'rating(optional): 'family-friendly' | 'groan-worthy' | 'fin-tastic'
Example:
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { getFishJokeTool } from 'fish-joke-generator';
const result = await generateText({
model: openai('gpt-4'),
prompt: 'Tell me a groan-worthy fish pun',
tools: {
getFishJoke: getFishJokeTool(),
},
});getMultipleFishJokesTool()
Returns a tool for AI SDK that generates multiple fish jokes.
Parameters:
count: number of jokes to generatecategory(optional): 'pun' | 'dad' | 'ocean' | 'random'
Example:
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { getMultipleFishJokesTool } from 'fish-joke-generator';
const result = await generateText({
model: openai('gpt-4'),
prompt: 'Give me 3 ocean-themed fish jokes',
tools: {
getMultipleFishJokes: getMultipleFishJokesTool(),
},
});Direct API Usage
getRandomFishJoke(category?)
Get a random fish joke without using the AI SDK.
import { getRandomFishJoke } from 'fish-joke-generator';
const joke = getRandomFishJoke('pun');
console.log(joke.setup); // "What do you call a fish with no eyes?"
console.log(joke.punchline); // "A fsh!"createFishJoker(options?)
Create a fish joker instance with custom options.
import { createFishJoker } from 'fish-joke-generator';
const joker = createFishJoker();
// Get a single joke
const joke = joker.getJoke('dad');
// Get multiple jokes
const jokes = joker.getJokes(5, 'ocean');
// Get all jokes from a category
const allPuns = joker.getJokesByCategory('pun');
// Format a joke
console.log(joker.formatJoke(joke, 'question-answer'));TypeScript Types
interface FishJoke {
setup: string;
punchline: string;
category: 'pun' | 'dad' | 'ocean' | 'random';
rating?: 'family-friendly' | 'groan-worthy' | 'fin-tastic';
}
type JokeCategory = 'pun' | 'dad' | 'ocean' | 'random';
interface JokeOptions {
rating?: 'family-friendly' | 'groan-worthy' | 'fin-tastic';
includeCategory?: boolean;
format?: 'standard' | 'one-liner' | 'question-answer';
}Example Jokes
Puns:
- "What do you call a fish that practices medicine?" → "A sturgeon!"
- "What do you call a fish magician?" → "A magic carp!"
Dad Jokes:
- "Did you hear about the fish that went bankrupt?" → "Now he's a loan shark!"
- "What did the fish say when he posted bail?" → "I'm off the hook!"
Ocean Humor:
- "Why are fish so smart?" → "Because they live in schools!"
- "How do shellfish get to the hospital?" → "In a clambulance!"
Features
- 🐟 23+ hand-crafted fish jokes
- 🤖 AI SDK compatible tools
- ✅ Full TypeScript support
- 🎲 Random joke selection
- ⭐ Joke ratings and categories
- 🎨 Multiple formatting options
- 📦 Zero dependencies (AI SDK is peer dependency)
Use Cases
- Add humor to AI chatbots and agents
- Generate entertaining placeholder content
- Create comedy applications
- Lighten up error messages
- Icebreakers for meetings
- Educational marine life content
Contributing
Have a fin-tastic fish joke to add? Contributions are welcome! Please submit a Pull Request.
License
MIT
Made with ❤️ and 🐟 for the AI SDK community
