1.3.0 • Published 9 months ago
kato-ai-recipe-generator v1.3.0
AI Recipe Generator
This package provides functionality for generating recipes and images using AI.
Usage
Here's a basic example of how to use the package:
import { init, generate_recipe, generate_image } from 'kato-ai-recipe-generator';
// Initialize the module
await init;
// Generate a recipe
const apiToken = 'your-api-token';
const ingredients = 'lamb,potatoes,tomato paste,hawaij spic mix';
const cuisineType = 'Arabic';
const language = 'Arabic'
const recipe = await generate_recipe(apiToken, ingredients, cuisineType, language);
console.log(recipe);
// Generate an image
const prompt = 'Arabian Buttered Eggs with Mint and Lemon';
const image = await generate_image(apiToken, prompt);
console.log(image);
API Reference
init()
Initializes the module. Must be called before using other functions.
generate_recipe(apiToken, ingredients, cuisineType, language)
Generates a recipe based on the given ingredients, language and cuisine type.
apiToken
: Your OpenAI API token for authentication.ingredients
: A comma separated string of ingredients.cuisineType
: The type of cuisine. (default: Arabic)language
: The language to show the recipe (default: English)
Returns a Promise that resolves to the generated recipe.
generate_image(apiToken, prompt)
Generates an image based on the given prompt.
apiToken
: Your API token for authentication.prompt
: A text description of the image to generate.
Returns a Promise that resolves to the generated image data.
generate_recipe_list(apiToken, ingredients, cuisineType, count, language)
Generates a list of recipes based on the given ingredients, count, language and cuisine type.
apiToken
: Your OpenAI API token for authentication.ingredients
: A comma separated string of ingredients.cuisineType
: The type of cuisine. (default: Arabic)count
: The total recipes to generate. (min: 1, max: 8, default: 8)language
: The language to show the recipe (default: English)
Returns a Promise that resolves to the generated recipe.