Documentação Reward Loyalty

OpenAI Support

The script supports an AI feature for users with the Partner role. For some text fields, an AI button is available:

OpenAI Support

Enable Support

To enable this feature, modify the .env file in the root directory of your website.

If the following lines are missing, feel free to add them:

# OpenAI or compatible AI config
OPENAI_ENABLED=true
OPENAI_API_KEY="your-api-key"
OPENAI_MODEL="gpt-3.5-turbo"
OPENAI_BASE_URL="https://api.openai.com/v1"

Obtaining an OpenAI API Key

To obtain an OpenAI API key, follow these steps:

  1. Sign Up or Log In: Visit the OpenAI website and sign up for an account or log in if you already have one.

  2. Navigate to API Keys: Once logged in, go to the API keys section of your account. This is usually found in the user settings or under the API section.

  3. Generate a New API Key: Click on the button to generate a new API key. Name your key for easy identification, and OpenAI will provide you with a unique API key.

  4. Copy the API Key: Copy the generated API key and store it securely. You will need to use this key in your .env file.

  5. Enter API Key in .env File: Add your API key to the OPENAI_API_KEY field in your .env file:

OPENAI_API_KEY="your-api-key"

Available Models and Their Costs

OpenAI offers several models you can use with their API. The models differ in terms of capabilities and cost. Here’s a detailed list:

  1. GPT-4

    • gpt-4o: The flagship model offering optimal performance for complex tasks.
    • gpt-4: An advanced model offering high performance for a variety of tasks.
    • gpt-4-turbo: A more cost-effective version of GPT-4 with slightly lower performance.
    • Cost: Higher than previous models due to its advanced capabilities.
  2. GPT-3.5

    • gpt-3.5-turbo: A highly capable model with improved performance over the GPT-3 series.
    • Cost: Generally lower than GPT-4 but higher than earlier models.

By following these instructions, you can enable and configure the AI support feature for your Partner role users, ensuring they have access to advanced language processing capabilities powered by OpenAI.

Using and Configuring LM Studio

Overview

LM Studio is a powerful tool designed to enhance language model capabilities for your applications. It provides a user-friendly interface to configure and utilize language models effectively.

Installation

  1. Download LM Studio: Visit the official LM Studio website and download the latest version suitable for your operating system.
  2. Install the Software: Follow the installation instructions provided on the website. The process is straightforward and involves running an installer.

Configuration

To configure LM Studio for use with your script, follow these steps:

  1. Open LM Studio: Launch the application after installation.
  2. Download a Language Model: Choose and download the appropriate language model from the available options, for example, Meta-Llama-3-8B-Instruct-Q4_K_M.gguf.
  3. Navigate to Local Server: In the LM Studio interface, go to the 'Local Server' section.
  4. Start the Server: Click on "Start Server" to initiate the local server.

Example Configuration

After setting up LM Studio, you need to update your application's .env file to point to the local server started by LM Studio:

# OpenAI or compatible AI config
OPENAI_ENABLED=true
OPENAI_API_KEY="lm-studio"
OPENAI_BASE_URL="http://localhost:1234/v1"

By following these steps, you can effectively use LM Studio to enable the AI capabilities for local testing.