• Resolved ranawaleed007

    (@ranawaleed007)


    Hello, I’m using the free version of AI Engine and would like to limit each visitor to a total of 50 tokens for testing (and eventually 1000 tokens). I’m not using user login, so I plan to rely on sessions or cookies.

    I tried hooking into mwai_chat_response and also attempted intercepting the REST request with rest_pre_dispatch and rest_post_dispatch to track usage.total_tokens. However, the chat still truncates messages instead of blocking them.

    Could you please advise on:

    1. Which hooks or filters in AI Engine (free version) reliably give me the usage.total_tokens so I can track total usage for each visitor?
    2. How can I completely stop the chatbot from responding once the limit is reached, rather than just truncating?
    3. Is this only possible in the Pro version via the Statistics module, or can it be done in the free version with a custom snippet?

    Thank you for any guidance you can provide!

    Best Regards,
    Rana Waleed

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Val Meow

    (@valwa)

    Hey @ranawaleed007! 👋

    You can do this using the free version of the plugin, but you’d need to use filters like mwai_ai_query to track the number of queries for each user over a specific timeframe. Then, you can limit chatbot access by using the mwai_ai_allowed filter.

    If you’d rather have this supported directly within the plugin, you can check out the documentation to learn more. Let me know if you need any more help! 😊

    Thread Starter ranawaleed007

    (@ranawaleed007)

    Hi @valwa

    I bought the paid plugin, and it resolved my token issue. But I want to train it for fine-tuning. I tried to upload the JSONl, JSON, and CSV files, but no luck. Then I tried to contact the paid support team, but their response time was too slow. It feels like I lost my money and didn’t achieve what I wanted.

    Your Plugin says to upload the CSV file with 2 columns, what if we don’t have 2 columns CSV file? and what about JSON and JSONl why are they not uploading?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to Implement a Total Token Limit (No Login) in AI Engine (Free Version)’ is closed to new replies.