Skip to main content

5E Tips & Tricks

Some experiences we have gained and are still gaining while working with OpenAI.

Instructions

Few-shot-learning, train your bots on the fly or adjust their behavior, if they mismatch with your expectations. These examples shouldn't exceed 20 User + Assistant interactions. Use max 10 User and 10 Assistants messages.

A working Schema for OpenAI LLMs is the following.

User: "Write a complex question here, what your customers might ask the bot."
Assistant: "Show the assistant how or where to find relevant data for this type of question."

Right below are two Examples how you Train a bot, how it should use the search logs tool. The second example includes a fallback procedure for a failed search.

User: "What are the times you are open?"
Assistant: search_logs(query: "opening times", tags: ["faq", "store", "opening_times", "open_times", "open_time"])

User: "I need Information about the Company"
Assistant: tags_for_logs()
- (example response) {"tags": ["category_related", "company", "faq", "store", "privacy", "location", "miscellaneous", "performance"]}
Assistant: search_logs(query: "Information", tags: ["company", "store", "location"])
- (example response) "No logs or messages found"
Assistant: search_logs(tags: ["company", "store", "location"])

When your examples are ready to use, join them into a readable single line. What does readable mean? If you can read your final examples without issues, it's pretty likely good for assistants. But you can ask BaBu, if assistants will be able to understand your examples.

# Train how to get Valid tags foor "search_logs" and the "log" tool.
tags_for_logs()

# Train how to Search logs (all Few-shot examples should finally look like "search_logs" below, in one line, and still readable.)
search_logs(query: "QUERY", tags: ["TAGS"])

# Train how to write a log (priority is optional, defaulting to "medium").
log(
message: "QUESTION",
answer: "ANSWER",
tag: "TAG",
priority: ["low","medium","high"]
)

# Train how to call product properties, options, manufacturer and categories in a single request.
# The product properties response can be reduced for categories, where each category name set includes all of it's child notes.
get_product_properties(categories: ["FROM_CATEGORIES", "TO_CATEGORIES"])

# "Natural product search 3.0"
product_search(
query: "QUERY",
categories: ["CATEGORIES"],
properties: ["PROPERTIES","MANUFACTURER"],
limit: 5,
page: 1,
price_min: 0,
price_max: 10000,
order: "price_asc"
)

# Fetch the content of a web URL, or a page in your Shop, content must be accessible.
# The two extra options can both be set to false. Replace exactly true with false, no double or single quotations.
# The "sanitize" and "main_only" options do reducce the content size of HTML, from at times 500,000, 600.000 character, down to 10,000-20,000, while keeping the relevant data.
fetch_url(url: "http://example.com", sanitize: true, main_only: true)

# Tools with no additional options
get_faqs()
get_meta_information()

# Check out the "Create / Edit Assistants" page for all available tools.

There are several ways to provide data to your Assistants. Here's how to choose the best method:

  1. If unsure, first collect all your data in a file and check its token size using the OpenAI Tokenizer.
  2. For data under 5,000 tokens, or somewhere around:
    • Use the File alternative available in all our Assistant Manager plugins
    • Enable the "get_meta_information" tool to access this data
    • Note: This tool typically runs once, and its content remains available for subsequent calls
      • Assistants have a so-called "memory", which in reality is just the last 10 questions and their answers
  3. For data over 5,000 tokens:
    • Use our Assistants Log system
    • Important: Keep the data concise and optimized since this tool is frequently accessed
  4. For larger datasets or when options 1-3 aren't suitable:
    • Upload files to a vector_store and attach it to your Assistant
    • Always use vector_store for text formats (TEXT, HTML, PDF, etc.)

      Note: The file selection when creating/updating assistants expects structured data - use only if you're familiar with the format requirements. See: Assistants Code Interpreter