Skip to content

Conversation

@MQ37
Copy link
Contributor

@MQ37 MQ37 commented Jun 24, 2025

closes #121

Before we just truncated the stringified dataset JSON, which almost always broke the JSON structure and tool result context (not all fields were present). This new logic pops dataset items one by one from the back either until the max character limit is reached or until only one item is remaining. Then, we improve the truncated info message by guiding the LLM to use the truncated count and offset in the get dataset items tool. This logic keeps the JSON structure valid and ensures that the tool/Actor results fit into the LLM context.

Note: Specific/bad Actors may have weird output schemas and can technically dump the whole output into a single huge dataset item, but I think we should not handle this case - the Actor creator should ensure user and LLM friendly output.

@github-actions github-actions bot added the t-ai Issues owned by the AI team. label Jun 24, 2025
@MQ37
Copy link
Contributor Author

MQ37 commented Jun 24, 2025

@jirispilka what do you think about this logic? Tested with Claude desktop and never reached a context window limit error when making a tool call.

@MQ37
Copy link
Contributor Author

MQ37 commented Jul 2, 2025

closing as we will rework the logic based on the meeting notes - right now dump all the content but with relevant fields only

@MQ37 MQ37 closed this Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-ai Issues owned by the AI team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize data truncation and improve logic when data are truncated

1 participant