Repository: confident-ai/deepeval
Issue: Internal Server error in Component Test of AI Agent while Evaluating with ToolCorrectnessMetrics
Root cause: External Dependency Breakage

**Describe the bug**
While Running the Component Test evaluation in DeepEval to verify ToolCorrectnessMetics, I am getting Internal Server error

**To Reproduce**
Here is the code

```
@observe(type='agent', available_tools=["add_numbers", "subtract_numbers", "search_tool"], metrics=[ToolCorrectnessMetric()])
def main_ai_agent(query):
    agent = initialize_agent(
        tools= tools,
        llm=llm,
        agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
        verbose=True,
        return_intermediate_steps=True
    )

    response = agent.invoke(query)
    
    update_current_span(
        test_case = LLMTestCase(
            input=query, 
            tools_called=[ToolCall(name="add_numbers")],
            expected_tools=[ToolCall(name = "add_numbers")],
            actual_output=response['output'])
    )
    
    return response

```

As you can see in this code, the metrics is ToolCorrectnessMetrics and I am trying to verify if correct tool is being called (just hardcoded the tool name for simplicity)

**Expected behavior**
Evaluation should happen and show the ToolCorrectnessMetrics in Confident AI

**Exception**
`{
	"name": "Exception",
	"message": "Internal Server Error",
	"stack": "\u001b[31m---------------------------------------------------------------------------\u001b[39m\n\u001b[31mException\u001b[39m                                 Traceback (most recent call last)\n\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[8]\u001b[39m\u001b[32m, line 11\u001b[39m\n\u001b[32m      3\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mdeepeval\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m evaluate\n\u001b[32m      5\u001b[39m goldens = [\n\u001b[32m      6\u001b[39m     \u001b[38;5;66;03m# Golden(input=\"Who is the current president of USA in 2025, just give the name.\"),\u001b[39;00m\n\u001b[32m      7\u001b[39m     Golden(\u001b[38;5;28minput\u001b[39m=\u001b[33m\"\u001b[39m\u001b[33mWhat is sum of 20 and 40.\u001b[39m\u001b[33m\"\u001b[39m),\n\u001b[32m      8\u001b[39m     \u001b[38;5;66;03m# Golden(input=\"What is difference of 80 and 40.\")\u001b[39;00m\n\u001b[32m      9\u001b[39m ]\n\u001b[32m---> \u001b[39m\u001b[32m11\u001b[39m \u001b[43mevaluate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m     12\u001b[39m \u001b[43m    \u001b[49m\u001b[43mgoldens\u001b[49m\u001b[43m=\u001b[49m\u001b[43mgoldens\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[32m     13\u001b[39m \u001b[43m    \u001b[49m\u001b[43mobserved_callback\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmain_ai_agent\u001b[49m\u001b[43m)\u001b[49m\n\n\u001b[36mFile \u001b[39m\u001b[32m~/tryout/aiqaDemo/myenv312/lib/python3.12/site-packages/deepeval/evaluate/evaluate.py:249\u001b[39m, in \u001b[36mevaluate\u001b[39m\u001b[34m(test_cases, metrics, hyperparameters, goldens, observed_callback, identifier, async_config, display_config, cache_config, error_config)\u001b[39m\n\u001b[32m    242\u001b[39m         \u001b[38;5;28;01mfor\u001b[39;00m test_result \u001b[38;5;129;01min\u001b[39;00m test_results:\n\u001b[32m    243\u001b[39m             write_test_result_to_file(\n\u001b[32m    244\u001b[39m                 test_result,\n\u001b[32m    245\u001b[39m                 display_config.display_option,\n\u001b[32m    246\u001b[39m                 display_config.file_output_dir,\n\u001b[32m    247\u001b[39m             )\n\u001b[32m--> \u001b[39m\u001b[32m249\u001b[39m     confident_link = \u001b[43mglobal_test_run_manager\u001b[49m\u001b[43m.\u001b[49m\u001b[43mwrap_up_test_run\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m    250\u001b[39m \u001b[43m        \u001b[49m\u001b[43mrun_duration\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdisplay_table\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\n\u001b[32m    251\u001b[39m \u001b[43m    \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m    252\u001b[39m     \u001b[38;5;28;01mreturn\u001b[39;00m EvaluationResult(\n\u001b[32m    253\u001b[39m         test_results=test_results, confident_link=confident_link\n\u001b[32m    254\u001b[39m     )\n\u001b[32m    256\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m test_cases \u001b[38;5;129;01mand\u001b[39;00m metrics:\n\n\u001b[36mFile \u001b[39m\u001b[32m~/tryout/aiqaDemo/myenv312/lib/python3.12/site-packages/deepeval/test_run/test_run.py:966\u001b[39m, in \u001b[36mTestRunManager.wrap_up_test_run\u001b[39m\u001b[34m(self, runDuration, display_table, display)\u001b[39m\n\u001b[32m    960\u001b[39m delete_file_if_exists(\u001b[38;5;28mself\u001b[39m.temp_file_name)\n\u001b[32m    962\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[32m    963\u001b[39m     \u001b[38;5;28mlen\u001b[39m(test_run.test_cases) > \u001b[32m0\u001b[39m\n\u001b[32m    964\u001b[39m     \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(test_run.conversational_test_cases) > \u001b[32m0\u001b[39m\n\u001b[32m    965\u001b[39m ):\n\u001b[32m--> \u001b[39m\u001b[32m966\u001b[39m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mpost_test_run\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtest_run\u001b[49m\u001b[43m)\u001b[49m\n\n\u001b[36mFile \u001b[39m\u001b[32m~/tryout/aiqaDemo/myenv312/lib/python3.12/site-packages/deepeval/test_run/test_run.py:814\u001b[39m, in \u001b[36mTestRunManager.post_test_run\u001b[39m\u001b[34m(self, test_run)\u001b[39m\n\u001b[32m    812\u001b[39m \u001b[38;5;66;03m# return\u001b[39;00m\n\u001b[32m    813\u001b[39m api = Api()\n\u001b[32m--> \u001b[39m\u001b[32m814\u001b[39m result = \u001b[43mapi\u001b[49m\u001b[43m.\u001b[49m\u001b[43msend_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m    815\u001b[39m \u001b[43m    \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m=\u001b[49m\u001b[43mHttpMethods\u001b[49m\u001b[43m.\u001b[49m\u001b[43mPOST\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    816\u001b[39m \u001b[43m    \u001b[49m\u001b[43mendpoint\u001b[49m\u001b[43m=\u001b[49m\u001b[43mEndpoints\u001b[49m\u001b[43m.\u001b[49m\u001b[43mTEST_RUN_ENDPOINT\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    817\u001b[39m \u001b[43m    \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m=\u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m    818\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m    820\u001b[39m response = TestRunHttpResponse(\n\u001b[32m    821\u001b[39m     testRunId=result[\u001b[33m\"\u001b[39m\u001b[33mtestRunId\u001b[39m\u001b[33m\"\u001b[39m],\n\u001b[32m    822\u001b[39m     projectId=result[\u001b[33m\"\u001b[39m\u001b[33mprojectId\u001b[39m\u001b[33m\"\u001b[39m],\n\u001b[32m    823\u001b[39m     link=result[\u001b[33m\"\u001b[39m\u001b[33mlink\u001b[39m\u001b[33m\"\u001b[39m],\n\u001b[32m    824\u001b[39m )\n\u001b[32m    825\u001b[39m link = response.link\n\n\u001b[36mFile \u001b[39m\u001b[32m~/tryout/aiqaDemo/myenv312/lib/python3.12/site-packages/deepeval/confident/api.py:144\u001b[39m, in \u001b[36mApi.send_request\u001b[39m\u001b[34m(self, method, endpoint, body, params)\u001b[39m\n\u001b[32m    142\u001b[39m         \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m    143\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m144\u001b[39m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(res.json().get(\u001b[33m\"\u001b[39m\u001b[33merror\u001b[39m\u001b[33m\"\u001b[39m, res.text))\n\n\u001b[31mException\u001b[39m: Internal Server Error"
}`

**Desktop (please complete the following information):**
 - OS: MacOS
 -
**Smartphone (please complete the following information):**
 - OS: MacOS latest


**Additional context**
This is causing the evaluation to fail and I am unable to test component with Tool Calling for AI Agent.

Here is the evaluation code just in case


```
from deepeval.dataset import Golden
from deepeval.evaluate import AsyncConfig
from deepeval import evaluate

goldens = [
    Golden(input="What is sum of 20 and 40."),
]

evaluate(
    goldens=goldens, 
    observed_callback=main_ai_agent)
```


Thanks,

Hi @executeautomation , let me have a look at this and get back to you today