Best answer

Split Text into Chunks for AI Prompt always returns the same output

  • 10 October 2023
  • 7 replies
  • 984 views

Userlevel 1

I’m using the ‘Split text into chunks for AI Prompt’ to split an employment contract into clauses. I’ve tried different prompts, however, the outputs are just the same. The whole contract was split into 4 large chunks of text and a sentence was cut in the middle into two parts.

Here are some of my prompts:

“Split the employment contract into individual clauses and sections. Provide each clause and section as a separate output, and include the section heading or number if available.”

“Split the input text according to employment contract clauses, including:

  • Subject line
  • Governing Law
  • Position And Job Description (Duties And Responsibilities)
  • Salary, Bonus And Compensation
  • Benefits (Health Insurance, Dental, Retirement, And Professional Dues)
  • Termination And Notice Period
  • Leave
  • Confidentiality And Non-Disclosure (Intellectual Property)
  • Non-Compete And Non-Solicitation (Post Termination Restrictions)
  • Code Of Conduct And Policies
  • Conflicts Of Interest
  • Dispute Resolution

Output each item as one line item.”

“List all the clauses and sections of the employment contract. Provide each clause and section as a separate item, and include any section headings or numbers if available.”

 

 

 

 

icon

Best answer by Troy Tessalone 10 October 2023, 18:57

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

7 replies

Userlevel 7
Badge +14

Hi @ed_li 

Good question.

Instead, try using this Zap action: ChatGPT - Extract Structured Data

 

The Formatter > Text > Split Text into Chunks for AI Prompts is not meant to parse out data into specific individual line items, rather split into even chunks based on the provided inputs.

Help: https://help.zapier.com/hc/en-us/articles/15406374106765

Userlevel 1

Hi Troy

Exactly what I needed! Your expert help with my issue was invaluable. Grateful for your knowledge and kindness. Thank you!

By the way, Could you provide additional examples for "Split Text into Chunks" prompts? I've reviewed the link, but I'm still unsure about how it works. I'd like to explore it for potential use in future projects.

Thanks in advance.

Userlevel 7
Badge +11

That’s so great to hear, @ed_li! Big thanks to Troy for helping to point you in the right direction here! 🙌 🎉

The Formatter (Text > Split Text into Chunks for AI Prompts) action is designed to help avoid the issue of exceeding token limits when sending large data sets to different large language models (LLMs). It helps by breaking the data down into smaller segments of text that fit under your specific LLM’s token limit.

The help guide Troy linked to has a section at the bottom (Chunk example: summarize web page content) that links to the following Zap template that you might find useful to get a better idea of how it works in practice: OpenAI Web Page summarizer w/chunking support Zap template

Hope that helps to clarify things. Please do let us know if you run into any further issues or questions at all! 🙂

Userlevel 1

As mentioned, I've already reviewed the example you provided, but I'm still not entirely sure about its usage. It would be greatly appreciated if someone could provide me with additional examples. In the case where I want to split the content to address token limitations without creating a summary but retaining all the content, how should I formulate a prompt?

Userlevel 7
Badge +11

Sorry for the misunderstanding here, @ed_li.

The prompt you’d use in the Formatter (Text > Split Text into Chunks for AI Prompts) action would be the similar to the one you’re intending to use in the AI action (OpenAI, ChatGPT etc.) that will process the content that was split into chunks.

The reason the prompt you’re intending to use is asked for in the Formatter action is to help it to better calculate where it should split the content into chunks. 

So for example you could enter your prompt of “Split the employment contract into individual clauses and sections. Provide each clause and section as a separate output, and include the section heading or number if available.” into that Prompt field:
f23c9bc607fd335d6bf3d17f540396f2.png

And that should retain the existing content but split it into separate chunks, ready to be passed to the relevant AI app action. 

Can you give that a try and let as know if that works as hoped? 

Userlevel 1

Thanks for your suggestion and here is my findings.

There are about 10 clauses in my test case, however, I have just got 4 big chunks after running with the above prompt.  

Also, a sentence was splitted into two halves as below even I have added this line into the prompt “Split at the end of a clause or section, and avoid splitting in the middle of a sentence.”

 

It seems that the splitting logic is based solely on the "chunk size" and doesn't consider the content of the prompt.

Userlevel 7
Badge +11

Thanks for giving that a try @ed_li. I’m sorry to hear it didn’t work as hoped.

That really doesn’t seem like it’s the expected behaviour here so it may be that you’re running into a bug. I’d suggest contacting our Support team to investigate this further. They’ll be able to dig into the logs for your Zap to better determine whether this is indeed the result of a bug and can open up a bug report on your behalf.

Please do keep us updated on how you get on with them, keen to know what’s causing this to happen!