/ask-ai

This endpoint allows you to interact with an AI service by sending a prompt. You can specify the prompt and receive a response in either text or JSON format. This service is useful for generating content or retrieving AI-based insights based on the provided input.

Endpoint Information

  • Method: POST
  • Endpoint URL: https://node.nodetrigger.com/api/ask-ai
  • Content Type: application/json

Example Requests

Here is how you can structure your request:


{
    "prompt": "What is the capital of France?",
    "context": "geography",  // Optional: Provide additional context
    "format": "text"         // Optional: Specify 'text' or 'json' for the response format
}

If you prefer a JSON formatted response:


{
    "prompt": "List three popular programming languages.",
    "format": "json",
    "json_keys": ["language1", "language2", "language3"]
}

If you want the service to auto-generate keys for JSON format:


{
    "prompt": "List three popular programming languages.",
    "format": "json"
}

Notes

  • The prompt field is mandatory in your request. Ensure it is included to get a proper response.
  • You can enhance the AI response by providing additional context. This is optional.
  • When requesting a response in json format, you can define custom keys using json_keys. If not provided, default keys will be generated automatically based on the requested count.
  • An error message will be returned if the request fails for some reason. Ensure your request structure matches the examples provided for best results.

“`