Repository: explodinggradients/ragas
Issue: Testset generation. ValueError: a cannot be empty unless no samples are taken
Root cause: Validation Gap

**Describe the bug**
ValueError: a cannot be empty unless no samples are taken

Ragas version: 0.1.1
Python version: 3.10.12

**Code to Reproduce**
```
from ragas.testset import TestsetGenerator  
from ragas.testset.evolutions import simple, reasoning, multi_context

distributions = {  
  simple: 0.5,  
  multi_context: 0.25,  
  reasoning: 0.25  
}

testsetgenerator = TestsetGenerator.with_openai(
  generator_llm = 'gpt-3.5-turbo-0125',  
  critic_llm = 'gpt-3.5-turbo-0125',
  embeddings = "text-embedding-3-small",
  chunk_size = 512,
)

testsetgenerator.adapt(language='russian', evolutions=distributions)

testset = testsetgenerator.generate_with_langchain_docs(test_docs, test_size=40, distributions=distributions, raise_exceptions=False)
```

**Error trace**
```
ERROR:ragas.executor:Runner in Executor raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/ragas/executor.py", line 58, in _aresults
    r = await future
  File "/usr/lib/python3.10/asyncio/tasks.py", line 571, in _wait_for_one
    return f.result()  # May raise f.exception().
  File "/usr/local/lib/python3.10/dist-packages/ragas/executor.py", line 91, in wrapped_callable_async
    return counter, await callable(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/ragas/testset/evolutions.py", line 161, in evolve
    ) = await self._aevolve(current_tries, current_nodes)
  File "/usr/local/lib/python3.10/dist-packages/ragas/testset/evolutions.py", line 272, in _aevolve
    nodes = self.docstore.get_random_nodes(k=1)
  File "/usr/local/lib/python3.10/dist-packages/ragas/testset/docstore.py", line 274, in get_random_nodes
    return rng.choice(np.array(self.nodes), size=k).tolist()
  File "_generator.pyx", line 803, in numpy.random._generator.Generator.choice
ValueError: a cannot be empty unless no samples are taken
```

**Expected behavior**
generation of test set from documents in russian language.


**Additional context**
--

<!-- PS: bugs suck but is also part of the process. We sincerely apologies for breaking your flow because of it, but don't worry, we got your back ❤️. We will get this fixed as fast as we can and thanks for helping us out by reporting it 🙏. -->


Hey @Sansan4ez can you share how many documents did you pass? 

Hey @Sansan4ez Just checking in here again. Are you facing the same issue now?

> Hey @Sansan4ez can you share how many documents did you pass?

It was 310 documents (231039 tokens) 

Hi, I'm facing the exact same issue. Interestingly it only occurs after calling adapt (to target language). Without adapt everythings runs fine for me. When I call generator.docstore.nodes is returns [] so there seems to be some problem with the document store.

> Hi, I'm facing the exact same issue. Interestingly it only occurs after calling adapt (to target language). Without adapt everythings runs fine for me. When I call generator.docstore.nodes is returns [] so there seems to be some problem with the document store.

same thing here. v. 0.1.4

Hi,
same problem here, after adapting. Didn't try without adapting. v. 0.1.4 me too

I found the root cause for the issue and provided a [PR that fixes it](https://github.com/explodinggradients/ragas/pull/766). The rout cause is, that the keyphrase extractor doesn't return anything.

Hey bros @smodlich @stas-milev @mbernardi82 @Sansan4ez just made a fix with help of @smodlich 

> Hey bros @smodlich @stas-milev @mbernardi82 @Sansan4ez just made a fix with help of @smodlich

thanks a lot - much appreciated. Has it been merged already?

`
    nodes = rng.choice(np.array(self.nodes), size=k, p=prob).tolist()
  File "_generator.pyx", line 729, in numpy.random._generator.Generator.choice
ValueError: a cannot be empty unless no samples are taken
`

I just got the same error.  ragas==0.1.7

@projects-g  creating a new issue. My issue could be different as I am not using the adaptor and I checked the PR and the code change is the same as the one I have on my end.  Please, feel free to add your details there https://github.com/explodinggradients/ragas/issues/871