PalySales Docs

AI Assistant

How the PalySales AI sales assistant works — model cascade, semantic search, knowledge base, and customization.

PalySales uses OpenAI's language models to power your AI sales assistant. It understands your product catalog, answers customer questions in natural language, and processes orders conversationally across all your connected channels.

How the AI Works

Model Cascade

PalySales uses a two-tier model system to balance cost and quality:

ModelRoleHandlesCost (per 1M tokens)
gpt-4o-miniPrimary model~85% of messages$0.15 input / $0.60 output
gpt-4oFallback model~15% of messages$2.50 input / $10.00 output

Most conversations are handled by the faster, cheaper model. The system automatically escalates to the more capable model when:

  • The primary model's confidence drops below 0.7 (it's not sure of its answer)
  • A parse error occurs (the response format is invalid)
  • A tool call fails (e.g., product search returned an error)
  • Low-confidence phrases are detected (like "I don't understand" or "I'm not sure")

This keeps your costs low while ensuring quality when conversations get complex.

What the AI Knows About Each Conversation

Every time the AI responds, it has access to:

  • Your store information — name, contact details, business hours
  • The AI personality you've configured — tone and language preferences
  • Customer details — name, saved addresses, previous order history
  • Conversation state — where the customer is in the buying process (browsing, has items in cart, checking out, etc.)
  • Current cart contents — what the customer has added so far
  • Your product catalog — found through semantic search based on what the customer asks
  • Your knowledge base — policies, FAQs, uploaded documents
  • Payment options — dynamically built from your storefront settings
  • Recent messages — the last 10 messages for conversation continuity

Tools the AI Can Use

The AI doesn't just chat — it can take actions:

ToolWhat It Does
search_productsSearches your product catalog based on what the customer asks
add_to_cartAdds an item to the customer's cart
get_cartShows the customer what's in their cart
checkoutStarts the checkout and payment process
search_knowledgeSearches your knowledge base for policies, FAQs, and store info
handoff_to_humanTransfers the conversation to a human team member

When a customer asks about a product, the AI uses semantic search — not keyword matching. This means it understands the meaning behind questions, not just exact words.

How It Works

  1. When you save a product, PalySales creates a mathematical representation (called an "embedding") of the product title + description + search terms
  2. These embeddings are stored in your database using pgvector
  3. When a customer asks a question, their query is converted to the same type of embedding
  4. PalySales finds products whose embeddings are most similar to the query
  5. Products with a similarity score above 0.35 are included as context for the AI

Example: A customer asks "do you have something warm for winter?" — the AI will find jackets, sweaters, and scarves even if none of those products contain the words "warm" or "winter" in their descriptions.

If semantic search doesn't find relevant products, PalySales falls back to tag-based search, then to fuzzy text search.

Regenerating Embeddings

If you've updated many product descriptions and want to refresh the search index:

  1. In the left sidebar, click Products
  2. Click the Actions menu (three dots) in the top-right area
  3. Select Regenerate Embeddings

This can also be done via the API: POST /api/products/generate-embeddings.

Customizing Your AI

AI Personality

To configure your AI assistant's behavior, click AI Assistant in the left sidebar. On the right side of the page, you'll see the personality selector with three options:

OptionDescription
ProfessionalPolite, concise, and business-focused responses
FriendlyWarm, conversational, and helpful tone
PlayfulCasual tone with emojis and enthusiasm

Below the personality selector, you can also configure:

SettingWhat It Does
AI EnabledMaster on/off switch for AI responses
Auto ReplyWhether the AI automatically responds to incoming messages
Greeting MessageThe first message customers see when they start a conversation
Fallback MessageSent when the AI can't generate a response
Handoff KeywordsWords or phrases that trigger a handoff to a human (e.g., "speak to manager")
LanguageThe primary language the AI responds in
Business HoursOptional schedule — outside hours, the AI can send an away message

Click Save in the top-right corner after making changes.

Knowledge Base

The knowledge base is on the left side of the AI Assistant page. This is where you teach your AI additional information beyond your product catalog.

Three ways to add knowledge:

  1. Upload a file — drag and drop a PDF, DOCX, or TXT file into the upload area at the top (max 10MB per file). PalySales extracts the text, generates embeddings, and the AI can search it when answering questions.

  2. Import from a URL — below the upload area, paste a web URL and click the import button. PalySales fetches the page content and indexes it.

  3. Write content directly — click Write content directly to open a text editor. Type or paste your knowledge (minimum 10 words), give it a title, and save it.

Each document shows its status (Learned or Processing), word count, and type. You can preview, edit, refresh (for URL sources), or delete documents using the action buttons on each row.

Store Intelligence

On the right side of the AI Assistant page, below the personality selector, there's a Store Intelligence panel. This shows an automatically generated summary of your store that the AI uses as baseline knowledge.

The summary includes:

  • Your store details and contact information
  • Your full product catalog with prices and variants
  • Delivery options and fees
  • Payment methods
  • Active deals and promotions
  • Policy FAQs

This summary regenerates automatically whenever you update products, delivery settings, payment options, or policies. You can also click the Regenerate button to manually refresh it.

Store Policies

Store policies feed directly into the AI's knowledge. To manage them:

  1. In the left sidebar, click Settings
  2. Click Policies

You'll see four policy types:

PolicyWhat It Covers
PrivacyHow you collect, use, and protect customer data
TermsRules and conditions for using your store
ReturnsReturn windows, refund process, and eligibility
ShippingDelivery methods, costs, and timelines

Each policy card shows its current status: Published (green), Draft (yellow), or Empty.

To create a policy:

  • Click the policy card to open the editor
  • Write it manually in the markdown editor, OR
  • Click Generate with AI (the sparkles icon) to have the AI write a policy based on your store's country, currency, products, and delivery settings
  • Toggle Publish to make it live
  • Click Save

When a policy is published, it's automatically synced to the knowledge base. The AI can then reference it when customers ask about shipping times, return policies, etc.

After publishing a policy, you'll see a banner offering to generate FAQ items from it — these are added to your Store Intelligence summary for quick AI reference.

Usage Tracking

All AI usage is tracked per store and resets on the 1st of each month:

MetricWhat It Tracks
ConversationsNumber of AI-powered conversation sessions
MessagesTotal individual messages sent and received
Input TokensTokens sent to the AI (prompts + context)
Output TokensTokens generated by the AI (responses)
AI CostTotal cost of AI operations
Embedding TokensTokens used for semantic search operations
Embedding CostCost of embedding operations
Total CostSum of all AI and embedding costs

Each event is logged individually with metadata (which model was used, whether escalation occurred, and per-model costs). This data powers the analytics in your dashboard.

Check your usage anytime in Settings → Billing, or via GET /api/usage.

See Billing & Plans for plan limits on conversations and messages.

On this page