Repository: confident-ai/deepeval
Issue: Synthesizer stales with contexts > 1 and Ollama Backend
Root cause: Documentation Deficiency

There seems to be an issue with the generation step. After the document has been chunked and contexts have been built, the Synthesizer runs into timeout exceptions, even when the timeout is set very high.

Improvement steps are not reached to this point.

Full script:

```
import os
os.environ["DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDE"]="9999"

import requests
import pandas as pd

from deepeval.synthesizer import Synthesizer
from custom_openai_wrapper import MyOpenAIWrapper
from deepeval.models.embedding_models import OllamaEmbeddingModel
from deepeval.models.llms import OllamaModel
from deepeval.synthesizer.config import ContextConstructionConfig, EvolutionConfig, Evolution
from deepeval.synthesizer.types import Evolution
from deepeval.config.settings import get_settings

settings = get_settings()
with settings.edit(persist=False):
    settings.DEEPEVAL_DEBUG_ASYNC = True
    settings.DEEPEVAL_VERBOSE_MODE = True
    settings.LOG_LEVEL = "debug"
    
    settings.DEEPEVAL_SDK_RETRY_PROVIDERS = []    
    settings.DEEPEVAL_RETRY_MAX_ATTEMPTS = 1

       
url = "http://xyz:8003"

# ---------------------
# List Models
# ----------------------
url = f"{url}/api/tags"
response = requests.get(url)
data = response.json()["models"]
# Normalize into a proper table
models = pd.json_normalize(data)
models = models[["name", "details.family", "details.parameter_size", "details.quantization_level"]]
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', 120)

print(models)

# ----------------------
# Use your endpoint
# ----------------------
my_llm = OllamaModel(
    model="huihui_ai/qwen3-abliterated:latest", #8B Variant
    base_url=url,    
    temperature=0.0    
)

my_embedding_model = OllamaEmbeddingModel(
    #model="mxbai-embed-large",
    model="qwen3-embedding:8b",
    host=url,    
)


evolution_config=EvolutionConfig(
    evolutions={
        #Evolution.REASONING: 1 / 7,
        #Evolution.MULTICONTEXT: 1 / 7,
        #Evolution.CONCRETIZING: 1 / 7,
        #Evolution.CONSTRAINED: 1 / 7,
        #Evolution.COMPARATIVE: 1 / 7,
        #Evolution.HYPOTHETICAL: 1 / 7,
        #Evolution.IN_BREADTH: 1 / 7,
    },
    num_evolutions=0,
)

synthesizer = Synthesizer(model=my_llm, evolution_config=evolution_config)
synthesizer.model.embedding_model = my_embedding_model

goldens = synthesizer.generate_goldens_from_docs(
    document_paths=["stories/story1.docx"],
    context_construction_config=ContextConstructionConfig(
        embedder=my_embedding_model,
        critic_model=my_llm,
        chunk_size=1024,
        chunk_overlap=100,
        max_context_length=2048,
        max_contexts_per_document=10,
        context_quality_threshold=0.5,
    ),    
    max_goldens_per_context=10
)

# Save synthesizer
synthesizer.save_as(
    file_type='json',
    directory="./synthetic_data",
    file_name="dataset1"
)
````

Update on this. The issue was a poorly named parameter:
max_context_length=2,  

This does NOT hold the maximum number of chars but the maximum number of chunks per context!

So this would be a more meaningful parameter setting:
```
goldens = synthesizer.generate_goldens_from_docs(
    document_paths=["..."],
    context_construction_config=ContextConstructionConfig(
        embedder=my_embedding_model,
        critic_model=base_my_llm,  # Use unwrapped model for context construction
        chunk_size=512,  # Size of each chunk in characters
        chunk_overlap=50,  # Minimal overlap
        max_context_length=2,  # Maximum NUMBER OF CHUNKS per context (not chars!)
        max_contexts_per_document=10,  # Generate 10 contexts from document
        context_quality_threshold=0.4,  # Lower threshold to accept more chunks
    ),
    max_goldens_per_context=10  # Generate 10 goldens per context (total: 100 goldens)
)
```