Skip to content

An AI-powered search engine with a generative UI

Limit retrieved content to 5000 characters

Yoshiki Miura0770c9d5015f
diff --git a/lib/agents/tools/retrieve.tsx b/lib/agents/tools/retrieve.tsx
index baaea04a..2d627ae3 100644
--- a/lib/agents/tools/retrieve.tsx
+++ b/lib/agents/tools/retrieve.tsx
@@ -26,6 +26,10 @@ export const retrieveTool = ({ uiStream, fullResponse }: ToolProps) => ({
if (!json.data || json.data.length === 0) {
hasError = true
} else {
+ // Limit the content to 5000 characters
+ if (json.data.content.length > 5000) {
+ json.data.content = json.data.content.slice(0, 5000)
+ }
results = {
results: [
{