5.5 Hands-On Example: HTTP Summary with LLM Switch
Please note that this example is provided as a prototypical implementation, NOT as a production-ready integration. Therefore certain datapoints may require manual adaptation, especially when referencing external resources.
In this hands-on, we reuse the Hello World regulation example from this Chapter: How to Start - Hello World and turn it into a workflow.
Instead of calling a connector directly, the orchestration logic is expressed as a workflow that:
- Fetches content from a URL using an HTTP GET datapoint
- Stores the fetched content using a
settask - Dynamically selects between two LLM summarization datapoints
- Returns a summarized version of the content
What we learn
- How step-input chaining works in workflows
- How to use the set task to store intermediate results
- How to use a switch task to dynamically select between datapoints
- How existing datapoints can be reused unchanged inside workflows
Workflow definition
This workflow reuses the following datapoints from the Hello World scenario:
helloworld-dp1-hello-world-http-get
Fetches content from a user-provided URL via HTTP GEThelloworld-dp3-hello-world-prompt-chatgpt
Summarizes content using ChatGPThelloworld-dp4-hello-world-prompt-mistral
Summarizes content using Mistral
The workflow performs the following steps:
-
Call
helloworld-dp1-hello-world-http-getwith the URL provided as workflow input -
Store the returned response content in a workflow variable named
httpContent -
Use a
switchtask onroot.modelto select the LLM datapoint:chatgpt→ ChatGPT summarization datapointmistral→ Mistral summarization datapoint
-
Call the selected summarization datapoint with
httpContent -
Return the generated summary as the workflow result
Workflow configuration
Example Workflow
Example Workflow
{
"id": "helloworld-wf2-http-summary-llm-switch",
"name": "helloworld-wf2-http-summary-llm-switch",
"type": "workflow",
"version": "0.0.1",
"displayName": "helloworld-wf2-http-summary-llm-switch",
"tags": [
"example",
"simple-example",
"scenario-helloworld",
"scenario-example-helloworld"
],
"description": "Fetch content via an HTTP GET datapoint, store it in a workflow variable, and summarize it using either ChatGPT or Mistral based on workflow input.",
"workflow": {
"type": "temporal",
"definition": {
"do": [
{
"fetchContent": {
"call": "olive",
"with": {
"datapoint": "helloworld-dp1-hello-world-http-get",
"parameters": {
"url": "${root.url}"
}
}
}
},
{
"storeContent": {
"set": {
"httpContent": "${input}"
}
}
},
{
"chooseModel": {
"switch": [
{
"useChatGPT": {
"when": "${root.model = \"chatgpt\"}",
"then": "summarizeWithChatGPT"
}
},
{
"useMistral": {
"when": "${root.model = \"mistral\"}",
"then": "summarizeWithMistral"
}
},
{
"fallback": {
"when": "${true}",
"then": "summarizeWithChatGPT"
}
}
]
}
},
{
"summarizeWithChatGPT": {
"call": "olive",
"with": {
"datapoint": "helloworld-dp3-hello-world-prompt-chatgpt",
"parameters": {
"content": "${httpContent}"
}
},
"then": "end"
}
},
{
"summarizeWithMistral": {
"call": "olive",
"with": {
"datapoint": "helloworld-dp4-hello-world-prompt-mistral",
"parameters": {
"content": "${httpContent}"
}
},
"then": "end"
}
}
]
}
}
}
Example trigger via data-orchestrator:
Request Input
{
"id": "helloworld-wf2-http-summary-llm-switch",
"input": {
"url": "<your-url>",
"model": "chatgpt"
}
}