LLMGen
AI-powered synthetic data from Large Language Models
LLMGen is a GenRocket data generator that integrates with Large Language Models (LLMs) to generate contextual, AI-powered data for testing and data generation scenarios. It supports various LLM providers, including OpenAI, Google Gemini, Anthropic Claude, and local models like Ollama.
Out of the box, LLMGen speaks the OpenAI chat-completions format, so any OpenAI-compatible endpoint works with three settings: a URL, a model name, and a key. Other APIs are reached with a request template and a response path.
Key features
- Supports Multiple Large Language Model (LLM) providers: OpenAI, Google Gemini, Anthropic, Ollama, and custom API endpoints.
- Conversation history: Keep context across multiple generations.
- Custom request and response formats: Support for non-standard API formats.
- Performance: Reuses connections through connection pooling to improve efficiency, with configurable request timeouts.
- Flexible execution modes: LIST for a pre-generated value, API_PER_ROW for dynamic generation.
- Robust Error Handling: Retries failed requests automatically, increasing the wait time between attempts.
-
Security: Supports encrypted configuration files to help protect sensitive settings.
How it works
LLMGen lets you generate realistic, contextual data by connecting GenRocket to advanced AI language models. Here’s how a typical workflow looks:
- You configure an Attribute in your GenRocket Domain to use the LLMGen generator and set its required parameters (prompt, mode, configPath, configName).
- When GenRocket runs, LLMGen builds a prompt (optionally using other Attribute values via grVar1–grVar5) and sends it to your chosen LLM provider (e.g., OpenAI, Gemini, Anthropic, or a custom endpoint).
- The LLM provider responds with generated text (like a customer name, address, or any data you requested).
- LLMGen inserts this response as the value for the Attribute in your test data row.
- Depending on your mode (LIST or API_PER_ROW), GenRocket either reuses a single generated value for all rows or creates a new value for each row.
This process is flexible—by adjusting your prompt and parameters, you can generate a wide range of data for different scenarios.

Prerequisites
Review these prerequisites before proceeding to configuration steps to ensure smooth setup and operation.
-
A Valid, Secure Configuration File
- The file named in configName and located at configPath must exist.
- This file contains authentication details and settings for your chosen LLM provider (such as OpenAI API keys, organization ID, endpoint URLs, etc.).
- The file must be properly formatted and accessible to the system and/or individual generating test data.
-
LLM Provider Account/Access
- You need an account/API access with the LLM provider (like OpenAI, Azure, etc.).
- Valid credentials (API keys, tokens, etc.) must be available and referenced in your configuration.
-
Properly Configured Domain and Attribute in GenRocket
- The LLMGen Generator must be attached to an Attribute in a GenRocket Domain.
- The Attribute’s LLMGen must have the correct parameter configuration and references.
- Supported GenRocket Version - Your environment is running a GenRocket version compatible with LLMGen.
- Network Connectivity - The system can reach the LLM provider’s API endpoints over the network.
- (Optional) grVar1–grVar5 Assignments - If your prompt uses dynamic values, assign them to grVar1–grVar5 parameters as needed.
Configuration File
Connection details live in a properties file, kept outside the Domain so that keys are never stored in a Project. Create a file such as llm-config.properties; it requires apiUrl and model.
Example: Configuration File
# API Configuration
apiUrl=https://api.openai.com/v1/chat/completions
apiKey=your-api-key-here
model=gpt-3.5-turbo
# Optional Parameters
temperature=0.7
maxTokens=150
systemPrompt=You are a helpful data generation assistant.
timeout=30000
maxRetries=3
initialRetryDelayMs=1000Configuration File Parameters
| PROPERTY | DEFAULT | DESCRIPTION |
|---|---|---|
| apiUrl | Required | Full endpoint URL of the LLM API. |
| model | Required | Model name sent with each request. |
| apiKey | None | API key. Leave it out for local models that need no authentication. |
| authScheme | Bearer | Scheme for the header Authorization: <authScheme> <apiKey> . |
| temperature | Not sent | Randomness of the reply, from 0.0 to 2.0. Lower values give more repeatable output. |
| maxTokens | Not sent | Upper limit on the length of the reply, sent as max_tokens . |
| systemPrompt | None | Optional system message placed ahead of the prompt. |
| timeout | 60000 | Connection and read timeout in milliseconds. |
| maxRetries | 3 | Total attempts for one call. 0 is read as not set, so use 1 for a single attempt. |
| initialRetryDelayMs | 1000 | Wait before the first retry, doubled on each later retry. Minimum 100. |
API Key Security
Keep the API key out of plain text by encrypting the file. This command writes llm-config.properties.gref beside the original. Set configName to the .gref file and delete the plain-text copy; LLMGen decrypts it in memory at run time.
genrocket -ef <Configuration File Name>Example:
genrocket -ef llm-config.propertiesGenerator Parameters
Set these on the attribute's LLMGen generator in the GenRocket Domain. Four are required: prompt, mode, configPath, and configName.
To use values from other Attributes, assign them to grVar1 … grVar5 and write the token in the prompt.
| PARAMETER | REQUIRED | DESCRIPTION |
|---|---|---|
| configPath | Yes | Directory that holds the configuration file. |
| configSubDir | No | Sub-directory under configPath. |
| configName | Yes | Configuration file name, for example llm-config.properties. |
| mode | Yes | LIST or API_PER_ROW. See Execution modes. |
| maintainHistory | No | true sends earlier prompts and replies with each new request. Default false. |
| maxHistoryMessages | No | Number of prompt and reply exchanges kept when history is on. Default 100. |
| grVar1 … grVar5 | No | Values, usually attribute references such as #{self.fullname}, that replace the matching token wherever it appears in the prompt. |
| prompt | Yes | The prompt sent to the model. It may contain the tokens grVar1 … grVar5. |
| defaultValue | No | Value written when a call fails or returns nothing. |
| list | No | Values used for sample-data preview, where no API call is made. |
Example: Generator Configuration
Below is a sample configuration for the LLMGen generator:
prompt=Generate a realistic customer name for a grVar1 business
grVar1=#{self.companyType}
mode=API_PER_ROW
configPath=/path/to/config
configName=llm-config.propertiesThe following image shows how the above Generator configuration appears in the GenRocket web platform:

Execution Modes
LIST
Calls the model once, when the generator starts, and uses that response for every row.
BEST FOR
- A fixed prompt where one generated value is enough
- Cost-sensitive runs and rate-limited APIs
- High row counts with no per-row latency
API_PER_ROW
Calls the model for every row, with the prompt resolved against that row's values.
BEST FOR
- Prompts that use grVar values from other attributes
- Output that must differ from row to row
- Lower volumes, since cost and run time grow with rows
Advanced Configuration
You can customize how LLMGen interacts with non-standard APIs or providers by setting advanced options in your configuration file. These options allow you to control the structure of requests, how responses are parsed, and additional headers or body parameters.
Custom Request Format (for non-OpenAI APIs)
The requestFormat replaces the default request body with your own JSON template.
requestFormat={"model":{model},"prompt": {prompt},"max_tokens":{maxTokens}}The placeholders {prompt}, {model}, {maxTokens}, {temperature}, {systemPrompt}, and {messages} are inserted as complete JSON values, so do not put quotes around them. Set every property the template uses.
Custom Response Format (dot-separated path)
The responseFormat is the path to the reply text; a number selects an array element.
responseFormat=choices.0.message.contentWithout the responseFormat, LLMGen recognizes OpenAI and Gemini responses and the fields content, response, output, text, and generated_text.
Extra Headers
The header.<Name> adds a request header.
The header.Authorization replaces the one built from apiKey.
header.X-Custom-Header=custom-value
header.Authorization=Bearer custom-tokenExtra Body Parameters
The body.<name> adds a field to the default request body.
body.top_p=0.9
body.seed=42
body.stop=["END"]Numbers, booleans, and JSON arrays or objects keep their type.
Example: Transliterating Names into Indic Scripts
This advanced example demonstrates how to use LLMGen to transliterate names into Indic scripts—such as Devanagari, Tamil, or Punjabi—and to display the target language for each transliterated value. This kind of configuration is useful for testing multilingual applications, ensuring data generation supports non-Latin scripts, or validating correct language assignment in your datasets.
Definitions
-
Transliterating - converting text from one writing system or alphabet into another while preserving the original pronunciation, rather than translating its meaning.
- Indic scripts - a family of writing systems used primarily in South Asia and Southeast Asia that evolved from the ancient Brahmi script.
Generator Parameters
prompt=Transliterate the following
text into grVar2:\n\ngrVar1
grVar1=#{self.fullname}
grVar2=#{self.lang}
mode=API_PER_ROW
configPath=/path/to/config
configName=config.propertiesFor row 1, the model receives:
Transliterate the following text into Punjabi:
Abhay AcharyaRetries in this sample. maxRetries=0 is read as not set, so a call that hits a retryable error is still attempted up to 3 times. Use maxRetries=1 for exactly one attempt.
Sample Config.properties
# API Configuration
apiUrl=https://api.bodhan.ai/v1/chat/completions
apiKey=your-api-key-here
authScheme=Bearer
model=indic-transliterate
# Generation Parameters
temperature=0
maxTokens=200
# Timeouts and Retries
timeout=300000
maxRetries=0
# System prompt intentionally left disabled.
# Bodhan's documented prompt contract: exactly one user turn and NO
system turn.
# A system prompt changes what the model sees and degrades output
silently.
#systemPrompt=You are a transliterator. Do not translate the name.Do not
give additional details. Only transliterated name in variable1 to
language in variable2 is to be given.Sample Output
| id | firstname | lastname | fullname | indicname | lang |
|---|---|---|---|---|---|
| 1 | Abhay | Acharya | Abhay Acharya | ਅਭ` ਆਚਾਰੀਆ | Punjabi |
| 2 | Abhijit | Agarwal | Abhijit Agarwal | অিভিজৎ আগরওয়াল | Bengali |
| 3 | Achuta | Agate | Achuta Agate | ਅਚ ਤਾ ਅਗਾਤੇ | Punjabi |
| 4 | Aditya | Aggarwal | Aditya Aggarwal | आ"ïदÆा अगरवाल | Manipuri |
| 5 | Ahura | Agrawal | Ahura Agrawal | ಅಹು ಾ ಅಗ¸ ಾಲ್ | Kannada |
| 6 | Ajatashatru | Ahluwalia | Ajatashatru Ahluwalia | అజాతశ అ వాలియా | Telugu |
| 7 | Ajay | Ahuja | Ajay Ahuja | அஜய் அஹுஜா | Tamil |
| 8 | Akaash | Amble | Akaash Amble | ਆਕਾਸ਼ ਅ*ਬਲ` | Punjabi |
| 9 | Akshay | Anand | Akshay Anand | ಅಕ್ಷಯ್ ಆನಂದ್ | Kannada |
| 10 | Akuti | Andra | Akuti Andra | ಅಕುಟಿ ಆಂBಾ¸ | Kannada |
Error handling
- Retried automatically: HTTP 429 (rate limit), HTTP 5xx (server error), and connection errors. The wait doubles each time: 1 s, 2 s, 4 s …
- Not retried: HTTP 400, 401, 403, and 404, which point to the configuration.
- If a call still fails, the row receives defaultValue and generation continues, so set one.
Troubleshooting
| SYMPTOM | LIKELY CAUSE | WHAT TO DO |
|---|---|---|
| HTTP 401, 403 or 404 | Wrong key, permission or endpoint | Check apiKey , authScheme, and apiUrl. |
| HTTP 429 or slow responses | Rate limit or a slow model | Reduce volume or raise timeout. |
| Value is *** No Response *** | Reply text not found in the response | Set responseFormat to the path of the text. |
| Same value on every row | Generator is in LIST mode | Switch to API_PER_ROW . |
| LLM config File not found | Path or file name is wrong | Check configPath and configName. |
Article Feedback: Was this helpful?
Give feedback