ExternalGenerator
Call an external service with a prompt and return its response.
ExternalGenerator sends a prompt to an external service and returns the results from the service. It expects the service to respond with answer: str, meta: Dict. It acts just like any other Generator except that instead of calling an LLM, it calls an external service.
ExternalGenerator is flexible regarding what constitutes a prompt and what the external service does with it. For example, this component can send a SQL query as a prompt to be run on a database in an external service.
Key Features
- Sends a text prompt to any external HTTP service and returns the response.
- Compatible with
PromptBuilderfor receiving prompts and withDeepsetAnswerBuilderfor building answers with references. - Configurable timeout for requests.
- Flexible: works with any service that accepts a string prompt and returns a string answer.
Configuration
- Drag the
ExternalGeneratorcomponent onto the canvas from the Component Library. - Click on the component to open the configuration panel.
- On the General tab:
- Enter the URL of the external service to post the prompt to.
- Go to the Advanced tab to configure the
timeoutfor requests (default: 50 seconds).
Connections
ExternalGenerator receives the prompt from PromptBuilder through its prompt input. It outputs the responses from the service as a list of strings through its replies output, which you connect to DeepsetAnswerBuilder.
Usage Examples
Basic Configuration
ExternalGenerator:
type: deepset_cloud_custom_nodes.generators.external.ExternalGenerator
init_parameters:
url: https://your-service.example.com/generate
Parameters
Inputs
| Parameter | Type | Description |
|---|---|---|
prompt | str | The prompt to pass to the service. |
meta | Optional[Dict] | Additional metadata related to the prompt. |
Outputs
| Parameter | Type | Description |
|---|---|---|
replies | List[str] | The answers from the service. |
meta | List[Dict[str, Any]] | Metadata related to the answers. |
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
url | str | The URL of the external service to post the prompt to. | |
timeout | int | 50 | The timeout for requests sent to the URL. |
Run Method Parameters
These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.
| Parameter | Type | Default | Description |
|---|---|---|---|
prompt | str | The prompt to pass to the service. | |
meta | Optional[Dict] | None | Additional metadata related to the prompt. |
Was this page helpful?