How to avoid Assitatants API to trunc a sentence or use "..." as the end of a sentence?

Hi,
I am trying to use Assistants API to optimize product titles based on provided product information. I provide a .json file with thoutands of products, and I want the assistant optimize the titles based on language model, then return them in a new .json file. The following is an example of my prompt:

Run instruction:
You are product feed editor. Your optimize the titles of product feeds based on provided info, like brand, description, product type etc, and follow those best practices:

  1. Include in the title keywords that people will probably used when searching for the product
  2. start the title with a brand name.
  3. highlight product features: Include unique product features and benefits in the title.
  4. Use specific product names in the title, including the model, color, size, and material if available.
  5. Must have length between 50-150 characters.

User:
Please read all the product feeds from the .json file provided in the assitant, and then use you language model to understand the feeds and optimize their titles following the rules provided in the assistant instruction. After all, Use Code Interpreter to output the ids and new titles of all the product feeds to a json file, with format {‘id’: “id value”, “new_title”: “new_title_value”}.

I have a title length limitation, and what I want is the Assistant reduce the length semantically, but what I got is one of the three results

  1. trunc the sentence and break a word
  2. have “…” at the end of each title
  3. simply add a brand name before the previous title
  4. I tried to remove the characters limit, then it just returned me the “title” + “description”

I want to ask how should I change my prompt and possibly improve the resut?

Thank you!

I would first probably try to get to a process that can work on small batches - not the full one. I would consider having two processes -one for working through the list - and one for just procssing and creating the title.

For title it self I would just get way more specific (you say ‘a brand name’ that would technically be any brand name, so even the brand name for a previous record … :wink: )
So I would try things like:
5. The title must always consist of full words and be a complete sentence. The title can never be more than 150 characters long. You must re-write the title if it as longer than 150 characters.

p.s. Your 1) is what you want, but not very actionable for the Asssitant I think because it does not magically have an idea of what people would be searching for.
number 3) and numvber 5) are probably also hard - 150 characters, after having mandatory things like brandname and 4) model, color size … etc - difficult?

Lastly - do you also have a file with the 50 best examples? That would probably be helpful as well for the Assistnat as a way of finetuning.

1 Like

Thank you, jlvanhulst! I will modify the aspects you mentioned and try.