Skip to main content

ExternalGenerator

Call an external service with a prompt.

Basic Information

  • Type: deepset_cloud_custom_nodes.generators.external.ExternalGenerator
  • Components it can connect with:
    • PromptBuilder: ExternalGenerator receives the prompt from PromptBuilder.
    • DeepsetAnswerBuilder: ExternalGenerator sends the replies it received from the service to DeepsetAnswerBuilder, which uses them to build GeneratedAnswer objects.

Inputs

ParameterTypeDefaultDescription
promptstrThe prompt to pass to the service.
metaOptional[Dict]NoneAdditional metadata related to the prompt.

Outputs

ParameterTypeDefaultDescription
repliesList[str]The answers from the service.
metaList[Dict[str, Any]]Metadata related to the answers.

Overview

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 very 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.

Usage Example

Initializing the Component

components:
ExternalGenerator:
type: generators.external.ExternalGenerator
init_parameters:

Parameters

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
urlstrThe URL of the external service to post the prompt to.
timeoutint50The 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.

ParameterTypeDefaultDescription
promptstrThe prompt to pass to the service.
metaOptional[Dict]NoneAdditional metadata related to the prompt.