TextChunker doesn't handle Markdown Tables #637
Replies: 3 comments
-
hi @Licantrop0, it's not that simple. What if a table is too big for the embedding model? I think a more advanced chunker would split by row, keeping the row header in each chunk. Even in this case a row might be too big, so there's need for more complex logic. |
Beta Was this translation helpful? Give feedback.
-
I described how to approach the problem if the entire table doesn't fit the embedding model, down to the single cell. It's also difficult with the current Memory APIs to get the nearby partitions like it was done in this old example: https://github.com/Azure-Samples/semantic-kernel-rag-chat/blob/cc51e164ac1e559e80437918c671ab6257e7c873/src/chapter2/Chapter2Function.cs#L45 For reference, the current approach is this: |
Beta Was this translation helpful? Give feedback.
-
Thanks for the details. The existing chunker is a sample with its limitations, and we welcome improvements. The behavior with markdown file is a bare minimum implementation, and there are improvements that could be made with regards to tables, lists, headers etc. If someone wants to work on adding the feature described above or other improvements we'd be open to help with PR reviews. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context / Scenario
TextChunker doesn't have any code to properly handle Markdown Tables.
In fact, when searching using Memory a markdown file with tables, I often find unusable truncated tables in the recalled partitions.
What happened?
Tables in markdown need to be chunked in a single embedding, it doesn't make sense to split the content strictly based on token limit.
Here an example of a recalled partition:
The top line "no | no | yes |" is a partial row of this full table:
Embedding part of table rows out of context will significantly reduce the grounding ability of the LLM to answer questions.
Here is how I would expect Markdown Tables embeddings to be chunked:
Importance
I cannot use Kernel Memory
Platform, Language, Versions
I'm using C# with the following packages:
Here the code snippet:
Relevant log output
No response
Beta Was this translation helpful? Give feedback.
All reactions