Repository: explodinggradients/ragas
Issue: TestSetGenerator.generate() returns text_generation.errors.ValidationError: temperature must be strictly positive with Langchain TGI LLM
Root cause: Configuration Error

Trying to reproduce [synthetic test set generation](https://docs.ragas.io/en/latest/getstarted/testset_generation.html) with a mistral or zephyr 7b model locally hosted through Langchain TextGenInference. No matter what temperature I set (0.0 to 1.0), I get the error `text_generation.errors.ValidationError: temperature must be strictly positive`. Any idea how to solve?

```
# Relevant versions
# I somehow had to install openai and llama-index before I could get ragas to work
ragas>=0.0.19
openai==0.28.1
llama-index>=0.8.42
text-generation>=0.6.1
langchain==0.0.330
```

```
from langchain.vectorstores import Chroma
from langchain.embeddings.sentence_transformer import SentenceTransformerEmbeddings
from ragas.llms import LangchainLLM
from ragas.testset import TestsetGenerator
from langchain.llms import HuggingFaceTextGenInference


llm = HuggingFaceTextGenInference(
        inference_server_url="http://localhost:8084/",
        max_new_tokens=512,
        top_k=10,
        top_p=0.95,
        typical_p=0.95,
        temperature=0.01,
        repetition_penalty=1.03,
        streaming=True
    )

# res = llm("What did foo say about bar?") # this works
ragas_llm = LangchainLLM(llm)

query = "Query that generates a handful of Document objects"

embedding_function = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
db = Chroma(persist_directory="./chroma_db", embedding_function=embedding_function)
docs = db.similarity_search(query)
assert len(docs) > 0

# Change resulting question type distribution
testset_distribution = {
    "simple": 0.25,
    "reasoning": 0.5,
    "multi_context": 0.0,
    "conditional": 0.25,
}

testsetgenerator = TestsetGenerator(generator_llm=ragas_llm, critic_llm=ragas_llm,embeddings_model=embedding_function, testset_distribution=testset_distribution)
test_size = 3
testset = testsetgenerator.generate(docs, test_size=test_size)

df = testset.to_pandas()
print(df.head())
```

Hey @jenghub, thanks for raising the issue and sharing the code. Can you please share the error trace as well? 

```
^CException occurred invoking consumer for subscription c43b1fe427b941049c2826f880a1bdb8to topic persistent://default/default/b00995a7-bbff-48b6-9a0a-b1fc9f1cf874 
/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/ragas/testset/testset_generator.py:316: UserWarning: Most documents are too short
  warnings.warn("Most documents are too short")
  0%|                                                                                                          | 0/3 [00:00<?, ?it/s]Traceback (most recent call last):
  File "/mnt/md0/share/project-name/syntheticqa.py", line 43, in <module>
    testset = testsetgenerator.generate(docs, test_size=test_size)
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/ragas/testset/testset_generator.py", line 338, in generate
    score = self._filter_context(text_chunk)
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/ragas/testset/testset_generator.py", line 179, in _filter_context
    results = self.critic_llm.generate(prompts=[prompt])
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/ragas/llms/base.py", line 129, in generate
    list_llmresults = run_async_tasks(
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/ragas/async_utils.py", line 41, in run_async_tasks
    outputs: List[Any] = asyncio.run(_gather())
  File "/home/userid/miniconda3/envs/foldername/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/userid/miniconda3/envs/foldername/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/ragas/async_utils.py", line 39, in _gather
    return await asyncio.gather(*tasks_to_execute)
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/ragas/llms/base.py", line 105, in generate_completions
    result = await self.llm.agenerate(ps, callbacks=callbacks)
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/langchain/llms/base.py", line 823, in agenerate
    output = await self._agenerate_helper(
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/langchain/llms/base.py", line 711, in _agenerate_helper
    raise e
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/langchain/llms/base.py", line 698, in _agenerate_helper
    await self._agenerate(
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/langchain/llms/base.py", line 1072, in _agenerate
    await self._acall(prompt, stop=stop, run_manager=run_manager, **kwargs)
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/langchain/llms/huggingface_text_gen_inference.py", line 217, in _acall
    async for chunk in self._astream(prompt, stop, run_manager, **kwargs):
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/langchain/llms/huggingface_text_gen_inference.py", line 276, in _astream
    async for res in self.async_client.generate_stream(prompt, **invocation_params):
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/text_generation/client.py", line 461, in generate_stream
    parameters = Parameters(
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/pydantic/main.py", line 164, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/pydantic/_internal/_decorators_v1.py", line 107, in wrapper2
    return val2(value)
  File "/mnt/md0/share/project-name/.venv/lib/python3.10/site-packages/text_generation/types.py", line 79, in valid_temp
    raise ValidationError("`temperature` must be strictly positive")
text_generation.errors.ValidationError: `temperature` must be strictly positive
```

Hey @jenghub , thanks for sharing this. I have raised a fix #267 . Please update ragas from source once it is merged :) 

Thanks. Is there a timeline for it to be merged in? It looks like this bug affects the core ragas evaluate() method as well and throws the same error.

Hey @jenghub , sorry for the delay. This was delayed due to issues with the recent open-ai package release. It will be merged today by @jjmachan 

Thank you @shahules786 . When installing from source
```
git clone https://github.com/explodinggradients/ragas && cd ragas
pip install -e . # I used pdm instead: pdm add -e ./ragas -G dev
```
I'm missing a bunch of dependencies when I run the same script. Did I botch the install?

```
ModuleNotFoundError: No module named 'llama_index'
ModuleNotFoundError: No module named 'hnswlib'
ModuleNotFoundError: No module named 'pkg_resources'
```