Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly Handle LLM Parsing Errors #155

Open
jfrank-summit opened this issue Jan 20, 2025 · 0 comments
Open

Properly Handle LLM Parsing Errors #155

jfrank-summit opened this issue Jan 20, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jfrank-summit
Copy link
Member

Periodically, the LLM will return data in a way that cannot be properly parsed. This currently crashes the process. Instead, it should be handled gracefully with retries.

2025-01-19 23:41:21.812 | ERROR   | [app] | Error running workflow: Failed to parse. Text: "{"trends": [
    {
        "topic": "AI Agents and Crypto Ecosystem Evolution",
        "description": "Emerging narrative around AI agents, tokenization, and blockchain platforms like Solana and Base competing for dominance in the next-gen crypto ecosystem",
        "trendStrength": 0.85
    },
    {
        "topic": "Memecoin and Political Tokenization",
        "description": "Emerging trend of political figures and celebrities launching tokens, with Trump's memecoin sparking broader speculation about token launches",
        "trendStrength": 0.72
    }
], "summary": "The crypto landscape is undergoing a transformative moment, characterized by the convergence of AI agent technologies, blockchain platforms, and novel tokenization strategies. Solana has emerged as a key battleground, demonstrating significant momentum in both meme coin and AI agent narratives, with platforms like Virtuals pioneering AI agent tokenization. The recent Trump memecoin launch symbolizes a broader shift towards more dynamic, community-driven token ecosystems that challenge traditional financial paradigms. This convergence suggests we're witnessing the early stages of a radical reimagining of digital ownership, community engagement, and technological innovation, where the boundaries between speculation, technology, and social movement become increasingly blurred."}
```". Error: SyntaxError: Unexpected non-whitespace character after JSON at position 1365 (line 13 column 1)

Troubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE/

{
  "llmOutput": "{\"trends\": [\n    {\n        \"topic\": \"AI Agents and Crypto Ecosystem Evolution\",\n        \"description\": \"Emerging narrative around AI agents, tokenization, and blockchain platforms like Solana and Base competing for dominance in the next-gen crypto ecosystem\",\n        \"trendStrength\": 0.85\n    },\n    {\n        \"topic\": \"Memecoin and Political Tokenization\",\n        \"description\": \"Emerging trend of political figures and celebrities launching tokens, with Trump's memecoin sparking broader speculation about token launches\",\n        \"trendStrength\": 0.72\n    }\n], \"summary\": \"The crypto landscape is undergoing a transformative moment, characterized by the convergence of AI agent technologies, blockchain platforms, and novel tokenization strategies. Solana has emerged as a key battleground, demonstrating significant momentum in both meme coin and AI agent narratives, with platforms like Virtuals pioneering AI agent tokenization. The recent Trump memecoin launch symbolizes a broader shift towards more dynamic, community-driven token ecosystems that challenge traditional financial paradigms. This convergence suggests we're witnessing the early stages of a radical reimagining of digital ownership, community engagement, and technological innovation, where the boundaries between speculation, technology, and social movement become increasingly blurred.\"}\n```",
  "sendToLLM": false,
  "lc_error_code": "OUTPUT_PARSING_FAILURE",
  "pregelTaskId": "bda08159-899b-5044-8e65-b082b882c442",
  "stack": "Error: Failed to parse. Text: \"{\"trends\": [\n    {\n        \"topic\": \"AI Agents and Crypto Ecosystem Evolution\",\n        \"description\": \"Emerging narrative around AI agents, tokenization, and blockchain platforms like Solana and Base competing for dominance in the next-gen crypto ecosystem\",\n        \"trendStrength\": 0.85\n    },\n    {\n        \"topic\": \"Memecoin and Political Tokenization\",\n        \"description\": \"Emerging trend of political figures and celebrities launching tokens, with Trump's memecoin sparking broader speculation about token launches\",\n        \"trendStrength\": 0.72\n    }\n], \"summary\": \"The crypto landscape is undergoing a transformative moment, characterized by the convergence of AI agent technologies, blockchain platforms, and novel tokenization strategies. Solana has emerged as a key battleground, demonstrating significant momentum in both meme coin and AI agent narratives, with platforms like Virtuals pioneering AI agent tokenization. The recent Trump memecoin launch symbolizes a broader shift towards more dynamic, community-driven token ecosystems that challenge traditional financial paradigms. This convergence suggests we're witnessing the early stages of a radical reimagining of digital ownership, community engagement, and technological innovation, where the boundaries between speculation, technology, and social movement become increasingly blurred.\"}\n```\". Error: SyntaxError: Unexpected non-whitespace character after JSON at position 1365 (line 13 column 1)\n\nTroubleshooting URL: https://js.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE/\n\n    at StructuredOutputParser.parse (file:///home/jfrank/repos/autonomys-agents/node_modules/langchain/dist/output_parsers/structured.js:84:23)\n    at StructuredOutputParser.parseResult (file:///home/jfrank/repos/autonomys-agents/node_modules/@langchain/core/dist/output_parsers/base.js:57:21)\n    at StructuredOutputParser._callWithConfig (file:///home/jfrank/repos/autonomys-agents/node_modules/@langchain/core/dist/output_parsers/base.js:43:72)\n    at StructuredOutputParser._callWithConfig (file:///home/jfrank/repos/autonomys-agents/node_modules/@langchain/core/dist/runnables/base.js:216:34)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async RunnableSequence.invoke (file:///home/jfrank/repos/autonomys-agents/node_modules/@langchain/core/dist/runnables/base.js:1251:27)\n    at async RunnableCallable.func (file:///home/jfrank/repos/autonomys-agents/dist/agents/workflows/kol/nodes/analyzeTrendNode.js:11:27)\n    at async RunnableCallable.invoke (file:///home/jfrank/repos/autonomys-agents/node_modules/@langchain/langgraph/dist/utils.js:79:27)\n    at async RunnableSequence.invoke (file:///home/jfrank/repos/autonomys-agents/node_modules/@langchain/core/dist/runnables/base.js:1245:33)\n    at async _runWithRetry (file:///home/jfrank/repos/autonomys-agents/node_modules/@langchain/langgraph/dist/pregel/retry.js:96:22)"
}
@jfrank-summit jfrank-summit added the bug Something isn't working label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant