SerpAPI responses being truncated for AI Agent

I’m using the “AI Agent” node (very cool), with Conversational Agent. It has SerpAPI as a tool. It’s running the right search, and SerpAPI shows a long, rich search result on its dashboard. However, the search results are being truncated to a sentence or two when returned to the AI, which means the LLM is unable to answer the question.

I’m not sure if there’s anything I can do, but seems like SerpAPI node maybe needs options to be a little more verbose in returning results?

What is the error message (if any)?

No error, but results not useful.

Please share your workflow

Share the output returned by the last node

Questions asked was “Give me 4 products that sells that help with sleep, along with their URLs”. SerpAPI returned to the LLM this:

{
  "response": "[\"Our carefully curated catalogue of natural sleep aids promote relaxation and support your body's healthy production of melatonin, and serotonin and improve the ...\"]"
}

which is not enough data.

Information on your n8n setup

  • n8n version: 1.26.0
  • Database (default: SQLite): MySQL/PostgreSQL (can’t remember)
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): k8s
  • Operating system: Linux/MacOS

Hey @langabi,

Welcome to the community :tada:

I have just taken a quick look at it and while it looks to be truncated we are returning the snippet value as we are getting it. You can do the same test on the serpapi website and you will get the same result, In this case the query is site:faithful-to-nature.co.za sleep aids and the response for the first result is

[

    {
        "position": 1,
        "title": "Sleep Support",
        "link": "https://www.faithful-to-nature.co.za/health/cognitive-health/sleep-support",
        "redirect_link": "https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://www.faithful-to-nature.co.za/health/cognitive-health/sleep-support&ved=2ahUKEwiw6_7Xi9OEAxX_EVkFHXUlC5wQFnoECAYQAQ",
        "displayed_link": "https://www.faithful-to-nature.co.za › cognitive-health",
        "thumbnail": "https://serpapi.com/searches/65e1cd90ad7fa989bc3c8977/images/ef3d30f77482d04bdea67c54a173797df3fbf9e1dec7c8c54009193233fc35df.jpeg",
        "favicon": "https://serpapi.com/searches/65e1cd90ad7fa989bc3c8977/images/ef3d30f77482d04bdea67c54a173797d517e275d43d02044c877e6bd7b8d3d90.png",
        "snippet": "Our carefully curated catalogue of natural sleep aids promote relaxation and support your body's healthy production of melatonin, and serotonin and improve the ...",
        "snippet_highlighted_words":
        [
            "sleep aids"
        ]
        ,
        "rich_snippet":
        {
            "top":
            {
                "detected_extensions":
                {
                    "unknown": 7
                }
                ,
                "extensions":
                [
                    "7",
                    "day returns"
                ]
            }
        }
        ,
        "source": "faithful-to-nature.co.za"
    }