Main site

AI Capabilities in JsRates

JsRates provides AI (Artificial Intelligence) tools for generating, explaining, and completing JavaScript shipping rate code. You can use the tools within the JsRates editor, the JsRates GPT code generator, or connect your preferred AI assistant to the JsRates MCP server.

AI Code Generation

JsRates incorporates AI technology to streamline the process of generating shipping rate code. Our AI code generator translates natural language prompts into functional code snippets, supporting a range of languages like English, French, German, and more. Familiarize yourself with JsRates' features for effective use and always test the generated code thoroughly.

Methods of AI Code Generation

JsRates offers three methods for AI-assisted code generation:

1. JsRates AI Generator

The JsRates AI generator is integrated within the app, utilizing our server resources. It's designed for ease of use directly within the JsRates environment.

  • Usage Quota: This method counts towards the AI characters usage quota of your plan.

  • How to Use:

    1. In the Editor page, open a new code editor file. Write your prompt as a comment, highlight it, right-click, and select Generate code.
    2. Alternatively, use the More Actions dropdown. Select Generate Code and input your prompt in the popup window.

    AI Code generation - JsRates

2. JsRates GPT Code Generator

The JsRates GPT code generator leverages OpenAI's powerful gpt-4 model, specially configured for generating JsRates shipping rate code.

  • OpenAI ChatGPT-Plus Account: You need an OpenAI ChatGPT-Plus account to access this generator.

  • How to Use:

    1. Visit the JsRates Shipping Rate Code Generator on the OpenAI platform.
    2. Log in to your OpenAI ChatGPT-Plus account if prompted.
    3. Enter your prompts in the JsRates Shipping Rate Code Generator interface.
    4. Copy the generated code, paste it on JsRates code editor, test and run.

    GPT - JsRates Shipping Rate Code Generator

3. JsRates MCP Server

The JsRates MCP server connects compatible AI assistants, including ChatGPT, Claude, and Codex, to the official JsRates documentation, shipping code examples, and a checker for common code mistakes. This helps your assistant generate code that follows JsRates conventions and explain how to use its features.

  • Cost and Access: The MCP server is free and does not require a JsRates account, API key, or sign-in. Your AI provider's subscription requirements and usage limits still apply.
  • How to Use:
    1. Follow the JsRates MCP server setup guide to connect your AI assistant.
    2. Select or enable JsRates for the conversation and describe your shipping requirements.
    3. For complex rules, attach your requirements document and rate tables, where supported, or paste the details into the conversation. Ask the assistant to summarize the rules and clarify missing or conflicting details before generating code.
    4. Ask the assistant to check the generated code using the JsRates code checker and provide test cases with expected results.
    5. Copy the code into the JsRates Editor and test it before using it for live shipping rates.

The MCP server does not access your store, read your saved code, or change your shipping settings. Paste any existing code you want help with into the conversation. The code checker identifies common mistakes but does not run the code or guarantee correct rates.

Getting Started with AI Code Generation

  • Understand JsRates Features: Familiarize yourself with JsRates' capabilities to craft effective prompts.
  • Explore Documentation: Review our sample codes and built-in modules for insights into creating prompts that yield the best results.
  • Verify Generated Code: Due to the complexities of AI, always test the generated code for accuracy and functionality before implementation.

Helpful Hints

  • Refinement: If the initial AI response doesn't meet your expectations, tweak your prompt by incorporating elements from the response to improve accuracy.
  • Repetition for Clarity: Don't hesitate to submit the same prompt again; occasionally, a repeated prompt can lead to a more precise response.
  • Detailed Requirements: Provide destinations, rate tables, weight units, thresholds, surcharges, exclusions, and rule priorities. Include example carts with expected rates. For complex requirements, use the MCP workflow to share a rules document and clarify the requirements before generating code.
  • Specificity is Key: When referring to JsRates built-in modules, always use the exact function or variable names to ensure the AI understands the context correctly.

By following these tips, you'll enhance the AI's ability to generate useful and accurate code snippets, making your development process smoother and more efficient.

As with any LLM AI model outputs, always verify the generated code for accuracy before deploying it live.

AI Code Explanation

The AI code explanation feature translates code snippets into understandable natural language descriptions.

  • Highlight a snippet, right-click, and select Explain Selection to receive a detailed explanation in a pop-up window.

AI Code Completion

Improve your coding efficiency with AI-powered code completion.

  • For partial code snippets, right-click the highlighted section and choose Complete Selection to have the AI suggest a continuation.

Understanding AI Usage Limits

The following usage limits apply to the AI tools within the JsRates app. When using the MCP server with an external AI assistant, your AI provider's own usage limits apply.

  • For Demo Users: You're allocated up to 500,000 characters for AI interactions.
  • For Full Plan Users: You have a monthly quota of 5,000,000 characters. Note that unused characters quota does not roll over to the next month.
  • Character Counting: The character usage count includes both the prompts you enter and the context information generated by JsRates system for your prompt, and the responses generated by the JsRates AI. The count does not include white space characters.
  • Usage Monitoring: Keep track of your AI usage on the Analytics page, which helps ensure that you stay within the allocated limits of your current plan.

JsRates AI Code Generator in Action

The following video demonstrates the AI code generator in action.