Repository: confident-ai/deepeval
Issue: How to pass expected_output parameters in Component-Level LLM Evaluation
Root cause: Unimplemented Feature Gap

I want to use Deepeval to evaluate our Agent. And i have read the [documentation](https://deepeval.com/docs/evaluation-component-level-llm-evals) . I would like to know whether Deepeval supports passing in `expected_output` parameters in Component-Level LLM Evaluation, and if so, how to use it.


For example, how to replace `"..."` in `capital_size_tool` and `capital_population_tool` with expected_output in test cases.

~~~python
from typing import List
from deepeval.tracing import observe, update_current_span, update_retriever_span
from deepeval.test_case import LLMTestCase, LLMTestCaseParams
from deepeval.metrics import AnswerRelevancyMetric
from deepeval.metrics import GEval
from model import MyModel
from agent import client
from agent import model

correctness = GEval(
    model=MyModel, 
    name="Correctness", 
    criteria="Determine if the 'actual output' is correct based on the 'expected output'.", 
    evaluation_params=[LLMTestCaseParams.ACTUAL_OUTPUT, LLMTestCaseParams.EXPECTED_OUTPUT])

@observe(metrics=[AnswerRelevancyMetric(model=MyModel)])
def capital_tool(input: str):
    res = client.chat.completions.create(
        model=model,
        messages=[
            {"role": "system", "content": "What's the capital of the country user asked"},
            {"role": "user", "content": input}
        ]
    ).choices[0].message.content

    # Create test case at runtime
    update_current_span(test_case=LLMTestCase(input=input, actual_output=res))
    return res

@observe(metrics=[correctness])
def capital_size_tool(input: str):
    output = client.chat.completions.create(
        model=model,
        messages=[
            {"role": "system", "content": "What's the city area size of the city user asked"},
            {"role": "user", "content": input}
        ]
    ).choices[0].message.content
    update_current_span(test_case=LLMTestCase(input=input, actual_output=output, expected_output="..."))
    return output

@observe(metrics=[correctness])
def capital_population_tool(input: str):
    output = client.chat.completions.create(
        model=model,
        messages=[
            {"role": "system", "content": "What's the city population of the city user asked"},
            {"role": "user", "content": input}
        ]
    ).choices[0].message.content
    update_current_span(test_case=LLMTestCase(input=input, actual_output=output, expected_output="..."))
    return output


def workflow(input: str):
    city = capital_tool(input)
    size = None
    population = None
    if city != None:
        size = capital_size_tool(city)
    if city != None:
        population = capital_population_tool(city)
    return f'size: {size}, population: {population}'

@observe()
def your_llm_app(input: str):
    return workflow(input)

async def your_async_llm_app(input: str):
    return your_llm_app(input)


### evaluation mode
from deepeval.dataset import EvaluationDataset, Golden
import asyncio

dataset = EvaluationDataset(goldens=[Golden(input="china", expected_output="beijin, 1000"), Golden(input="usa", "Washington, 1000")])

for golden in dataset.evals_iterator():
    # Create task to invoke your async LLM app
    task = asyncio.create_task(your_async_llm_app(golden.input))
    dataset.evaluate(task)

~~~


Hey @baowj-678 let us add support for this in the next few days, be come back to this very soon!