Repository: confident-ai/deepeval
Issue: Invalid value for 'top_logprobs': must be less than or equal to 5 for AzureOpenAi Models
Root cause: Validation Gap

**Describe the bug**
The value range for `top_logprobs` with azureopenai is 0-5, but we are sending `20` as the default hardcoded value in `metrices/g_eval/g_eval.py` 
This raises the following exception. 
```
Traceback (most recent call last):
  File "/home/human_object/programming/dobby-be/src/deepeval_test.py", line 44, in <module>
    metric.measure(test_case)
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/deepeval/metrics/g_eval/g_eval.py", line 132, in measure
    ) = loop.run_until_complete(self._measure_async(test_case))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/deepeval/metrics/g_eval/g_eval.py", line 196, in _measure_async
    await self.a_measure(test_case, _show_indicator=False)
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/deepeval/metrics/g_eval/g_eval.py", line 174, in a_measure
    g_score, reason = await self._a_evaluate(test_case)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/deepeval/metrics/g_eval/g_eval.py", line 255, in _a_evaluate
    res, cost = await self.model.a_generate_raw_response(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/tenacity/_asyncio.py", line 47, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/tenacity/__init__.py", line 314, in iter
    return fut.result()
           ^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/tenacity/_asyncio.py", line 50, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/deepeval/models/gpt_model.py", line 155, in a_generate_raw_response
    res = await chat_model.ainvoke(prompt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/runnables/base.py", line 4076, in ainvoke
    return await self.bound.ainvoke(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 186, in ainvoke
    llm_result = await self.agenerate_prompt(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 554, in agenerate_prompt
    return await self.agenerate(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 514, in agenerate
    raise exceptions[0]
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 617, in _agenerate_with_cache
    return await self._agenerate(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/langchain_openai/chat_models/base.py", line 533, in _agenerate
    response = await self.async_client.create(messages=message_dicts, **params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 1283, in create
    return await self._post(
           ^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/_base_client.py", line 1805, in post
    return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/_base_client.py", line 1503, in request
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/human_object/.pyenv/versions/3.11.9/lib/python3.11/site-packages/openai/_base_client.py", line 1599, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid value for 'top_logprobs': must be less than or equal to 5.", 'type': 'invalid_request_error', 'param': 'top_logprobs', 'code': None}}
```
This line is causing the bug: 
```
            res, cost = await self.model.a_generate_raw_response(
                prompt, logprobs=True, top_logprobs=20
            )
```
I am using azureopenai api version: `2024-05-01-preview`

Ref to range value of `top_logprobs`: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference
**To Reproduce**
Steps to reproduce the behavior:
Run the following code locally 
```
from deepeval.metrics import GEval
from deepeval.test_case import LLMTestCaseParams

correctness_metric = GEval(
    name="Correctness",
    criteria="Determine whether the actual output is factually correct based on the expected output.",
    # NOTE: you can only provide either criteria or evaluation_steps, and not both
    evaluation_steps=[
        "Check whether the facts in 'actual output' contradicts any facts in 'expected output'",
        "You should also heavily penalize omission of detail",
        "Vague language, or contradicting OPINIONS, are OK"
    ],
    evaluation_params=[LLMTestCaseParams.INPUT, LLMTestCaseParams.ACTUAL_OUTPUT],
)
from deepeval.test_case import LLMTestCase
...

test_case = LLMTestCase(
    input="The dog chased the cat up the tree, who ran up the tree?",
    actual_output="It depends, some might consider the cat, while others might argue the dog.",
    expected_output="The cat."
)

correctness_metric.measure(test_case)
print(correctness_metric.score)
print(correctness_metric.reason)
```
**Expected behavior**
The exception shouldn't have occured. 

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
 - OS: Linux
 - Browser Edge
 - Version:  0.21.59

**Smartphone (please complete the following information):**
 - Device: [e.g. iPhone6]
 - OS: [e.g. iOS8.1]
 - Browser [e.g. stock browser, safari]
 - Version [e.g. 22]

**Additional context**
Add any other context about the problem here.


I ran into this as well because we have Azure OpenAI behind our  LiteLLM proxy.
I had to monkey patch to get around this.

OpenAI Azuer gpt-4o  2024-11-20 appears to now be taking the param of 20 and setting it down to 5 internally
I"m going to put a PR in for the change to make it configurable in GEval contructor, but if all the Azure deployments are behaving this way it might not be necessary.

top_logpobs  =20  in OpenAI's service delivers 'better' results using more of 0 to 1.0 spctrum for my metric test.
top_logpobs =5 is delivering different value that are skewing better.  Not sure if this is part of the math or just due to having less fidelity ... I'm not data sciency enough.