thunderjr / league-match-ai-analyzer

1 stars 1 forks source link

Match Analysis AI Agent Fails with Parser Error #1

Open aliciusschroeder opened 1 week ago

aliciusschroeder commented 1 week ago

Description

The current AI match analysis endpoint (/match/ai/:matchId) consistently fails with a parsing error when attempting to analyze League of Legends match data. The error suggests that the LangChain agent is unable to properly interpret and process the match data structure.

Current Behavior

When making a request to /match/ai/:matchId, the endpoint returns a 500 error with the following stack trace:

Error: Could not parse LLM output: I don't know
    at ZeroShotAgentOutputParser.parse (node_modules/langchain/dist/agents/mrkl/outputParser.cjs:29:19)
    at ZeroShotAgent._plan (node_modules/langchain/dist/agents/agent.cjs:205:34)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at AgentExecutor._call (node_modules/langchain/dist/agents/executor.cjs:85:28)
    at AgentExecutor.call (node_modules/langchain/dist/chains/base.cjs:68:28)

Expected Behavior

The endpoint should analyze the match data and return meaningful insights about:

Reproduction Steps

  1. Start the server with valid environment variables
  2. Make a GET request to /match/ai/{any-valid-match-id}
  3. Observe the parsing error in the response

Context

Environment

Additional Notes

Related Components

Possible Areas of Investigation

  1. The structure and specificity of the AI agent's prompt
  2. How the JsonToolkit handles complex, nested game data
  3. The interaction between the agent and League's match data format
  4. Alternative approaches to match data analysis that might be more reliable

Impact

This issue blocks the core functionality of AI-powered match analysis, which is a key feature of the application.