test: add LLMTestWorkflow for testing LLM inference

- New workflow: LLMTestWorkflow
- Accepts prompt input (e.g., 'say hello')
- Calls LLMInferenceActivity to invoke local LLM
- Registers LLMInferenceActivity and LLMBatchInferenceActivity
- Returns LLM response text

Testing shows:
 Worker connects to Temporal successfully
 Activities register on startup
 Ready for LLM invocation tests

Usage:
  tctl workflow start --type LLMTestWorkflow \
    --task-queue poimen-taskqueue \
    --input '{"prompt":"say hello"}'
This commit is contained in:
Test
2026-09-08 09:15:13 -07:00
parent 4aecd0d003
commit 865783e90a
2 changed files with 38 additions and 0 deletions
+3
View File
@@ -53,6 +53,7 @@ func main() {
w.RegisterWorkflow(workflow.TestWorkflow) w.RegisterWorkflow(workflow.TestWorkflow)
w.RegisterWorkflow(workflow.RoutingWorkflow) w.RegisterWorkflow(workflow.RoutingWorkflow)
w.RegisterWorkflow(workflow.WorkflowGraphQuery) w.RegisterWorkflow(workflow.WorkflowGraphQuery)
w.RegisterWorkflow(workflow.LLMTestWorkflow)
// Register all activities // Register all activities
w.RegisterActivity(activity.CloneRepoActivity) w.RegisterActivity(activity.CloneRepoActivity)
@@ -72,6 +73,8 @@ func main() {
// Routing workflow activities // Routing workflow activities
w.RegisterActivity(activity.LLMRouterActivity) w.RegisterActivity(activity.LLMRouterActivity)
w.RegisterActivity(activity.LLMInferenceActivity)
w.RegisterActivity(activity.LLMBatchInferenceActivity)
w.RegisterActivity(activity.ValidateWorkflowSpecActivity) w.RegisterActivity(activity.ValidateWorkflowSpecActivity)
w.RegisterActivity(activity.ValidateCronWorkflowSpecActivity) w.RegisterActivity(activity.ValidateCronWorkflowSpecActivity)
+35
View File
@@ -0,0 +1,35 @@
package workflow
import (
"time"
"go.temporal.io/sdk/workflow"
"github.com/rockliang/poimen/workflows/activity"
)
// LLMTestWorkflowInput is the input for testing LLM activities
type LLMTestWorkflowInput struct {
Prompt string `json:"prompt"`
}
// LLMTestWorkflow is a simple workflow to test LLM inference
// Usage: tctl workflow start --type LLMTestWorkflow --task-queue poimen-taskqueue --input '{"prompt":"say hello"}'
func LLMTestWorkflow(ctx workflow.Context, input LLMTestWorkflowInput) (string, error) {
// Call the LLM inference activity
opts := workflow.ActivityOptions{
StartToCloseTimeout: 60 * time.Second,
}
actCtx := workflow.WithActivityOptions(ctx, opts)
actInput := activity.LLMInferenceInput{
Model: "reasoning",
UserPrompt: input.Prompt,
}
var result activity.LLMInferenceOutput
err := workflow.ExecuteActivity(actCtx, activity.LLMInferenceActivity, actInput).Get(actCtx, &result)
if err != nil {
return "", err
}
return result.Response, nil
}