Repository: explodinggradients/ragas
Issue: Support for Gemini models not working
Root cause: Interface Contract Mismatch


**Describe the bug**
I am using ChatGoogleGenerativeAI from langchain, as a replacement for openai for the evaluate method. But i am getting an error regarding the temperature parameter of the generate content request being sent.

Ragas version: 0.1.5
Python version: 3.12

**Code to Reproduce**
`
from langchain_google_genai import GoogleGenerativeAIEmbeddings
from langchain_google_genai import ChatGoogleGenerativeAI
from ragas.llms.base import LangchainLLMWrapper

llm_gemini = ChatGoogleGenerativeAI(model="gemini-pro")
embeddings = GoogleGenerativeAIEmbeddings(model="models/embedding-001")
llm = LangchainLLMWrapper(llm_gemini)

from ragas.metrics import (
    answer_relevancy,
    faithfulness,
    context_recall,
    context_precision,
)

from ragas import evaluate

result = evaluate(
    amnesty_qa["eval"],
    metrics=[
        answer_relevancy
    ],
    llm=llm_gemini
)


`

**Error trace**

Exception in thread Thread-20:
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
    self.run()
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/executor.py", line 96, in run
    results = self.loop.run_until_complete(self._aresults())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/executor.py", line 84, in _aresults
    raise e
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/executor.py", line 79, in _aresults
    r = await future
        ^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/tasks.py", line 621, in _wait_for_one
    return f.result()  # May raise f.exception().
           ^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/executor.py", line 38, in sema_coro
    return await coro
           ^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/executor.py", line 112, in wrapped_callable_async
    return counter, await callable(*args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/metrics/base.py", line 93, in ascore
    raise e
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/metrics/base.py", line 89, in ascore
    score = await self._ascore(row=row, callbacks=group_cm, is_async=is_async)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/metrics/_answer_relevance.py", line 136, in _ascore
    result = await self.llm.generate(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/llms/base.py", line 110, in generate
    return await loop.run_in_executor(None, generate_text)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 325, in iter
    raise retry_exc.reraise()
          ^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 158, in reraise
    raise self.last_attempt.result()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 382, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/ragas/llms/base.py", line 147, in generate_text
    result = self.langchain_llm.generate_prompt(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py", line 544, in generate_prompt
    return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py", line 408, in generate
    raise e
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py", line 398, in generate
    self._generate_with_cache(
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py", line 577, in _generate_with_cache
    return self._generate(
           ^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/langchain_google_genai/chat_models.py", line 555, in _generate
    response: genai.types.GenerateContentResponse = _chat_with_retry(
                                                    ^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/langchain_google_genai/chat_models.py", line 152, in _chat_with_retry
    return _chat_with_retry(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 314, in iter
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 382, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/langchain_google_genai/chat_models.py", line 150, in _chat_with_retry
    raise e
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/langchain_google_genai/chat_models.py", line 134, in _chat_with_retry
    return generation_method(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/google/generativeai/generative_models.py", line 367, in send_message
    response = self.model.generate_content(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/google/generativeai/generative_models.py", line 234, in generate_content
    request = self._prepare_request(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/google/generativeai/generative_models.py", line 215, in _prepare_request
    return glm.GenerateContentRequest(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/uzair/Desktop/Kaavish2 RND/RAG_POC/.venv/lib/python3.12/site-packages/proto/message.py", line 576, in __init__
    raise ValueError(
ValueError: Unknown field for GenerateContentRequest: temperature


**Expected behavior**
I expected the evaluation to carry on as it would with openai


**Additional context**
I tried the llm wrapper as well but that did not work either. The embeddings work fine, its the llm that is causing the issue.