@mazaal-dev/grok
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

Grok AI Integration for Mazaal

This integration allows you to leverage Grok AI, X's powerful large language model, within your Mazaal AI workflows. Connect to Grok's advanced AI capabilities for text generation, image analysis, and image creation.

Features

  • Ask Grok: Send text prompts to Grok AI for natural language responses
  • Vision Prompt: Send images to Grok for visual analysis and description
  • Generate Image: Create images based on text prompts
  • Custom API Call: Make custom API calls to the Grok API for advanced use cases

Authentication

To use this integration, you'll need a Grok API key:

  1. Visit X's developer portal and log in to your account
  2. Navigate to your account settings or developer dashboard
  3. Look for the API section and generate a new API key
  4. Copy and securely store your API key
  5. Enter this API key when configuring the Grok connection in Mazaal AI

Model Capabilities

Grok offers different models with various capabilities:

  • Text Models: Core language models for text generation (e.g., grok-3-beta, grok-3-mini-beta)
  • Vision Models: Models that can process and analyze images (e.g., grok-vision-beta, grok-2-vision-1212)
  • Image Generation Models: Models that can create images from text prompts (e.g., grok-2-image-1212)

Usage Examples

Ask Grok

The "Ask Grok" action sends text prompts to Grok AI and receives natural language responses:

{
  "model": "grok-3-beta",
  "prompt": "Explain quantum computing in simple terms",
  "temperature": 0.7,
  "maxTokens": 1024
}

Perfect for:

  • Question answering
  • Content generation
  • Code explanation
  • Problem solving

Vision Prompt

The "Vision Prompt" action sends images to Grok for analysis:

{
  "model": "grok-vision-beta",
  "prompt": "What can you tell me about this image?",
  "image": "{{steps.image_url.output}}"
}

Use cases:

  • Image captioning
  • Object identification
  • Scene description
  • Visual question answering

Generate Image

The "Generate Image" action creates images based on text descriptions:

{
  "model": "grok-2-image-1212",
  "prompt": "A futuristic city with flying cars under a purple sky",
  "responseFormat": "url"
}

Applications:

  • Creative content generation
  • Visual concept exploration
  • Design inspiration
  • Marketing assets

Custom API Call

For advanced users who need direct access to the Grok API:

{
  "url": "/chat/completions",
  "method": "POST",
  "body": {
    "model": "grok-3-beta",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello, who are you?"}
    ]
  }
}

Best Practices

  • Be Specific: Detailed prompts yield better results
  • Set the Right Temperature: Lower values (0.1-0.3) for factual responses, higher values (0.7-0.9) for creative outputs
  • Use System Messages: Guide the model's behavior with appropriate system messages
  • Consider Token Limits: Keep requests within token limits to avoid truncated responses

Troubleshooting

  • Authentication Errors: Verify your API key is valid and correctly entered
  • Model Unavailability: Ensure the selected model exists and is available in your region
  • Rate Limiting: If you encounter rate limits, implement appropriate backoff strategies
  • Unexpected Outputs: Try refining your prompt or adjusting parameters for better results

Additional Resources


For support questions, feature requests, or bug reports, please contact support@mazaal.ai

/@mazaal-dev/grok/

    Package Sidebar

    Install

    npm i @mazaal-dev/grok

    Weekly Downloads

    67

    Version

    1.3.0

    License

    none

    Unpacked Size

    56.8 kB

    Total Files

    20

    Last publish

    Collaborators

    • mazaal
    • turtuvshin